Some adjustments for Windows
This commit is contained in:
parent
7390b48664
commit
f668d68a6b
@ -238,9 +238,17 @@ class MainWindow(QtGui.QMainWindow, UiMainWindow):
|
|||||||
self.device_closed = True
|
self.device_closed = True
|
||||||
self.device.close()
|
self.device.close()
|
||||||
try:
|
try:
|
||||||
settings.setValue(u'previous-port', self.connect_dialog.get_port())
|
port = self.connect_dialog.get_port()
|
||||||
|
settings.setValue(u'previous-port', port)
|
||||||
|
if isinstance(port, basestring) and port.startswith('COM'):
|
||||||
|
try:
|
||||||
|
# On Windows ports are 0-based, so strip the COM and subtract 1 from the port number
|
||||||
|
port = int(port[3:]) - 1
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
QtGui.QMessageBox.critical(self, 'Error opening port', 'Error: Port is not valid')
|
||||||
|
return
|
||||||
self.device = Serial(
|
self.device = Serial(
|
||||||
port=self.connect_dialog.get_port(),
|
port=port,
|
||||||
baudrate=self.connect_dialog.get_baud(),
|
baudrate=self.connect_dialog.get_baud(),
|
||||||
bytesize=self.connect_dialog.get_data_bits(),
|
bytesize=self.connect_dialog.get_data_bits(),
|
||||||
parity=self.connect_dialog.get_parity(),
|
parity=self.connect_dialog.get_parity(),
|
||||||
|
Loading…
Reference in New Issue
Block a user