Commit 347124df authored by kliment's avatar kliment

Safer string handling.

parent 756fa55f
...@@ -858,5 +858,5 @@ if __name__=="__main__": ...@@ -858,5 +858,5 @@ if __name__=="__main__":
interp.cmdloop() interp.cmdloop()
except: except:
interp.p.disconnect() interp.p.disconnect()
raise #raise
...@@ -118,7 +118,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -118,7 +118,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def do_settemp(self,l=""): def do_settemp(self,l=""):
try: try:
if not (l.__class__=="".__class__ or l.__class__==u"".__class__) or (not len(l)): if not (l.__class__=="".__class__ or l.__class__==u"".__class__) or (not len(l)):
l=self.htemp.GetValue().split()[0] l=str(self.htemp.GetValue().split()[0])
l=l.lower().replace(",",".") l=l.lower().replace(",",".")
for i in self.temps.keys(): for i in self.temps.keys():
l=l.replace(i,self.temps[i]) l=l.replace(i,self.temps[i])
...@@ -138,7 +138,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -138,7 +138,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def do_bedtemp(self,l=""): def do_bedtemp(self,l=""):
try: try:
if not (l.__class__=="".__class__ or l.__class__==u"".__class__) or (not len(l)): if not (l.__class__=="".__class__ or l.__class__==u"".__class__) or (not len(l)):
l=self.btemp.GetValue().split()[0] l=str(self.btemp.GetValue().split()[0])
l=l.lower().replace(",",".") l=l.lower().replace(",",".")
for i in self.bedtemps.keys(): for i in self.bedtemps.keys():
l=l.replace(i,self.bedtemps[i]) l=l.replace(i,self.bedtemps[i])
...@@ -323,7 +323,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -323,7 +323,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if not len(command): if not len(command):
return return
wx.CallAfter(self.logbox.AppendText,">>>"+command+"\n") wx.CallAfter(self.logbox.AppendText,">>>"+command+"\n")
self.onecmd(command) self.onecmd(str(command))
def statuschecker(self): def statuschecker(self):
try: try:
...@@ -543,7 +543,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -543,7 +543,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
return return
dlg=wx.TextEntryDialog(self,"Enter a target filename in 8.3 format:","Pick SD filename",dosify(self.filename)) dlg=wx.TextEntryDialog(self,"Enter a target filename in 8.3 format:","Pick SD filename",dosify(self.filename))
if dlg.ShowModal()==wx.ID_OK: if dlg.ShowModal()==wx.ID_OK:
self.p.send_now("M28 "+dlg.GetValue()) self.p.send_now("M28 "+str(dlg.GetValue()))
self.recvlisteners+=[self.uploadtrigger] self.recvlisteners+=[self.uploadtrigger]
pass pass
...@@ -578,7 +578,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -578,7 +578,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except: except:
pass pass
if self.serialport.GetValue()!="": if self.serialport.GetValue()!="":
port=self.serialport.GetValue() port=str(self.serialport.GetValue())
baud=115200 baud=115200
try: try:
baud=int(self.baud.GetValue()) baud=int(self.baud.GetValue())
......
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