Commit d21f4d0a authored by Guillaume Seguin's avatar Guillaume Seguin

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

parents 134704b7 a2285efd
...@@ -47,13 +47,21 @@ class window(wx.Frame): ...@@ -47,13 +47,21 @@ class window(wx.Frame):
else: else:
event.Skip() event.Skip()
def key(self, event): def key(self, event):
x=event.GetKeyCode() x=event.GetKeyCode()
#print x 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: if x==wx.WXK_UP:
self.p.layerup() self.p.layerup()
if x==wx.WXK_DOWN: if x==wx.WXK_DOWN:
self.p.layerdown() self.p.layerdown()
#print x
#print p.lines.keys() #print p.lines.keys()
def zoom(self, event): def zoom(self, event):
......
...@@ -47,6 +47,7 @@ class printcore(): ...@@ -47,6 +47,7 @@ class printcore():
self.endcb=None#impl () self.endcb=None#impl ()
self.onlinecb=None#impl () self.onlinecb=None#impl ()
self.loud=False#emit sent and received lines to terminal self.loud=False#emit sent and received lines to terminal
self.greetings=['start','Grbl ']
if port is not None and baud is not None: if port is not None and baud is not None:
#print port, baud #print port, baud
self.connect(port, baud) self.connect(port, baud)
...@@ -115,10 +116,10 @@ class printcore(): ...@@ -115,10 +116,10 @@ class printcore():
print "RECV: ",line.rstrip() print "RECV: ",line.rstrip()
if(line.startswith('DEBUG_')): if(line.startswith('DEBUG_')):
continue continue
if(line.startswith('start') or line.startswith('ok')): if(line.startswith(tuple(self.greetings)) or line.startswith('ok')):
self.clear=True self.clear=True
if(line.startswith('start') or line.startswith('ok') or "T:" in line): if(line.startswith(tuple(self.greetings)) or line.startswith('ok') or "T:" in line):
if (not self.online or line.startswith('start')) and self.onlinecb is not None: if (not self.online or line.startswith(tuple(self.greetings))) and self.onlinecb is not None:
try: try:
self.onlinecb() self.onlinecb()
except: except:
......
...@@ -274,7 +274,7 @@ class pronsole(cmd.Cmd): ...@@ -274,7 +274,7 @@ class pronsole(cmd.Cmd):
self.helpdict["temperature_pla"] = _("Extruder temp for PLA (default: 185 deg C)") 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["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.helpdict["z_feedrate"] = _("Feedrate for Control Panel Moves in Z (default: 200mm/min)")
self.commandprefixes='MGT$'
def set_temp_preset(self,key,value): def set_temp_preset(self,key,value):
if not key.startswith("bed"): if not key.startswith("bed"):
...@@ -870,14 +870,14 @@ class pronsole(cmd.Cmd): ...@@ -870,14 +870,14 @@ class pronsole(cmd.Cmd):
print "! os.listdir('.')" print "! os.listdir('.')"
def default(self,l): 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): if(self.p and self.p.online):
print "SENDING:"+l print "SENDING:"+l
self.p.send_now(l) self.p.send_now(l)
else: else:
print "Printer is not online." print "Printer is not online."
return 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): if(self.p and self.p.online):
print "SENDING:"+l.upper() print "SENDING:"+l.upper()
self.p.send_now(l.upper()) self.p.send_now(l.upper())
......
...@@ -1368,7 +1368,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1368,7 +1368,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(_("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 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