diff --git a/README b/README index 3593577..6700654 100644 --- a/README +++ b/README @@ -14,18 +14,18 @@ http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.12.0-py2 http://launchpad.net/pyreadline/trunk/1.7/+download/pyreadline-1.7.win32.exe On Ubuntu/debian, do: -apt-get install python-serial python-wxgtk2.8 +sudo apt-get install python-serial python-wxgtk2.8 On Mac OS X, download and install: http://downloads.sourceforge.net/wxpython/wxPython2.8-osx-unicode-2.8.12.0-universal-py2.6.dmg Grab the source for pyserial from http://pypi.python.org/packages/source/p/pyserial/pyserial-2.5.tar.gz Unzip pyserial to a folder. Then, in a terminal, change to the folder you unzipped to, then type in: defaults write com.apple.versioner.python Prefer-32-Bit -bool yes +sudo python setup.py install -Alternatively, you can run python in 32 bit mode by setting the following environment variable before running: +Alternatively, you can run python in 32 bit mode by setting the following environment variable before running the setup.py command: export VERSIONER_PYTHON_PREFER_32_BIT=yes -sudo python setup.py install Then repeat the same with http://launchpad.net/pyreadline/trunk/1.7/+download/pyreadline-1.7.zip USING PRONTERFACE diff --git a/custombtn.txt b/custombtn.txt new file mode 100644 index 0000000..42cbb25 --- /dev/null +++ b/custombtn.txt @@ -0,0 +1,16 @@ +btns=[ +###Defining custom buttons for pronterface is easy. Here's how. +###Below these instructions, add a line with the following format for each button +# ["button name","command",color(RGB)], <--That comma is important, do not forget it +###As an example: (Remove the # to try it out): +#["Read temp","M105",(200,100,100)], +###You can use gcodes or any pronsole/pronterface commands +###The first three buttons will end up at the top of the window, visible in mini mode +###The rest of the buttons will be at the bottom of the gcode preview +###ADD BUTTON DEFINITIONS BELOW THIS LINE + + + + +###ADD BUTTON DEFINITIONS ABOVE THIS LINE +] diff --git a/gviz.py b/gviz.py index 37aba8c..b346b41 100644 --- a/gviz.py +++ b/gviz.py @@ -9,6 +9,8 @@ class window(wx.Frame): self.p.addgcode(i) #print time.time()-s self.p.Bind(wx.EVT_KEY_DOWN,self.key) + self.Bind(wx.EVT_KEY_DOWN,self.key) + def key(self, event): x=event.GetKeyCode() #print x @@ -70,11 +72,12 @@ class gviz(wx.Panel): dc=wx.PaintDC(self) dc.SetBackground(wx.Brush((250,250,200))) dc.Clear() - dc.SetBrush(wx.Brush((0,0,0))) - dc.DrawRectangle(self.size[0]-15,0,15,self.size[1]) - dc.SetBrush(wx.Brush((0,255,0))) - if len(self.layers): - dc.DrawRectangle(self.size[0]-14,(1.0-(1.0*self.layerindex)/len(self.layers))*self.size[1],13,self.size[1]-1) + if not self.showall: + dc.SetBrush(wx.Brush((43,144,255))) + dc.DrawRectangle(self.size[0]-15,0,15,self.size[1]) + dc.SetBrush(wx.Brush((0,255,0))) + if len(self.layers): + dc.DrawRectangle(self.size[0]-14,(1.0-(1.0*(self.layerindex+1))/len(self.layers))*self.size[1],13,self.size[1]-1) if self.showall: l=[] for i in self.layers: diff --git a/pronterface.py b/pronterface.py index ead23cf..524725e 100644 --- a/pronterface.py +++ b/pronterface.py @@ -83,13 +83,20 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ["Extrude",("extrude"),(13,0),(225,200,200),(1,2)], ["Reverse",("reverse"),(14,0),(225,200,200),(1,2)], ] + self.custombuttons=[] self.btndict={} + self.load_rc(".pronsolerc") + customdict={} + try: + execfile("custombtn.txt",customdict) + self.custombuttons=customdict["btns"] + except: + pass self.popmenu() self.popwindow() self.t=Tee(self.catchprint) self.stdout=sys.stdout self.mini=False - self.load_rc(".pronsolerc") self.p.sendcb=self.sentcb self.curlayer=0 @@ -257,7 +264,17 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ubs.Add(self.monitorbox) ubs.Add(wx.StaticText(self.panel,-1,"Monitor\nprinter",pos=(470,37))) self.monitorbox.Bind(wx.EVT_CHECKBOX,self.setmonitor) - + try: + for i in self.custombuttons[:3]: + if i is None: + continue + b=wx.Button(self.panel,-1,i[0]) + b.properties=i + b.SetBackgroundColour(i[2]) + b.Bind(wx.EVT_BUTTON,self.procbutton) + ubs.Add(b) + except: + pass #Right full view lrs=self.lowerrsizer=wx.BoxSizer(wx.VERTICAL) self.logbox=wx.TextCtrl(self.panel,size=(350,340),pos=(440,75),style = wx.TE_MULTILINE) @@ -329,11 +346,29 @@ class PronterWindow(wx.Frame,pronsole.pronsole): self.zfeedc.SetBackgroundColour((180,255,180)) self.zfeedc.SetForegroundColour("black") lls.Add((10,0),pos=(0,11),span=(1,1)) - self.gviz=gviz.gviz(self.panel,(200,200),(200,200)) + self.gviz=gviz.gviz(self.panel,(300,300),(200,200)) + self.gviz.showall=1 self.gwindow=gviz.window([]) self.gviz.Bind(wx.EVT_LEFT_DOWN,self.showwin) self.gwindow.Bind(wx.EVT_CLOSE,lambda x:self.gwindow.Hide()) - lls.Add(self.gviz,pos=(0,10),span=(9,1)) + cs=wx.GridBagSizer() + cs.Add(self.gviz,pos=(0,0),span=(1,3)) + posindex=0 + try: + for i in self.custombuttons[3:]: + if i is None: + continue + b=wx.Button(self.panel,-1,i[0]) + b.properties=i + b.SetBackgroundColour(i[2]) + b.Bind(wx.EVT_BUTTON,self.procbutton) + cs.Add(b,pos=(1+posindex/3,posindex%3),span=(1,1)) + posindex+=1 + except: + pass + lls.Add(cs,pos=(0,10),span=(15,1)) + + self.uppersizer=wx.BoxSizer(wx.VERTICAL) self.uppersizer.Add(self.uppertopsizer)