Commit 83d593ee authored by kliment's avatar kliment

Add custom button support, change progress bar color, make gcode preview bigger

parent 96243e18
...@@ -14,18 +14,18 @@ http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.12.0-py2 ...@@ -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 http://launchpad.net/pyreadline/trunk/1.7/+download/pyreadline-1.7.win32.exe
On Ubuntu/debian, do: 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: On Mac OS X, download and install:
http://downloads.sourceforge.net/wxpython/wxPython2.8-osx-unicode-2.8.12.0-universal-py2.6.dmg 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 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: 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 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 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 Then repeat the same with http://launchpad.net/pyreadline/trunk/1.7/+download/pyreadline-1.7.zip
USING PRONTERFACE USING PRONTERFACE
......
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
]
...@@ -9,6 +9,8 @@ class window(wx.Frame): ...@@ -9,6 +9,8 @@ class window(wx.Frame):
self.p.addgcode(i) self.p.addgcode(i)
#print time.time()-s #print time.time()-s
self.p.Bind(wx.EVT_KEY_DOWN,self.key) self.p.Bind(wx.EVT_KEY_DOWN,self.key)
self.Bind(wx.EVT_KEY_DOWN,self.key)
def key(self, event): def key(self, event):
x=event.GetKeyCode() x=event.GetKeyCode()
#print x #print x
...@@ -70,11 +72,12 @@ class gviz(wx.Panel): ...@@ -70,11 +72,12 @@ class gviz(wx.Panel):
dc=wx.PaintDC(self) dc=wx.PaintDC(self)
dc.SetBackground(wx.Brush((250,250,200))) dc.SetBackground(wx.Brush((250,250,200)))
dc.Clear() dc.Clear()
dc.SetBrush(wx.Brush((0,0,0))) if not self.showall:
dc.SetBrush(wx.Brush((43,144,255)))
dc.DrawRectangle(self.size[0]-15,0,15,self.size[1]) dc.DrawRectangle(self.size[0]-15,0,15,self.size[1])
dc.SetBrush(wx.Brush((0,255,0))) dc.SetBrush(wx.Brush((0,255,0)))
if len(self.layers): 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) 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: if self.showall:
l=[] l=[]
for i in self.layers: for i in self.layers:
......
...@@ -83,13 +83,20 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -83,13 +83,20 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
["Extrude",("extrude"),(13,0),(225,200,200),(1,2)], ["Extrude",("extrude"),(13,0),(225,200,200),(1,2)],
["Reverse",("reverse"),(14,0),(225,200,200),(1,2)], ["Reverse",("reverse"),(14,0),(225,200,200),(1,2)],
] ]
self.custombuttons=[]
self.btndict={} self.btndict={}
self.load_rc(".pronsolerc")
customdict={}
try:
execfile("custombtn.txt",customdict)
self.custombuttons=customdict["btns"]
except:
pass
self.popmenu() self.popmenu()
self.popwindow() self.popwindow()
self.t=Tee(self.catchprint) self.t=Tee(self.catchprint)
self.stdout=sys.stdout self.stdout=sys.stdout
self.mini=False self.mini=False
self.load_rc(".pronsolerc")
self.p.sendcb=self.sentcb self.p.sendcb=self.sentcb
self.curlayer=0 self.curlayer=0
...@@ -257,7 +264,17 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -257,7 +264,17 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
ubs.Add(self.monitorbox) ubs.Add(self.monitorbox)
ubs.Add(wx.StaticText(self.panel,-1,"Monitor\nprinter",pos=(470,37))) ubs.Add(wx.StaticText(self.panel,-1,"Monitor\nprinter",pos=(470,37)))
self.monitorbox.Bind(wx.EVT_CHECKBOX,self.setmonitor) 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 #Right full view
lrs=self.lowerrsizer=wx.BoxSizer(wx.VERTICAL) lrs=self.lowerrsizer=wx.BoxSizer(wx.VERTICAL)
self.logbox=wx.TextCtrl(self.panel,size=(350,340),pos=(440,75),style = wx.TE_MULTILINE) 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): ...@@ -329,11 +346,29 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.zfeedc.SetBackgroundColour((180,255,180)) self.zfeedc.SetBackgroundColour((180,255,180))
self.zfeedc.SetForegroundColour("black") self.zfeedc.SetForegroundColour("black")
lls.Add((10,0),pos=(0,11),span=(1,1)) 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.gwindow=gviz.window([])
self.gviz.Bind(wx.EVT_LEFT_DOWN,self.showwin) self.gviz.Bind(wx.EVT_LEFT_DOWN,self.showwin)
self.gwindow.Bind(wx.EVT_CLOSE,lambda x:self.gwindow.Hide()) 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=wx.BoxSizer(wx.VERTICAL)
self.uppersizer.Add(self.uppertopsizer) self.uppersizer.Add(self.uppertopsizer)
......
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