From de81fffcb9fd381fb6eae4b436c7e6cc64517952 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 12 Aug 2012 16:27:42 +0200 Subject: [PATCH 1/5] pronterface.py: sort top row button creation code. No new functionality. --- pronterface.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pronterface.py b/pronterface.py index 2463fa1..fd46d2e 100755 --- a/pronterface.py +++ b/pronterface.py @@ -543,14 +543,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole): self.rescanbtn=wx.Button(self.panel,-1,_("Port"),size=buttonSize) self.rescanbtn.SetToolTip(wx.ToolTip("Communication Settings\nClick to rescan ports")) self.rescanbtn.Bind(wx.EVT_BUTTON,self.rescanports) - uts.Add(self.rescanbtn,0,wx.TOP|wx.LEFT,0) + self.serialport = wx.ComboBox(self.panel, -1, choices=self.scanserial(), style=wx.CB_DROPDOWN, size=(100, 25)) self.serialport.SetToolTip(wx.ToolTip("Select Port Printer is connected to")) self.rescanports() uts.Add(self.serialport) + uts.Add(wx.StaticText(self.panel,-1,"@"),0,wx.RIGHT|wx.ALIGN_CENTER,0) self.baud = wx.ComboBox(self.panel, -1, choices=["2400", "9600", "19200", "38400", "57600", "115200", "250000"], @@ -562,20 +563,22 @@ class PronterWindow(wx.Frame,pronsole.pronsole): except: pass uts.Add(self.baud) + self.connectbtn=wx.Button(self.panel,-1,_("Connect"), size=buttonSize) - uts.Add(self.connectbtn) self.connectbtn.SetToolTip(wx.ToolTip("Connect to the printer")) self.connectbtn.Bind(wx.EVT_BUTTON,self.connect) + uts.Add(self.connectbtn) + self.resetbtn=wx.Button(self.panel,-1,_("Reset"),style=wx.BU_EXACTFIT,size=(-1,buttonSize[1])) self.resetbtn.Bind(wx.EVT_BUTTON,self.reset) self.resetbtn.SetToolTip(wx.ToolTip("Reset the printer")) uts.Add(self.resetbtn) - #self.minibtn=wx.Button(self.panel,-1,_("Mini mode"),style=wx.BU_EXACTFIT) - #self.minibtn.Bind(wx.EVT_BUTTON,self.toggleview) #uts.Add((25,-1)) #uts.Add((15,-1),flag=wx.EXPAND) + #self.minibtn=wx.Button(self.panel,-1,_("Mini mode"),style=wx.BU_EXACTFIT) + #self.minibtn.Bind(wx.EVT_BUTTON,self.toggleview) #uts.Add(self.minibtn,0,wx.ALIGN_CENTER) #SECOND ROW From 4d612f212066e944b77b7477e868a8d709cf5b75 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 12 Aug 2012 18:03:11 +0200 Subject: [PATCH 2/5] pronterface.py: add a menu item for G-code debug capabilities. Making these visible should help users to find out what's going on on unexpected printer behaviour. --- pronterface.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pronterface.py b/pronterface.py index fd46d2e..e4ff777 100755 --- a/pronterface.py +++ b/pronterface.py @@ -436,6 +436,12 @@ 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 x:threading.Thread(target=lambda :self.do_skein("set")).start(), m.Append(-1,_("Slicing Settings"),_(" Adjust slicing settings"))) + + mItem = m.AppendCheckItem(-1, _("Debug G-code"), + _("Print all G-code sent to and received from the printer.")) + m.Check(mItem.GetId(), self.p.loud) + self.Bind(wx.EVT_MENU, self.setloud, mItem) + #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"))) @@ -1317,7 +1323,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole): else: wx.CallAfter(self.graph.StopPlotting) - + def setloud(self,e): + self.p.loud=e.IsChecked() def sendline(self,e): command=self.commandbox.GetValue() From 47aea82ade67c714aa73dc31020bc0507d78a299 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 12 Aug 2012 18:20:42 +0200 Subject: [PATCH 3/5] pronsole.py: repeat manual commands only in non-verbose mode. In verbose mode (self.p.loud = True), the code actually sending the G-code line prints this, too, so this was a duplicate. --- pronsole.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pronsole.py b/pronsole.py index 2d2b557..042b002 100755 --- a/pronsole.py +++ b/pronsole.py @@ -874,14 +874,16 @@ class pronsole(cmd.Cmd): def default(self,l): if(l[0] in self.commandprefixes.upper()): if(self.p and self.p.online): - print "SENDING:"+l + if(not self.p.loud): + print "SENDING:"+l self.p.send_now(l) else: print "Printer is not online." return elif(l[0] in self.commandprefixes.lower()): if(self.p and self.p.online): - print "SENDING:"+l.upper() + if(not self.p.loud): + print "SENDING:"+l.upper() self.p.send_now(l.upper()) else: print "Printer is not online." From 9975fe1fadbaab6e64fd947c9faf0d09cfbeac4c Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 12 Aug 2012 18:24:53 +0200 Subject: [PATCH 4/5] Rename .pronsolerc.example. In a source code repository, all sources should be visible, including those meant to be hidden at runtime. --- .pronsolerc.example => dot.pronsolerc.example | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .pronsolerc.example => dot.pronsolerc.example (100%) diff --git a/.pronsolerc.example b/dot.pronsolerc.example similarity index 100% rename from .pronsolerc.example rename to dot.pronsolerc.example From 24e2fa936c87ac41d3feb62907d3022d6d7356f2 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 12 Aug 2012 18:27:45 +0200 Subject: [PATCH 5/5] Remove the "loud" macro from the .pronsolerc example. As this is now part of the standard interface, it's pointless to list it as possible extension code. --- dot.pronsolerc.example | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/dot.pronsolerc.example b/dot.pronsolerc.example index 6a2a283..59cff0a 100644 --- a/dot.pronsolerc.example +++ b/dot.pronsolerc.example @@ -1,17 +1,6 @@ # Sample .pronsolerc file - copy this into your home directory and rename it to .pronsolerc !print "Loaded " + self.rc_filename -macro loud - !if self.p.loud: - !self.p.loud = 0 - !if hasattr(self,"cur_button") and self.cur_button is not None: - !self.onecmd('button %d "loud (off)" /c green loud' % self.cur_button) - !else: - !self.p.loud = 1 - !if hasattr(self,"cur_button") and self.cur_button is not None: - !self.onecmd('button %d "loud (on)" /c yellow loud' % self.cur_button) -button 0 "loud (off)" /c "green" loud - macro fan !global _fan !if '_fan' in globals() and _fan: @@ -24,4 +13,4 @@ macro fan M106 !if hasattr(self,"cur_button") and self.cur_button is not None: !self.onecmd('button %d "fan (on)" /c yellow fan' % self.cur_button) -button 1 "fan (off)" /c "green" fan +button 0 "fan (off)" /c "green" fan