From df2e25d660117599e309a40b513a8109f8c15b4e Mon Sep 17 00:00:00 2001 From: Al Date: Fri, 10 Jul 2015 15:46:09 +0100 Subject: [PATCH] Enable editing of GPS serial port --- src/cli.py | 3 ++- src/dialogs_devices.py | 16 ++++++++-------- src/location.py | 1 + src/version-timestamp | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/cli.py b/src/cli.py index debbf6e..2366bea 100644 --- a/src/cli.py +++ b/src/cli.py @@ -167,7 +167,7 @@ def __init__(self, pool, args): print "Done" def __gps_wait(self): - print '\nWaiting for GPS: {}'.format(self.settings.devicesGps[0].get_serial_desc()) + print '\nWaiting for GPS fix: {}'.format(self.settings.devicesGps[0].get_serial_desc()) while True: if not self.queueLocation.empty(): @@ -241,6 +241,7 @@ def __process_event(self, queue, pool): arg2[2]) elif status == Event.LOC_ERR: print '{}'.format(arg2) + exit(1) return status diff --git a/src/dialogs_devices.py b/src/dialogs_devices.py index 575f91b..cb58e55 100644 --- a/src/dialogs_devices.py +++ b/src/dialogs_devices.py @@ -494,16 +494,16 @@ def __select_row(self, index): class DialogGPSSerial(wx.Dialog): def __init__(self, parent, device): self.device = device - self.ports = get_serial_ports() + ports = get_serial_ports() + ports.append(device.resource) + self.ports = list(set(ports)) wx.Dialog.__init__(self, parent=parent, title='Serial port settings') textPort = wx.StaticText(self, label='Port') - self.choicePort = wx.Choice(self, choices=self.ports) - sel = 0 - if device.resource in self.ports: - sel = self.ports.index(device.resource) - self.choicePort.SetSelection(sel) + self.comboPort = wx.ComboBox(self, choices=self.ports, + style=wx.TE_PROCESS_ENTER) + self.comboPort.SetSelection(self.ports.index(device.resource)) textBaud = wx.StaticText(self, label='Baud rate') self.choiceBaud = wx.Choice(self, @@ -534,7 +534,7 @@ def __init__(self, parent, device): grid = wx.GridBagSizer(10, 10) grid.Add(textPort, pos=(0, 0), flag=wx.ALL) - grid.Add(self.choicePort, pos=(0, 1), flag=wx.ALL) + grid.Add(self.comboPort, pos=(0, 1), flag=wx.ALL) grid.Add(textBaud, pos=(1, 0), flag=wx.ALL) grid.Add(self.choiceBaud, pos=(1, 1), flag=wx.ALL) grid.Add(textByte, pos=(2, 0), flag=wx.ALL) @@ -553,7 +553,7 @@ def __init__(self, parent, device): self.SetSizerAndFit(box) def __on_ok(self, _event): - self.device.resource = self.ports[self.choicePort.GetSelection()] + self.device.resource = self.comboPort.GetValue() self.device.baud = self.device.get_bauds()[self.choiceBaud.GetSelection()] self.device.bytes = DeviceGPS.BYTES[self.choiceBytes.GetSelection()] self.device.parity = DeviceGPS.PARITIES[self.choiceParity.GetSelection()] diff --git a/src/location.py b/src/location.py index d02390e..a196970 100644 --- a/src/location.py +++ b/src/location.py @@ -332,6 +332,7 @@ def __post_location(self, lat, lon, alt): def run(self): if self._device.type in [DeviceGPS.NMEA_SERIAL, DeviceGPS.NMEA_TCP]: if not self.__nmea_open(): + self.__nmea_close() return else: if not self.__gpsd_open(): diff --git a/src/version-timestamp b/src/version-timestamp index 4219a0a..cff96f6 100644 --- a/src/version-timestamp +++ b/src/version-timestamp @@ -1 +1 @@ -1436448401 \ No newline at end of file +1436540466 \ No newline at end of file