Commit 16b5f6db authored by Guillaume Seguin's avatar Guillaume Seguin

Cleanup some code

Not sure about that dropping of the self.gwindow.Destroy try block, we'll see
parent 0920bc6e
...@@ -69,18 +69,17 @@ class window(wx.Frame): ...@@ -69,18 +69,17 @@ class window(wx.Frame):
def mouse(self, event): def mouse(self, event):
if event.ButtonUp(wx.MOUSE_BTN_LEFT): if event.ButtonUp(wx.MOUSE_BTN_LEFT):
if(self.initpos is not None): if self.initpos is not None:
self.initpos = None self.initpos = None
elif event.Dragging(): elif event.Dragging():
e = event.GetPositionTuple() e = event.GetPositionTuple()
if self.initpos is None or not hasattr(self, "basetrans"): if self.initpos is None or not hasattr(self, "basetrans"):
self.initpos = e self.initpos = e
self.basetrans = self.p.translate self.basetrans = self.p.translate
self.p.translate = [ self.basetrans[0]+(e[0]-self.initpos[0]), self.p.translate = [self.basetrans[0] + (e[0] - self.initpos[0]),
self.basetrans[1]+(e[1]-self.initpos[1]) ] self.basetrans[1] + (e[1] - self.initpos[1])]
self.p.dirty = 1 self.p.dirty = 1
self.p.Refresh() wx.CallAfter(self.p.Refresh)
else: else:
event.Skip() event.Skip()
...@@ -174,7 +173,7 @@ class gviz(wx.Panel): ...@@ -174,7 +173,7 @@ class gviz(wx.Panel):
self.layerindex = 0 self.layerindex = 0
self.showall = 0 self.showall = 0
self.dirty = 1 self.dirty = 1
self.Refresh() wx.CallAfter(self.Refresh)
def layerup(self): def layerup(self):
if(self.layerindex+1<len(self.layers)): if(self.layerindex+1<len(self.layers)):
...@@ -182,7 +181,7 @@ class gviz(wx.Panel): ...@@ -182,7 +181,7 @@ class gviz(wx.Panel):
# Display layer info on statusbar (Jezmy) # Display layer info on statusbar (Jezmy)
self.parent.SetStatusText("Layer "+str(self.layerindex +1)+" - Going Up - Z = "+str(self.layers[self.layerindex])+" mm", 0) self.parent.SetStatusText("Layer "+str(self.layerindex +1)+" - Going Up - Z = "+str(self.layers[self.layerindex])+" mm", 0)
self.dirty = 1 self.dirty = 1
self.Refresh() wx.CallAfter(self.Refresh)
def layerdown(self): def layerdown(self):
if(self.layerindex>0): if(self.layerindex>0):
...@@ -190,7 +189,7 @@ class gviz(wx.Panel): ...@@ -190,7 +189,7 @@ class gviz(wx.Panel):
# Display layer info on statusbar (Jezmy) # Display layer info on statusbar (Jezmy)
self.parent.SetStatusText("Layer "+str(self.layerindex + 1)+" - Going Down - Z = "+str(self.layers[self.layerindex])+ " mm", 0) self.parent.SetStatusText("Layer "+str(self.layerindex + 1)+" - Going Down - Z = "+str(self.layers[self.layerindex])+ " mm", 0)
self.dirty = 1 self.dirty = 1
self.Refresh() wx.CallAfter(self.Refresh)
def setlayer(self, layer): def setlayer(self, layer):
try: try:
...@@ -222,7 +221,7 @@ class gviz(wx.Panel): ...@@ -222,7 +221,7 @@ class gviz(wx.Panel):
for pen in self.penslist: for pen in self.penslist:
pen.SetWidth(penwidth) pen.SetWidth(penwidth)
self.dirty = 1 self.dirty = 1
self.Refresh() wx.CallAfter(self.Refresh)
def repaint(self): def repaint(self):
self.blitmap = wx.EmptyBitmap(self.GetClientSize()[0], self.GetClientSize()[1],-1) self.blitmap = wx.EmptyBitmap(self.GetClientSize()[0], self.GetClientSize()[1],-1)
...@@ -293,9 +292,7 @@ class gviz(wx.Panel): ...@@ -293,9 +292,7 @@ class gviz(wx.Panel):
if self.dirty: if self.dirty:
self.repaint() self.repaint()
self.dirty = 0 self.dirty = 0
sz = self.GetClientSize()
dc.DrawBitmap(self.blitmap, 0, 0) dc.DrawBitmap(self.blitmap, 0, 0)
del dc
def addfile(self, gcode): def addfile(self, gcode):
self.clear() self.clear()
......
...@@ -984,11 +984,8 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -984,11 +984,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.save_in_rc("set xy_feedrate", "set xy_feedrate %d" % self.settings.xy_feedrate) self.save_in_rc("set xy_feedrate", "set xy_feedrate %d" % self.settings.xy_feedrate)
self.save_in_rc("set z_feedrate", "set z_feedrate %d" % self.settings.z_feedrate) self.save_in_rc("set z_feedrate", "set z_feedrate %d" % self.settings.z_feedrate)
self.save_in_rc("set e_feedrate", "set e_feedrate %d" % self.settings.e_feedrate) self.save_in_rc("set e_feedrate", "set e_feedrate %d" % self.settings.e_feedrate)
try: wx.CallAfter(self.gwindow.Destroy)
self.gwindow.Destroy() wx.CallAfter(self.Destroy)
except:
pass
self.Destroy()
def do_monitor(self, l = ""): def do_monitor(self, l = ""):
if l.strip()=="": if l.strip()=="":
......
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