Commit fb684a36 authored by Guillaume Seguin's avatar Guillaume Seguin

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

Conflicts:
	pronterface.py
parents 98bdfdb5 17c4166a
......@@ -22,14 +22,12 @@ from bufferedcanvas import *
class Graph(BufferedCanvas):
'''A class to show a Graph with Pronterface.'''
def __init__(self, parent, id, pos = wx.DefaultPosition,
def __init__(self, parent, id, root, pos = wx.DefaultPosition,
size = wx.Size(150, 80), style = 0):
# Forcing a no full repaint to stop flickering
style = style | wx.NO_FULL_REPAINT_ON_RESIZE
#call super function
super(Graph, self).__init__(parent, id, pos, size, style)
#BufferedCanvas.__init__(self, parent, id)
self.root = root
self.extruder0temps = [0]
self.extruder0targettemps = [0]
......@@ -50,18 +48,10 @@ class Graph(BufferedCanvas):
self._lastyvalue = 0
#self.sizer = wx.BoxSizer(wx.HORIZONTAL)
#self.sizer.Add(wx.Button(self, -1, "Button1", (0, 0)))
#self.SetSizer(self.sizer)
def OnPaint(self, evt):
dc = wx.PaintDC(self)
gc = wx.GraphicsContext.Create(dc)
def Destroy(self):
#call the super method
super(wx.Panel, self).Destroy()
def updateTemperatures(self, event):
self.AddBedTemperature(self.bedtemps[-1])
self.AddBedTargetTemperature(self.bedtargettemps[-1])
......@@ -79,8 +69,6 @@ class Graph(BufferedCanvas):
#b = gc.CreateLinearGradientBrush(0, 0, w, h, col1, col2)
gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 4))
gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(0, 0, 0, 0))))
gc.DrawRectangle(0, 0, self.width, self.height)
#gc.SetBrush(wx.Brush(wx.Colour(245, 245, 255, 52)))
......@@ -238,6 +226,7 @@ class Graph(BufferedCanvas):
self.Refresh()
def draw(self, dc, w, h):
dc.SetBackground(wx.Brush(self.root.settings.bgcolor))
dc.Clear()
gc = wx.GraphicsContext.Create(dc)
self.width = w
......
......@@ -190,7 +190,7 @@ class LeftPane(wx.GridBagSizer):
else:
self.Add(root.tempdisp, pos = (6, 0), span = (1, 6))
root.graph = Graph(root.panel, wx.ID_ANY)
root.graph = Graph(root.panel, wx.ID_ANY, root)
self.Add(root.graph, pos = (4, 5), span = (2, 1))
class VizPane(wx.BoxSizer):
......
......@@ -825,25 +825,25 @@ class pronsole(cmd.Cmd):
self.log("! os.listdir('.')")
def default(self, l):
if(l[0] in self.commandprefixes.upper()):
if(self.p and self.p.online):
if(not self.p.loud):
if l[0] in self.commandprefixes.upper():
if self.p and self.p.online:
if not self.p.loud:
self.log("SENDING:"+l)
self.p.send_now(l)
else:
self.log(_("Printer is not online."))
return
elif(l[0] in self.commandprefixes.lower()):
if(self.p and self.p.online):
if(not self.p.loud):
elif l[0] in self.commandprefixes.lower():
if self.p and self.p.online:
if not self.p.loud:
self.log("SENDING:"+l.upper())
self.p.send_now(l.upper())
else:
self.log(_("Printer is not online."))
return
elif(l[0] == "@"):
if(self.p and self.p.online):
if(not self.p.loud):
elif l[0] == "@":
if self.p and self.p.online:
if not self.p.loud:
self.log("SENDING:"+l[1:])
self.p.send_now(l[1:])
else:
......
......@@ -946,7 +946,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.onecmd('home')
else:
return
self.onecmd('M114')
self.p.send_now('M114')
def moveXY(self, x, y):
# When user clicks on the XY control, the Z control no longer gets spacebar/repeat signals
......@@ -957,12 +957,12 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.onecmd('move Y %s' % y)
else:
return
self.onecmd('M114')
self.p.send_now('M114')
def moveZ(self, z):
if z != 0:
self.onecmd('move Z %s' % z)
self.onecmd('M114')
self.p.send_now('M114')
# When user clicks on the Z control, the XY control no longer gets spacebar/repeat signals
self.xyb.clearRepeat()
......@@ -1127,15 +1127,18 @@ class PronterWindow(MainWindow, pronsole.pronsole):
return retval
def recvcb(self, l):
if "ok C:" in l:
isreport = False
if "ok C:" in l or "Count" in l:
self.posreport = l
self.update_pos()
isreport = True
if "ok T:" in l:
self.tempreport = l
wx.CallAfter(self.tempdisp.SetLabel, self.tempreport.strip().replace("ok ", ""))
self.update_tempdisplay()
isreport = True
tstring = l.rstrip()
if self.p.loud or (tstring not in ["ok", "wait"] and "ok T:" not in tstring and "ok C:" not in tstring):
if self.p.loud or (tstring not in ["ok", "wait"] and not isreport):
wx.CallAfter(self.addtexttolog, tstring + "\n");
for listener in self.recvlisteners:
listener(l)
......
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