Commit 4a5e13f2 authored by Kliment Yanev's avatar Kliment Yanev

Catch errors when appending text to logbox

parent e73e11d5
...@@ -390,9 +390,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -390,9 +390,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.capture_skip[pat] -= 1 self.capture_skip[pat] -= 1
self.capture_skip_newline = True self.capture_skip_newline = True
return return
wx.CallAfter(self.logbox.AppendText,l) wx.CallAfter(self.addtexttolog,l);
if webavail:
self.webInterface.AppendLog(l)
def scanserial(self): def scanserial(self):
"""scan for available ports. return a list of device names.""" """scan for available ports. return a list of device names."""
...@@ -1304,15 +1302,21 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1304,15 +1302,21 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
else: else:
wx.CallAfter(self.graph.StopPlotting) wx.CallAfter(self.graph.StopPlotting)
def addtexttolog(self,text):
try:
self.logbox.AppendText(text)
except:
print "attempted to write invalid text to console"
pass
if webavail:
self.webInterface.AppendLog(text)
def sendline(self,e): def sendline(self,e):
command=self.commandbox.GetValue() command=self.commandbox.GetValue()
if not len(command): if not len(command):
return return
wx.CallAfter(self.logbox.AppendText,">>>"+command+"\n") wx.CallAfter(self.addtexttolog,">>>"+command+"\n");
if webavail:
self.webInterface.AppendLog(">>>"+command+"\n")
self.onecmd(str(command)) self.onecmd(str(command))
self.commandbox.SetSelection(0,len(command)) self.commandbox.SetSelection(0,len(command))
self.commandbox.history+=[command] self.commandbox.history+=[command]
...@@ -1408,7 +1412,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1408,7 +1412,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if (tstring!="ok") and (tstring!="wait") and ("ok T:" not in tstring): if (tstring!="ok") and (tstring!="wait") and ("ok T:" not in tstring):
# print "*"+tstring+"*" # print "*"+tstring+"*"
# print "[" + time.strftime('%H:%M:%S',time.localtime(time.time())) + "] " + tstring # print "[" + time.strftime('%H:%M:%S',time.localtime(time.time())) + "] " + tstring
wx.CallAfter(self.logbox.AppendText,tstring+"\n") wx.CallAfter(self.addtexttolog,tstring+"\n");
for i in self.recvlisteners: for i in self.recvlisteners:
i(l) i(l)
......
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