Commit e9e721bd authored by Keegi's avatar Keegi

Merge remote branch 'kliment/master' into experimental

parents 28061201 6af04ed6
...@@ -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)
...@@ -1319,6 +1323,8 @@ class macroed(wx.Dialog): ...@@ -1319,6 +1323,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
...@@ -1337,6 +1343,7 @@ class macroed(wx.Dialog): ...@@ -1337,6 +1343,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