def __init__(self, parent, package, deviceID, deviceName): QtGui.QDialog.__init__(self, parent) self.ui = Ui_NMWizard() self.ui.setupUi(self) self.isAvailable = False self.iface = parent.iface self.package = package self.device = deviceID self.pin = "" self.ui.txtDevice.setText(deviceName) self.ui.txtIMEI.setText(deviceID.split(":")[-1]) # Create PIN Dialog self.pinDialog = PINDialog(self, deviceName) # Signals & Slots self.connect(self.ui.buttonBox, SIGNAL("accepted()"), self.applyChanges) self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.reject) self.connect(self.ui.lineEditPIN, SIGNAL("editingFinished()"), self.savePIN) # Ask for pin and scan if OK self.isAvailable = self.askForPIN()
class ConnectionWizard(QtGui.QDialog): def __init__(self, parent, package, deviceID, deviceName): QtGui.QDialog.__init__(self, parent) self.ui = Ui_NMWizard() self.ui.setupUi(self) self.isAvailable = False self.iface = parent.iface self.package = package self.device = deviceID self.pin = "" self.ui.txtDevice.setText(deviceName) self.ui.txtIMEI.setText(deviceID.split(":")[-1]) # Create PIN Dialog self.pinDialog = PINDialog(self, deviceName) # Signals & Slots self.connect(self.ui.buttonBox, SIGNAL("accepted()"), self.applyChanges) self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.reject) self.connect(self.ui.lineEditPIN, SIGNAL("editingFinished()"), self.savePIN) # Ask for pin and scan if OK self.isAvailable = self.askForPIN() def savePIN(self): self.pin = str(self.ui.lineEditPIN.text()) def applyChanges(self): def collectDataFromUI(): data = {} data["device_id"] = self.device data["name"] = self.connectionName data["auth"] = "pin" if self.pin and self.ui.checkBoxRemember.isChecked(): data["auth_pin"] = self.pin return data self.connectionName = str( self.ui.comboBoxOperators.itemData( self.ui.comboBoxOperators.currentIndex()).toString()) try: self.iface.updateConnection(self.package, self.connectionName, collectDataFromUI()) self.accept() except Exception, e: KMessageBox.error(self, unicode(e)) return
class ConnectionWizard(QtGui.QDialog): def __init__(self, parent, package, deviceID, deviceName): QtGui.QDialog.__init__(self, parent) self.ui = Ui_NMWizard() self.ui.setupUi(self) self.isAvailable = False self.iface = parent.iface self.package = package self.device = deviceID self.pin = "" self.ui.txtDevice.setText(deviceName) self.ui.txtIMEI.setText(deviceID.split(":")[-1]) # Create PIN Dialog self.pinDialog = PINDialog(self, deviceName) # Signals & Slots self.connect(self.ui.buttonBox, SIGNAL("accepted()"), self.applyChanges) self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.reject) self.connect(self.ui.lineEditPIN, SIGNAL("editingFinished()"), self.savePIN) # Ask for pin and scan if OK self.isAvailable = self.askForPIN() def savePIN(self): self.pin = str(self.ui.lineEditPIN.text()) def applyChanges(self): def collectDataFromUI(): data = {} data["device_id"] = self.device data["name"] = self.connectionName data["auth"] = "pin" if self.pin and self.ui.checkBoxRemember.isChecked(): data["auth_pin"] = self.pin return data self.connectionName = str(self.ui.comboBoxOperators.itemData(self.ui.comboBoxOperators.currentIndex()).toString()) try: self.iface.updateConnection(self.package, self.connectionName, collectDataFromUI()) self.accept() except Exception, e: KMessageBox.error(self, unicode(e)) return