Merge branch 'experimental' of https://github.com/kliment/Printrun into experimental

master
Guillaume Seguin 2012-03-16 03:43:09 +01:00
commit d21f4d0a2c
4 changed files with 20 additions and 11 deletions

16
gviz.py
View File

@ -47,13 +47,21 @@ class window(wx.Frame):
else:
event.Skip()
def key(self, event):
x=event.GetKeyCode()
if event.ShiftDown():
cx,cy=self.p.translate
if x==wx.WXK_UP:
self.p.zoom(cx,cy,1.2)
if x==wx.WXK_DOWN:
self.p.zoom(cx,cy,1/1.2)
else:
if x==wx.WXK_UP:
self.p.layerup()
if x==wx.WXK_DOWN:
self.p.layerdown()
#print x
if x==wx.WXK_UP:
self.p.layerup()
if x==wx.WXK_DOWN:
self.p.layerdown()
#print p.lines.keys()
def zoom(self, event):

View File

@ -47,6 +47,7 @@ class printcore():
self.endcb=None#impl ()
self.onlinecb=None#impl ()
self.loud=False#emit sent and received lines to terminal
self.greetings=['start','Grbl ']
if port is not None and baud is not None:
#print port, baud
self.connect(port, baud)
@ -115,10 +116,10 @@ class printcore():
print "RECV: ",line.rstrip()
if(line.startswith('DEBUG_')):
continue
if(line.startswith('start') or line.startswith('ok')):
if(line.startswith(tuple(self.greetings)) or line.startswith('ok')):
self.clear=True
if(line.startswith('start') or line.startswith('ok') or "T:" in line):
if (not self.online or line.startswith('start')) and self.onlinecb is not None:
if(line.startswith(tuple(self.greetings)) or line.startswith('ok') or "T:" in line):
if (not self.online or line.startswith(tuple(self.greetings))) and self.onlinecb is not None:
try:
self.onlinecb()
except:

View File

@ -274,7 +274,7 @@ class pronsole(cmd.Cmd):
self.helpdict["temperature_pla"] = _("Extruder temp for PLA (default: 185 deg C)")
self.helpdict["xy_feedrate"] = _("Feedrate for Control Panel Moves in X and Y (default: 3000mm/min)")
self.helpdict["z_feedrate"] = _("Feedrate for Control Panel Moves in Z (default: 200mm/min)")
self.commandprefixes='MGT$'
def set_temp_preset(self,key,value):
if not key.startswith("bed"):
@ -870,14 +870,14 @@ class pronsole(cmd.Cmd):
print "! os.listdir('.')"
def default(self,l):
if(l[0]=='M' or l[0]=="G" or l[0]=='T'):
if(l[0] in self.commandprefixes.upper()):
if(self.p and self.p.online):
print "SENDING:"+l
self.p.send_now(l)
else:
print "Printer is not online."
return
if(l[0]=='m' or l[0]=="g" or l[0]=='t'):
elif(l[0] in self.commandprefixes.lower()):
if(self.p and self.p.online):
print "SENDING:"+l.upper()
self.p.send_now(l.upper())

View File

@ -1368,7 +1368,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except:
pass
dlg=wx.FileDialog(self,_("Open file to print"),basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard(_("OBJ, STL, and GCODE files (;*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ;)"))
dlg.SetWildcard(_("OBJ, STL, and GCODE files (*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ)|*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ|All Files (*.*)|*.*"))
if(filename is not None or dlg.ShowModal() == wx.ID_OK):
if filename is not None:
name=filename