Commit 52a51fc7 authored by kliment's avatar kliment

Show current layer in visualization instead of all layers

parent 39245779
...@@ -2,8 +2,8 @@ import wx,time ...@@ -2,8 +2,8 @@ import wx,time
class window(wx.Frame): class window(wx.Frame):
def __init__(self): def __init__(self):
wx.Frame.__init__(self,None,title="Slicetest",size=(200,200)) wx.Frame.__init__(self,None,title="Slicetest",size=(600,600))
self.p=gviz(self,size=(200,200),bedsize=(200,200)) self.p=gviz(self,size=(600,600),bedsize=(200,200))
s=time.time() s=time.time()
for i in open("/home/kliment/designs/spinner/gearend_export.gcode"): for i in open("/home/kliment/designs/spinner/gearend_export.gcode"):
self.p.addgcode(i) self.p.addgcode(i)
...@@ -33,6 +33,7 @@ class gviz(wx.Panel): ...@@ -33,6 +33,7 @@ class gviz(wx.Panel):
self.mainpen=wx.Pen(wx.Colour(0,0,0)) self.mainpen=wx.Pen(wx.Colour(0,0,0))
self.fades=[wx.Pen(wx.Colour(150+20*i,150+20*i,150+20*i)) for i in xrange(6)] self.fades=[wx.Pen(wx.Colour(150+20*i,150+20*i,150+20*i)) for i in xrange(6)]
self.showall=0 self.showall=0
self.hilight=[]
def clear(self): def clear(self):
self.lastpos=[0,0,0,0,0] self.lastpos=[0,0,0,0,0]
...@@ -53,6 +54,15 @@ class gviz(wx.Panel): ...@@ -53,6 +54,15 @@ class gviz(wx.Panel):
self.layerindex-=1 self.layerindex-=1
self.Refresh() self.Refresh()
def setlayer(self,layer):
try:
self.layerindex=self.layers.index(layer)
wx.CallAfter(self.Refresh)
self.showall=0
except:
pass
def paint(self,event): def paint(self,event):
dc=wx.PaintDC(self) dc=wx.PaintDC(self)
dc.SetBackground(wx.Brush((250,250,200))) dc.SetBackground(wx.Brush((250,250,200)))
......
...@@ -45,7 +45,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -45,7 +45,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
os.putenv("UBUNTU_MENUPROXY","0") os.putenv("UBUNTU_MENUPROXY","0")
wx.Frame.__init__(self,None,title="Printer Interface",size=size); wx.Frame.__init__(self,None,title="Printer Interface",size=size);
self.panel=wx.Panel(self,-1,size=size) self.panel=wx.Panel(self,-1,size=size)
self.p=printcore.printcore()
self.statuscheck=False self.statuscheck=False
self.tempreport="" self.tempreport=""
self.monitor=0 self.monitor=0
...@@ -91,17 +90,23 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -91,17 +90,23 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.btndict={} self.btndict={}
self.popmenu() self.popmenu()
self.popwindow() self.popwindow()
self.recvlisteners=[]
self.p.recvcb=self.recvcb
self.sdfiles=[]
self.listing=0
self.sdprinting=0
self.percentdone=0
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.load_rc(".pronsolerc")
self.p.sendcb=self.sentcb
def online(self):
print "Printer is now online"
def sentcb(self,line):
if("Z" in line and "G1" in line):
try:
layer=float(line.split("Z")[1].split()[0])
wx.CallAfter(self.gviz.setlayer,layer)
except:
pass
def do_extrude(self,l=""): def do_extrude(self,l=""):
try: try:
......
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