Add a set_port method to ConnectDialog and use that instead of accessing the port_edit widget directly.

This commit is contained in:
Gerrit Vermeulen 2013-12-11 09:20:24 +02:00
parent 99e00ab612
commit ec3009950b
2 changed files with 4 additions and 1 deletions

View File

@ -209,6 +209,9 @@ class ConnectDialog(QtGui.QDialog, UiConnectDialog):
def get_hardware_handshake(self): def get_hardware_handshake(self):
return self.hardware_checkbox.isChecked() return self.hardware_checkbox.isChecked()
def set_port(self, port):
self.port_edit.setEditText(port)
def update_port_combobox(self): def update_port_combobox(self):
self.port_edit.clear() self.port_edit.clear()
ports = [] ports = []

View File

@ -202,7 +202,7 @@ class MainWindow(QtGui.QMainWindow, UiMainWindow):
def on_open_action_triggered(self): def on_open_action_triggered(self):
self.connect_dialog.update_port_combobox() self.connect_dialog.update_port_combobox()
settings = QtCore.QSettings() settings = QtCore.QSettings()
self.connect_dialog.port_edit.setEditText(unicode(settings.value(u'previous-port', u'').toString())) self.connect_dialog.set_port(unicode(settings.value(u'previous-port', u'').toString()))
if self.connect_dialog.exec_() == QtGui.QDialog.Accepted: if self.connect_dialog.exec_() == QtGui.QDialog.Accepted:
if not self.device_closed: if not self.device_closed:
self.device_closed = True self.device_closed = True