Cleanup in pronterface.py

master
Guillaume Seguin 2012-08-03 23:35:06 +02:00
parent a63c310ec8
commit eaab285912
1 changed files with 4 additions and 21 deletions

View File

@ -31,7 +31,6 @@ import sys, glob, time, threading, traceback, cStringIO, subprocess
StringIO=cStringIO StringIO=cStringIO
thread=threading.Thread
winsize=(800,500) winsize=(800,500)
layerindex=0 layerindex=0
global buttonSize global buttonSize
@ -437,17 +436,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.Bind(wx.EVT_MENU, lambda *e:options(self), m.Append(-1,_("&Options"),_(" Options dialog"))) self.Bind(wx.EVT_MENU, lambda *e:options(self), m.Append(-1,_("&Options"),_(" Options dialog")))
self.Bind(wx.EVT_MENU, lambda x:threading.Thread(target=lambda :self.do_skein("set")).start(), m.Append(-1,_("Slicing Settings"),_(" Adjust slicing settings"))) self.Bind(wx.EVT_MENU, lambda x:threading.Thread(target=lambda :self.do_skein("set")).start(), m.Append(-1,_("Slicing Settings"),_(" Adjust slicing settings")))
#try:
# from SkeinforgeQuickEditDialog import SkeinforgeQuickEditDialog
# self.Bind(wx.EVT_MENU, lambda *e:SkeinforgeQuickEditDialog(self), m.Append(-1,_("SFACT Quick Settings"),_(" Quickly adjust SFACT settings for active profile")))
#except:
# pass
self.menustrip.Append(m,_("&Settings")) self.menustrip.Append(m,_("&Settings"))
self.update_macros_menu() self.update_macros_menu()
self.SetMenuBar(self.menustrip) self.SetMenuBar(self.menustrip)
def doneediting(self,gcode): def doneediting(self,gcode):
f=open(self.filename,"w") f=open(self.filename,"w")
f.write("\n".join(gcode)) f.write("\n".join(gcode))
@ -530,7 +523,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except: except:
pass pass
def popwindow(self): def popwindow(self):
# this list will contain all controls that should be only enabled # this list will contain all controls that should be only enabled
# when we're connected to a printer # when we're connected to a printer
@ -642,8 +634,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#lls.Add(self.zb, pos=(2,6), span=(1,1), flag=wx.ALIGN_CENTER) #lls.Add(self.zb, pos=(2,6), span=(1,1), flag=wx.ALIGN_CENTER)
wx.CallAfter(self.xyb.SetFocus) wx.CallAfter(self.xyb.SetFocus)
lls.Add(szbuttons, pos=(1,0), span=(1,8), flag=wx.ALIGN_CENTER) lls.Add(szbuttons, pos=(1,0), span=(1,8), flag=wx.ALIGN_CENTER)
for i in self.cpbuttons: for i in self.cpbuttons:
btn=wx.Button(self.panel,-1,i[0],style=wx.BU_EXACTFIT) btn=wx.Button(self.panel,-1,i[0],style=wx.BU_EXACTFIT)
btn.SetToolTip(wx.ToolTip(i[5])) btn.SetToolTip(wx.ToolTip(i[5]))
@ -658,7 +649,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
llts.Add(btn) llts.Add(btn)
else: else:
lls.Add(btn,pos=i[2],span=i[4]) lls.Add(btn,pos=i[2],span=i[4])
self.xyfeedc=wx.SpinCtrl(self.panel,-1,str(self.settings.xy_feedrate),min=0,max=50000,size=(70,-1)) self.xyfeedc=wx.SpinCtrl(self.panel,-1,str(self.settings.xy_feedrate),min=0,max=50000,size=(70,-1))
self.xyfeedc.SetToolTip(wx.ToolTip("Set Maximum Speed for X & Y axes (mm/min)")) self.xyfeedc.SetToolTip(wx.ToolTip("Set Maximum Speed for X & Y axes (mm/min)"))
llts.Add(wx.StaticText(self.panel,-1,_("XY:")), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) llts.Add(wx.StaticText(self.panel,-1,_("XY:")), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
@ -673,7 +664,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
lls.Add(self.monitorbox,pos=(2,6)) lls.Add(self.monitorbox,pos=(2,6))
self.monitorbox.Bind(wx.EVT_CHECKBOX,self.setmonitor) self.monitorbox.Bind(wx.EVT_CHECKBOX,self.setmonitor)
lls.Add(wx.StaticText(self.panel,-1,_("Heat")),pos=(2,0),span=(1,1),flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) lls.Add(wx.StaticText(self.panel,-1,_("Heat")),pos=(2,0),span=(1,1),flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT)
htemp_choices=[self.temps[i]+" ("+i+")" for i in sorted(self.temps.keys(),key=lambda x:self.temps[x])] htemp_choices=[self.temps[i]+" ("+i+")" for i in sorted(self.temps.keys(),key=lambda x:self.temps[x])]
@ -898,7 +888,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except: except:
pass pass
def toggleview(self,e): def toggleview(self,e):
if(self.mini): if(self.mini):
self.mini=False self.mini=False
@ -1009,7 +998,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
# print "Bad syntax for button definition, see 'help button'" # print "Bad syntax for button definition, see 'help button'"
# print x # print x
def cbutton_save(self,n,bdef,new_n=None): def cbutton_save(self,n,bdef,new_n=None):
if new_n is None: new_n=n if new_n is None: new_n=n
if bdef is None or bdef == "": if bdef is None or bdef == "":
@ -1308,7 +1296,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if self.webInterface: if self.webInterface:
self.webInterface.AddLog("Done monitoring.") self.webInterface.AddLog("Done monitoring.")
def setmonitor(self,e): def setmonitor(self,e):
self.monitor=self.monitorbox.GetValue() self.monitor=self.monitorbox.GetValue()
if self.monitor: if self.monitor:
@ -1316,8 +1303,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
else: else:
wx.CallAfter(self.graph.StopPlotting) wx.CallAfter(self.graph.StopPlotting)
def sendline(self,e): def sendline(self,e):
command=self.commandbox.GetValue() command=self.commandbox.GetValue()
if not len(command): if not len(command):
@ -1539,8 +1524,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.filename=filename self.filename=filename
self.stopsf=0 self.stopsf=0
self.skeining=1 self.skeining=1
thread(target=self.skein_func).start() threading.Thread(target=self.skein_func).start()
thread(target=self.skein_monitor).start() threading.Thread(target=self.skein_monitor).start()
def loadfile(self,event,filename=None): def loadfile(self,event,filename=None):
if self.skeining and self.skeinp is not None: if self.skeining and self.skeinp is not None:
@ -1658,7 +1643,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.p.send_now("M21") self.p.send_now("M21")
self.p.send_now("M28 "+str(dlg.GetValue())) self.p.send_now("M28 "+str(dlg.GetValue()))
self.recvlisteners+=[self.uploadtrigger] self.recvlisteners+=[self.uploadtrigger]
pass
def pause(self,event): def pause(self,event):
print _("Paused.") print _("Paused.")
@ -1684,7 +1668,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def sdprintfile(self,event): def sdprintfile(self,event):
self.on_startprint() self.on_startprint()
threading.Thread(target=self.getfiles).start() threading.Thread(target=self.getfiles).start()
pass
def connect(self,event): def connect(self,event):
print _("Connecting...") print _("Connecting...")