Commit 567c1d23 authored by Kliment Yanev's avatar Kliment Yanev

Merge branch 'master' of github.com:kliment/Printrun

parents 48d99026 a16a1506
...@@ -146,13 +146,13 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -146,13 +146,13 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def endcb(self): def endcb(self):
if(self.p.queueindex==0): if(self.p.queueindex==0):
print "Print took "+str(int(time.time()-self.starttime)/60)+" minutes "+str(int(time.time()-self.starttime)%60)+" seconds" print "Print took "+str(int(time.time()-self.starttime)/60)+" minutes "+str(int(time.time()-self.starttime)%60)+" seconds."
wx.CallAfter(self.pausebtn.Disable) wx.CallAfter(self.pausebtn.Disable)
wx.CallAfter(self.printbtn.SetLabel,_("Print")) wx.CallAfter(self.printbtn.SetLabel,_("Print"))
def online(self): def online(self):
print _("Printer is now online") print _("Printer is now online.")
wx.CallAfter(self.connectbtn.Disable) wx.CallAfter(self.connectbtn.Disable)
for i in self.printerControls: for i in self.printerControls:
wx.CallAfter(i.Enable) wx.CallAfter(i.Enable)
...@@ -381,13 +381,17 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -381,13 +381,17 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
uts=self.uppertopsizer=wx.BoxSizer(wx.HORIZONTAL) uts=self.uppertopsizer=wx.BoxSizer(wx.HORIZONTAL)
uts.Add(wx.StaticText(self.panel,-1,_("Port:"),pos=(0,5)),wx.TOP|wx.LEFT,5) uts.Add(wx.StaticText(self.panel,-1,_("Port:"),pos=(0,5)),wx.TOP|wx.LEFT,5)
scan=self.scanserial() scan=self.scanserial()
portslist=list(scan)
if self.settings.port != "" and self.settings.port not in portslist:
portslist += [self.settings.port]
self.serialport = wx.ComboBox(self.panel, -1, self.serialport = wx.ComboBox(self.panel, -1,
choices=scan, choices=portslist,
style=wx.CB_DROPDOWN|wx.CB_SORT, pos=(50,0)) style=wx.CB_DROPDOWN|wx.CB_SORT, pos=(50,0))
try: try:
self.serialport.SetValue(scan[0]) if self.settings.port in scan:
if self.settings.port:
self.serialport.SetValue(self.settings.port) self.serialport.SetValue(self.settings.port)
elif len(portslist)>0:
self.serialport.SetValue(portslist[0])
except: except:
pass pass
uts.Add(self.serialport) uts.Add(self.serialport)
...@@ -487,23 +491,45 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -487,23 +491,45 @@ 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])] 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()): if self.settings.last_temperature not in map(float,self.temps.values()):
htemp_choices = [str(self.settings.last_temperature)] + htemp_choices htemp_choices = [str(self.settings.last_temperature)] + htemp_choices
self.htemp=wx.ComboBox(self.panel, -1, self.htemp=wx.ComboBox(self.panel, -1,
choices=htemp_choices,style=wx.CB_DROPDOWN, size=(90,25),pos=(45,337)) choices=htemp_choices,style=wx.CB_DROPDOWN, size=(90,25),pos=(45,337))
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=(38,-1),pos=(135,335)) self.settbtn=wx.Button(self.panel,-1,_("Set"),size=(38,-1),pos=(135,335))
self.settbtn.Bind(wx.EVT_BUTTON,self.do_settemp) self.settbtn.Bind(wx.EVT_BUTTON,self.do_settemp)
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])] btemp_choices=[self.bedtemps[i]+" ("+i+")" for i in sorted(self.bedtemps.keys(),key=lambda x:self.temps[x])]
if self.settings.last_bed_temperature not in map(float,self.bedtemps.values()): if self.settings.last_bed_temperature not in map(float,self.bedtemps.values()):
btemp_choices = [str(self.settings.last_bed_temperature)] + btemp_choices 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=btemp_choices,style=wx.CB_DROPDOWN, size=(90,25),pos=(45,367)) choices=btemp_choices,style=wx.CB_DROPDOWN, size=(90,25),pos=(45,367))
self.btemp.SetValue("0") self.btemp.SetValue(str(self.settings.last_bed_temperature))
self.htemp.SetValue(str(self.settings.last_temperature))
## added for an error where only the bed would get (pla) or (abs).
#This ensures, if last temp is a default pla or abs, it will be marked so.
# if it is not, then a (user) remark is added. This denotes a manual entry
for i in btemp_choices:
if i.split()[0] == str(self.settings.last_bed_temperature).split('.')[0] or i.split()[0] == str(self.settings.last_bed_temperature):
self.btemp.SetValue(i)
for i in htemp_choices:
if i.split()[0] == str(self.settings.last_temperature).split('.')[0] or i.split()[0] == str(self.settings.last_temperature) :
self.htemp.SetValue(i)
if( '(' not in self.btemp.Value):
self.btemp.SetValue(self.btemp.Value + ' (user)')
if( '(' not in self.htemp.Value):
self.htemp.SetValue(self.htemp.Value + ' (user)')
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=(38,-1),pos=(135,365)) self.setbbtn=wx.Button(self.panel,-1,_("Set"),size=(38,-1),pos=(135,365))
self.setbbtn.Bind(wx.EVT_BUTTON,self.do_bedtemp) self.setbbtn.Bind(wx.EVT_BUTTON,self.do_bedtemp)
...@@ -1100,6 +1126,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1100,6 +1126,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
pass pass
def pause(self,event): def pause(self,event):
print _("Paused.")
if not self.paused: if not self.paused:
if self.sdprinting: if self.sdprinting:
self.p.send_now("M25") self.p.send_now("M25")
...@@ -1125,6 +1152,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1125,6 +1152,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
pass pass
def connect(self,event): def connect(self,event):
print _("Connecting...")
port=None port=None
try: try:
port=self.scanserial()[0] port=self.scanserial()[0]
...@@ -1155,6 +1183,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1155,6 +1183,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def disconnect(self,event): def disconnect(self,event):
print _("Disconnected.")
self.p.disconnect() self.p.disconnect()
self.statuscheck=False self.statuscheck=False
...@@ -1175,6 +1204,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1175,6 +1204,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def reset(self,event): def reset(self,event):
print _("Reset.")
dlg=wx.MessageDialog(self, _("Are you sure you want to reset the printer?"), _("Reset?"), wx.YES|wx.NO) dlg=wx.MessageDialog(self, _("Are you sure you want to reset the printer?"), _("Reset?"), wx.YES|wx.NO)
if dlg.ShowModal()==wx.ID_YES: if dlg.ShowModal()==wx.ID_YES:
self.p.reset() self.p.reset()
...@@ -1231,6 +1261,8 @@ class macroed(wx.Dialog): ...@@ -1231,6 +1261,8 @@ class macroed(wx.Dialog):
def unindent(self,text): def unindent(self,text):
import re import re
self.indent_chars = text[:len(text)-len(text.lstrip())] self.indent_chars = text[:len(text)-len(text.lstrip())]
if len(self.indent_chars)==0:
self.indent_chars=" "
unindented = "" unindented = ""
lines = re.split(r"(?:\r\n?|\n)",text) lines = re.split(r"(?:\r\n?|\n)",text)
#print lines #print lines
...@@ -1249,6 +1281,7 @@ class macroed(wx.Dialog): ...@@ -1249,6 +1281,7 @@ class macroed(wx.Dialog):
return text return text
reindented = "" reindented = ""
for line in lines: for line in lines:
if line.strip() != "":
reindented += self.indent_chars + line + "\n" reindented += self.indent_chars + line + "\n"
return reindented return reindented
......
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