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