Commit 174321aa authored by Keegi's avatar Keegi

Save last used temperature in pronterface, to put it in combo box for next run.

parent 2dc82723
...@@ -38,6 +38,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -38,6 +38,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def __init__(self, filename=None,size=winsize): def __init__(self, filename=None,size=winsize):
pronsole.pronsole.__init__(self) pronsole.pronsole.__init__(self)
self.settings.last_file_path = "" self.settings.last_file_path = ""
self.settings.last_temperature = 0.0
self.settings.last_bed_temperature = 0.0
self.filename=filename self.filename=filename
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);
...@@ -163,6 +165,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -163,6 +165,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.p.send_now("M104 S"+l) self.p.send_now("M104 S"+l)
print "Setting hotend temperature to ",f," degrees Celsius." print "Setting hotend temperature to ",f," degrees Celsius."
self.htemp.SetValue(l) self.htemp.SetValue(l)
self.set("last_temperature",str(f))
else: else:
print "Printer is not online." print "Printer is not online."
else: else:
...@@ -183,6 +186,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -183,6 +186,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.p.send_now("M140 S"+l) self.p.send_now("M140 S"+l)
print "Setting bed temperature to ",f," degrees Celsius." print "Setting bed temperature to ",f," degrees Celsius."
self.btemp.SetValue(l) self.btemp.SetValue(l)
self.set("last_bed_temperature",str(f))
else: else:
print "Printer is not online." print "Printer is not online."
else: else:
...@@ -370,9 +374,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -370,9 +374,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
lls.Add(wx.StaticText(self.panel,-1,"Heater:",pos=(0,343)),pos=(11,0),span=(1,1)) lls.Add(wx.StaticText(self.panel,-1,"Heater:",pos=(0,343)),pos=(11,0),span=(1,1))
htemp_choices=[self.temps[i]+" ("+i+")" for i in sorted(self.temps.keys(),key=lambda x:self.temps[x])]
if self.settings.last_temperature not in map(float,self.temps.values()):
htemp_choices = [str(self.settings.last_temperature)] + htemp_choices
self.htemp=wx.ComboBox(self.panel, -1, self.htemp=wx.ComboBox(self.panel, -1,
choices=[self.temps[i]+" ("+i+")" for i in sorted(self.temps.keys())], choices=htemp_choices,style=wx.CB_DROPDOWN, size=(90,25),pos=(45,337))
style=wx.CB_DROPDOWN, size=(90,25),pos=(45,337))
self.htemp.SetValue("0") self.htemp.SetValue("0")
lls.Add(self.htemp,pos=(11,1),span=(1,3)) lls.Add(self.htemp,pos=(11,1),span=(1,3))
self.settbtn=wx.Button(self.panel,-1,"Set",size=(30,-1),pos=(135,335)) self.settbtn=wx.Button(self.panel,-1,"Set",size=(30,-1),pos=(135,335))
...@@ -380,9 +386,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -380,9 +386,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.printerControls.append(self.settbtn) self.printerControls.append(self.settbtn)
lls.Add(self.settbtn,pos=(11,4),span=(1,2)) lls.Add(self.settbtn,pos=(11,4),span=(1,2))
lls.Add(wx.StaticText(self.panel,-1,"Bed:",pos=(0,343)),pos=(12,0),span=(1,1)) lls.Add(wx.StaticText(self.panel,-1,"Bed:",pos=(0,343)),pos=(12,0),span=(1,1))
btemp_choices=[self.bedtemps[i]+" ("+i+")" for i in sorted(self.bedtemps.keys(),key=lambda x:self.bedtemps[x])]
if self.settings.last_bed_temperature not in map(float,self.bedtemps.values()):
btemp_choices = [str(self.settings.last_bed_temperature)] + btemp_choices
self.btemp=wx.ComboBox(self.panel, -1, self.btemp=wx.ComboBox(self.panel, -1,
choices=[self.bedtemps[i]+" ("+i+")" for i in sorted(self.temps.keys())], choices=btemp_choices,style=wx.CB_DROPDOWN, size=(90,25),pos=(45,367))
style=wx.CB_DROPDOWN, size=(90,25),pos=(45,367))
self.btemp.SetValue("0") self.btemp.SetValue("0")
lls.Add(self.btemp,pos=(12,1),span=(1,3)) lls.Add(self.btemp,pos=(12,1),span=(1,3))
self.setbbtn=wx.Button(self.panel,-1,"Set",size=(30,-1),pos=(135,365)) self.setbbtn=wx.Button(self.panel,-1,"Set",size=(30,-1),pos=(135,365))
......
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