Commit 50c2c434 authored by Travis Howse's avatar Travis Howse

Merge remote-tracking branch 'kliment/master'

Conflicts:
	plater.py
parents 4053291e 0da65f14
...@@ -16,7 +16,7 @@ class stlwrap: ...@@ -16,7 +16,7 @@ class stlwrap:
class showstl(wx.Window): class showstl(wx.Window):
def __init__(self,parent,size,pos): def __init__(self,parent,size,pos):
wx.Window.__init__(self,parent,size=size,pos=pos) wx.Window.__init__(self,parent,size=size,pos=pos)
self.l=wx.ListCtrl(self,style=wx.LC_LIST,size=(300,130),pos=(0,size[1]-130)) self.l=wx.ListBox(self,size=(300,130),pos=(0,size[1]-130))
self.eb=wx.Button(self,label="Export",pos=(300,size[1]-130)) self.eb=wx.Button(self,label="Export",pos=(300,size[1]-130))
self.sb=wx.Button(self,label="Snap to Z=0",pos=(300,size[1]-105)) self.sb=wx.Button(self,label="Snap to Z=0",pos=(300,size[1]-105))
self.cb=wx.Button(self,label="Put at 100,100",pos=(300,size[1]-80)) self.cb=wx.Button(self,label="Put at 100,100",pos=(300,size[1]-80))
...@@ -42,26 +42,26 @@ class showstl(wx.Window): ...@@ -42,26 +42,26 @@ class showstl(wx.Window):
self.prevsel=-1 self.prevsel=-1
def center(self,event): def center(self,event):
i=self.l.GetFirstSelected() i=self.l.GetSelection()
if i != -1: if i != -1:
m=self.models[self.l.GetItemText(i)] m=self.models[self.l.GetString(i)]
m.offsets=[100,100,m.offsets[2]] m.offsets=[100,100,m.offsets[2]]
self.Refresh() self.Refresh()
def snap(self,event): def snap(self,event):
i=self.l.GetFirstSelected() i=self.l.GetSelection()
if i != -1: if i != -1:
m=self.models[self.l.GetItemText(i)] m=self.models[self.l.GetString(i)]
m.offsets[2]=-1.0*min(m.facetsminz)[0] m.offsets[2]=-1.0*min(m.facetsminz)[0]
#print m.offsets[2] #print m.offsets[2]
self.Refresh() self.Refresh()
def delete(self,event): def delete(self,event):
i=self.l.GetFirstSelected() i=self.l.GetSelection()
if i != -1: if i != -1:
del self.models[self.l.GetItemText(i)] del self.models[self.l.GetString(i)]
self.l.DeleteItem(i) self.l.Delete(i)
self.l.Select(self.l.GetItemCount()-1) self.l.Select(self.l.GetCount()-1)
self.Refresh() self.Refresh()
def export(self,event): def export(self,event):
...@@ -89,7 +89,7 @@ class showstl(wx.Window): ...@@ -89,7 +89,7 @@ class showstl(wx.Window):
newrow = 0 newrow = 0
max = [0,0] max = [0,0]
for i in self.models: for i in self.models:
self.models[i].offsets[2]=-1.0*min(self.models[i].facetsminz)[0] self.models[i].offsets[2]=-1.0*self.models[i].dims[4]
x = abs(self.models[i].dims[0] - self.models[i].dims[1]) x = abs(self.models[i].dims[0] - self.models[i].dims[1])
y = abs(self.models[i].dims[2] - self.models[i].dims[3]) y = abs(self.models[i].dims[2] - self.models[i].dims[3])
centre = [x/2, y/2] centre = [x/2, y/2]
...@@ -179,24 +179,24 @@ class showstl(wx.Window): ...@@ -179,24 +179,24 @@ class showstl(wx.Window):
m.bitmap.SetMask(wx.Mask(m.bitmap,wx.Colour(0,0,0,255))) m.bitmap.SetMask(wx.Mask(m.bitmap,wx.Colour(0,0,0,255)))
#print time.time()-t #print time.time()-t
self.l.Append([stlwrap(self.models[newname],newname)]) self.l.Append(newname)
i=self.l.GetFirstSelected() i=self.l.GetSelection()
if i != -1: if i==wx.NOT_FOUND:
self.l.Select(i,0) self.l.Select(0)
self.l.Select(self.l.GetItemCount()-1) self.l.Select(self.l.GetCount()-1)
self.Refresh() self.Refresh()
#print time.time()-t #print time.time()-t
def move(self,event): def move(self,event):
if event.ButtonUp(wx.MOUSE_BTN_LEFT): if event.ButtonUp(wx.MOUSE_BTN_LEFT):
if(self.initpos is not None): if(self.initpos is not None):
i=self.l.GetFirstSelected() i=self.l.GetSelection()
if i != -1: if i != wx.NOT_FOUND:
p=event.GetPositionTuple() p=event.GetPositionTuple()
#print (p[0]-self.initpos[0]),(p[1]-self.initpos[1]) #print (p[0]-self.initpos[0]),(p[1]-self.initpos[1])
t=time.time() t=time.time()
m=self.models[self.l.GetItemText(i)] m=self.models[self.l.GetString(i)]
m.offsets=[m.offsets[0]+0.5*(p[0]-self.initpos[0]),m.offsets[1]-0.5*(p[1]-self.initpos[1]),m.offsets[2]] m.offsets=[m.offsets[0]+0.5*(p[0]-self.initpos[0]),m.offsets[1]-0.5*(p[1]-self.initpos[1]),m.offsets[2]]
#self.models[self.l.GetItemText(i)]=self.models[self.l.GetItemText(i)].translate([0.5*(p[0]-self.initpos[0]),0.5*(p[1]-self.initpos[1]),0]) #self.models[self.l.GetItemText(i)]=self.models[self.l.GetItemText(i)].translate([0.5*(p[0]-self.initpos[0]),0.5*(p[1]-self.initpos[1]),0])
#print time.time()-t #print time.time()-t
...@@ -220,10 +220,10 @@ class showstl(wx.Window): ...@@ -220,10 +220,10 @@ class showstl(wx.Window):
def rotateafter(self): def rotateafter(self):
if(self.i!=self.previ): if(self.i!=self.previ):
i=self.l.GetFirstSelected() i=self.l.GetSelection()
if i != -1: if i != wx.NOT_FOUND:
#o=self.models[self.l.GetItemText(i)].offsets #o=self.models[self.l.GetItemText(i)].offsets
self.models[self.l.GetItemText(i)].rot+=5*(self.i-self.previ) self.models[self.l.GetString(i)].rot+=5*(self.i-self.previ)
#self.models[self.l.GetItemText(i)].offsets=o #self.models[self.l.GetItemText(i)].offsets=o
self.previ=self.i self.previ=self.i
self.Refresh() self.Refresh()
...@@ -234,7 +234,7 @@ class showstl(wx.Window): ...@@ -234,7 +234,7 @@ class showstl(wx.Window):
def rot(self, event): def rot(self, event):
z=event.GetWheelRotation() z=event.GetWheelRotation()
s=self.l.GetFirstSelected() s=self.l.GetSelection()
if self.prevsel!=s: if self.prevsel!=s:
self.i=0 self.i=0
self.prevsel=s self.prevsel=s
......
...@@ -727,7 +727,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -727,7 +727,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
n = button.custombutton n = button.custombutton
self.custombuttons[n]=None self.custombuttons[n]=None
self.cbutton_save(n,None) self.cbutton_save(n,None)
while self.custombuttons[-1] is None: while len(self.custombuttons) and self.custombuttons[-1] is None:
del self.custombuttons[-1] del self.custombuttons[-1]
self.cbuttons_reload() self.cbuttons_reload()
...@@ -1008,7 +1008,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1008,7 +1008,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except: except:
pass pass
dlg=wx.FileDialog(self,_("Open file to print"),basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST) dlg=wx.FileDialog(self,_("Open file to print"),basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard(_("STL and GCODE files (;*.gcode;*.g;*.stl;*.STL;)")) dlg.SetWildcard(_("STL and GCODE files (;*.gcode;*.gco;*.g;*.stl;*.STL;)"))
if(filename is not None or dlg.ShowModal() == wx.ID_OK): if(filename is not None or dlg.ShowModal() == wx.ID_OK):
if filename is not None: if filename is not None:
name=filename name=filename
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment