def on_connect_button_toggled(self, widget): if widget.get_active(): self.tnc = TncModel(self, self.device_path) self.tnc.connect() elif self.tnc is not None: # Possible race condition here... self.tnc.disconnect() self.tnc = None
def on_serial_port_combobox_changed(self, widget, data=None): text = widget.get_active_text() if text != None: self.tnc = TncModel(self, text)