Commit ad81fb62 authored by Travis Howse's avatar Travis Howse

Fixed formatting for pull request

parent 21c0b9aa
...@@ -9,10 +9,10 @@ class stlwrap: ...@@ -9,10 +9,10 @@ class stlwrap:
self.name=name self.name=name
if name is None: if name is None:
self.name=obj.name self.name=obj.name
def __repr__(self): def __repr__(self):
return self.name return self.name
class showstl(wx.Window): class showstl(wx.Window):
def __init__(self,parent,size,pos): def __init__(self,parent,size,pos):
...@@ -81,7 +81,7 @@ class showstl(wx.Window): ...@@ -81,7 +81,7 @@ class showstl(wx.Window):
facets+=i.facets facets+=i.facets
stltool.emitstl(name,facets,"plater_export") stltool.emitstl(name,facets,"plater_export")
print "wrote ",name print "wrote ",name
def autoplate(self,event): def autoplate(self,event):
print "Autoplating" print "Autoplating"
separation = 2 separation = 2
...@@ -119,7 +119,7 @@ class showstl(wx.Window): ...@@ -119,7 +119,7 @@ class showstl(wx.Window):
self.models[i].offsets[0] += centreoffset[0] self.models[i].offsets[0] += centreoffset[0]
self.models[i].offsets[1] += centreoffset[1] self.models[i].offsets[1] += centreoffset[1]
self.Refresh() self.Refresh()
def right(self,event): def right(self,event):
dlg=wx.FileDialog(self,"Open file to print",self.basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST) dlg=wx.FileDialog(self,"Open file to print",self.basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard("STL files (;*.stl;)") dlg.SetWildcard("STL files (;*.stl;)")
...@@ -132,7 +132,7 @@ class showstl(wx.Window): ...@@ -132,7 +132,7 @@ class showstl(wx.Window):
t=time.time() t=time.time()
#print name #print name
if name.lower().endswith(".stl"): if name.lower().endswith(".stl"):
#Filter out the path, just show the STL filename. #Filter out the path, just show the STL filename.
newname=re.match(r".*[/\\](.*?\.stl)", name.lower()).group(1) newname=re.match(r".*[/\\](.*?\.stl)", name.lower()).group(1)
c=1 c=1
while newname in self.models: while newname in self.models:
...@@ -179,17 +179,17 @@ class showstl(wx.Window): ...@@ -179,17 +179,17 @@ class showstl(wx.Window):
# break # break
dc.SelectObject(wx.NullBitmap) dc.SelectObject(wx.NullBitmap)
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(newname) self.l.Append(newname)
i=self.l.GetSelection() i=self.l.GetSelection()
if i==wx.NOT_FOUND: if i==wx.NOT_FOUND:
self.l.Select(0) self.l.Select(0)
self.l.Select(self.l.GetCount()-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):
...@@ -214,12 +214,12 @@ class showstl(wx.Window): ...@@ -214,12 +214,12 @@ class showstl(wx.Window):
p=event.GetPositionTuple() p=event.GetPositionTuple()
dc.DrawLine(self.initpos[0],self.initpos[1],p[0],p[1]) dc.DrawLine(self.initpos[0],self.initpos[1],p[0],p[1])
#print math.sqrt((p[0]-self.initpos[0])**2+(p[1]-self.initpos[1])**2) #print math.sqrt((p[0]-self.initpos[0])**2+(p[1]-self.initpos[1])**2)
del dc del dc
else: else:
event.Skip() event.Skip()
def rotateafter(self): def rotateafter(self):
if(self.i!=self.previ): if(self.i!=self.previ):
i=self.l.GetSelection() i=self.l.GetSelection()
...@@ -233,7 +233,7 @@ class showstl(wx.Window): ...@@ -233,7 +233,7 @@ class showstl(wx.Window):
time.sleep(0.01) time.sleep(0.01)
wx.CallAfter(self.rotateafter) wx.CallAfter(self.rotateafter)
self.triggered=0 self.triggered=0
def rot(self, event): def rot(self, event):
z=event.GetWheelRotation() z=event.GetWheelRotation()
s=self.l.GetSelection() s=self.l.GetSelection()
...@@ -247,11 +247,11 @@ class showstl(wx.Window): ...@@ -247,11 +247,11 @@ class showstl(wx.Window):
if not self.triggered: if not self.triggered:
self.triggered=1 self.triggered=1
threading.Thread(target=self.cr).start() threading.Thread(target=self.cr).start()
def repaint(self,event): def repaint(self,event):
dc=wx.PaintDC(self) dc=wx.PaintDC(self)
self.paint(dc=dc) self.paint(dc=dc)
def paint(self,coord1="x",coord2="y",dc=None): def paint(self,coord1="x",coord2="y",dc=None):
coords={"x":0,"y":1,"z":2} coords={"x":0,"y":1,"z":2}
if dc is None: if dc is None:
...@@ -289,16 +289,17 @@ class showstl(wx.Window): ...@@ -289,16 +289,17 @@ class showstl(wx.Window):
del dc del dc
#print time.time()-t #print time.time()-t
#s.export() #s.export()
class stlwin(wx.Frame): class stlwin(wx.Frame):
def __init__(self,size=(400,530)): def __init__(self,size=(400,530)):
wx.Frame.__init__(self,None,title="Right-click to add a file",size=size) wx.Frame.__init__(self,None,title="Right-click to add a file",size=size)
self.SetIcon(wx.Icon("plater.ico",wx.BITMAP_TYPE_ICO)) self.SetIcon(wx.Icon("plater.ico",wx.BITMAP_TYPE_ICO))
self.SetClientSize(size) self.SetClientSize(size)
self.s=showstl(self,(400,530),(0,0)) self.s=showstl(self,(400,530),(0,0))
if __name__ == '__main__': if __name__ == '__main__':
app = wx.App(False) app = wx.App(False)
main = stlwin() main = stlwin()
main.Show() main.Show()
app.MainLoop() app.MainLoop()
\ No newline at end of file
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