def connectionExtended(self): logging.info("connectionExtended") dialogPassword = dialogpassword.dialogPasswordUI(self.configfile) dialogPassword.exec_() result = dialogPassword.getResult() if result is True: password = dialogPassword.getPassword() values = common.readSystem() if "adminPassword" in values: inputpassword = common.convertPassword(password) if values["adminPassword"] == inputpassword: common.enableTabs(self, True) else: common.messageDialog("connectExtendedPasswordError") else: common.enableTabs(self, True)
def ButtonOK(self): logging.info("ButtonOK") error = False if self.xdmcpInputName.text() == "": common.messageDialog("configDialogErrorName") error = True elif self.xdmcpInputAddress.text() == "": common.messageDialog("configDialogErrorAddress") error = True elif self.xdmcpInputIcon.isChecked() and self.xdcmpInputIconName.text() == "": common.messageDialog("configDialogErrorIconName") error = True name = self.xdmcpInputName.text() if common.existingConnection(name): common.messageDialog("configDialogErrorAddress") error = True if error == False: values = {} values["typ"] = "xdmcp" values["name"] = self.xdmcpInputName.text() values["address"] = self.xdmcpInputAddress.text() values["port"] = self.xdmcpInputPort.text() values["resolution"] = self.xdmcpInputResolution.currentText() values["parameter"] = self.xdmcpInputParameter.text() if self.xdmcpInputAutostart.isChecked(): values["autostart"] = "yes" else: values["autostart"] = "no" if self.xdmcpInputRepeat.isChecked(): values["repeat"] = "yes" else: values["repeat"] = "no" values["alternative"] = str(self.xdmcpInputAlternative.currentText()) if self.xdmcpInputIcon.isChecked(): values["icon"] = "yes" else: values["icon"] = "no" values["iconname"] = str(self.xdmcpInputIconName.text()) # delete old connectio if self.connectionname != "": common.deleteConnection(self.connectionname) common.deletePasswordFile(self.connectionname) # delete new connection common.deleteConnection(self.xdmcpInputName.text()) common.deletePasswordFile(self.xdmcpInputName.text()) # make new connection parameter = self.parameterxdmcp(self.xdmcpInputName.text(), values) common.newConnection(values, parameter, self.xdmcpInputName.text()) self.close()
def ButtonOK(self): logging.info("ButtonOK") error = False if self.x2goInputName.text() == "": common.messageDialog("configDialogErrorName") error = True elif self.x2goInputAddress.text() == "": common.messageDialog("configDialogErrorAddress") error = True name = self.x2goInputName.text() if common.existingConnection(name): common.messageDialog("configDialogErrorAddress") error = True if error == False: values = {} values["typ"] = "x2go" values["name"] = self.x2goInputName.text() values["address"] = self.x2goInputAddress.text() values["user"] = self.x2goInputUser.text() values["password"] = self.x2goInputPassword.text() values["parameter"] = self.x2goInputParameter.text() values["resolution"] = self.x2goInputResolution.currentText() values["keyboard"] = self.x2goInputKeyboard.currentText() values["desktop"] = self.x2goInputDesktop.currentText() if self.x2goInputAutostart.isChecked(): values["autostart"] = "yes" else: values["autostart"] = "no" if self.x2goInputRepeat.isChecked(): values["repeat"] = "yes" else: values["repeat"] = "no" if self.x2goInputSystemLogin.isChecked(): values["systemlogin"] = "******" else: values["systemlogin"] = "******" values["alternative"] = str(self.x2goInputAlternative.currentText()) # delete old connection if self.connectionname != "": common.deleteConnection(self.connectionname) common.deletePasswordFile(self.connectionname) # delete new connection common.deleteConnection(self.x2goInputName.text()) common.deletePasswordFile(self.x2goInputName.text()) # make new connection parameter = self.parameterx2go(self.x2goInputName.text(), values) common.newConnection(values, parameter, self.x2goInputName.text()) self.close()
def ButtonOK(self): logging.info("ButtonOK") error = False if self.rdesktopInputName.text() == "": common.messageDialog("configDialogErrorName") error = True elif " " in self.rdesktopInputName.text(): common.messageDialog("configDialogErrorCharacter") error = True elif "[" in self.rdesktopInputName.text(): common.messageDialog("configDialogErrorCharacter") error = True elif "]" in self.rdesktopInputName.text(): common.messageDialog("configDialogErrorCharacter") error = True elif self.rdesktopInputAddress.text() == "": common.messageDialog("configDialogErrorAddress") error = True elif common.isNetworkAddress( self.rdesktopInputAddress.text()) is False: error = True name = self.rdesktopInputName.text() if common.existingConnection(name): common.messageDialog("configDialogErrorAddress") error = True if error is False: values = {} values["typ"] = "rdesktop" values["address"] = self.rdesktopInputAddress.text() values["resolution"] = self.rdesktopInputResolution.currentText() values["color"] = self.rdesktopInputColor.currentText() values["parameter"] = self.rdesktopInputParameter.text() if self.rdesktopInputAutostart.isChecked(): values["autostart"] = "yes" else: values["autostart"] = "no" if self.rdesktopInputRepeat.isChecked(): values["repeat"] = "yes" else: values["repeat"] = "no" if self.rdesktopInputSystemLogin.isChecked(): values["systemlogin"] = "******" else: values["systemlogin"] = "******" values["alternative"] = str( self.rdesktopInputAlternative.currentText()) # delete old connection if self.connectionname != "": common.deleteConnection(self.connectionname) # delete new connection common.deleteConnection(self.rdesktopInputName.text()) # make new connection parameter = self.parameterRdesktop(self.rdesktopInputName.text(), values) common.newConnection(values, parameter, self.rdesktopInputName.text()) self.close()
def ButtonOK(self): logging.info("ButtonOK") error = False if self.vncInputName.text() == "": common.messageDialog("configDialogErrorName") error = True elif " " in self.vncInputName.text(): common.messageDialog("configDialogErrorCharacter") error = True elif "[" in self.vncInputName.text(): common.messageDialog("configDialogErrorCharacter") error = True elif "]" in self.vncInputName.text(): common.messageDialog("configDialogErrorCharacter") error = True elif self.vncInputAddress.text() == "": common.messageDialog("configDialogErrorAddress") error = True elif self.vncInputPort.text() == "": common.messageDialog("configDialogErrorPort") error = True elif common.isNetworkAddress(self.vncInputAddress.text()) == False: error = True name = self.vncInputName.text() if common.existingConnection(name): common.messageDialog("configDialogErrorAddress") error = True if error == False: values = {} values["typ"] = "vnc" values["address"] = self.vncInputAddress.text() values["port"] = self.vncInputPort.text() values["password"] = self.vncInputPassword.text() values["resolution"] = self.vncInputResolution.currentText() values["color"] = self.vncInputColor.currentText() values["parameter"] = self.vncInputParameter.text() if self.vncInputAutostart.isChecked(): values["autostart"] = "yes" else: values["autostart"] = "no" if self.vncInputRepeat.isChecked(): values["repeat"] = "yes" else: values["repeat"] = "no" values["alternative"] = str(self.vncInputAlternative.currentText()) # delete old connection if self.connectionname != "": common.deleteConnection(self.connectionname) common.deletePasswordFile(self.connectionname) # delete new connection common.deleteConnection(self.vncInputName.text()) common.deletePasswordFile(self.vncInputName.text()) # make new connection parameter = self.parameterVNC(self.vncInputName.text(), values) common.newConnection(values, parameter, self.vncInputName.text()) password = self.vncInputPassword.text() if password != "": self.newPasswordFile(self.vncInputName.text(), password) self.close()
def systemAssume(self): logging.info("systemAssume") values = {} password = self.systemInputPassword.text() passwordrepeat = self.systemInputPasswordRepeat.text() if password != "" or passwordrepeat != "": if password == passwordrepeat: values["adminPassword"] = common.convertPassword(password) else: common.messageDialog("systemPasswordComparisonError") return if self.systemInputStartAdmin.isChecked(): values["startAdmin"] = "yes" else: values["startAdmin"] = "no" if self.systemInputRemoteVNC.isChecked(): password = self.systemInputRemotePassword.text() passwordrepeat = self.systemInputRemotePasswordRepeat.text() if password == "" or passwordrepeat == "": common.messageDialog("systemRemotePasswordError") return if password == passwordrepeat: common.remoteVNC(True, self) else: common.messageDialog("systemPasswordComparisonError") return else: common.remoteVNC(False, self) if self.systemInputSSH.isChecked(): common.remoteSSH(True) else: common.remoteSSH(False) values["language"] = self.systemInputLanguage.currentText() values["keyboardLayout"] = self.systemInputKeyboardLayout.currentText() common.writeSystem(values) common.writeKeyboardLayout(values["keyboardLayout"]) # reboot system result = common.confirmDialog( self, common.getRessource("systemShutdownTitle"), common.getRessource("systemAssumeMessage")) common.deleteConfigScript() if self.systemInputScreensaver.isChecked(): common.setScreensaver("on") else: common.setScreensaver("off") if self.systemInputMonitorStandby.isChecked(): common.setMonitorStandby("on") else: common.setMonitorStandby("off") if result: common.deleteConfigScript() if self.systemInputScreensaver.isChecked(): common.setScreensaver("on") else: common.setScreensaver("off") if self.systemInputMonitorStandby.isChecked(): common.setMonitorStandby("on") else: common.setMonitorStandby("off") common.setResolution(self.systemInputResolution.text()) if self.systemInputUSBAutomount.isChecked(): common.setUSBAutomount("on") else: common.setUSBAutomount("off") common.setResolution(self.systemInputResolution.text()) if self.systemInputOneninedesign.isChecked(): common.setOneninedesign("on") else: common.setOneninedesign("off") if self.systemInputArgon1.isChecked(): common.setArgon1("on") else: common.setArgon1("off") common.runProgram(common.getRessource("commandReboot"))
def save(self): logging.info("save and restart") values = {} # check password if self.systemInputStartAdmin.isChecked() == False: password = self.systemInputPassword.text() values["adminPassword"] = password passwordrepeat = self.systemInputPasswordRepeat.text() if password == "": common.messageDialog("systemRemotePasswordError") return if self.PasswordChanged: if password == passwordrepeat: values["adminPassword"] = common.convertPassword(password) else: common.messageDialog("systemPasswordComparisonError") return # check remote vnc password if self.systemInputRemoteVNC.isChecked( ) and self.RemotePasswordChanged: vncpassword = self.systemInputRemotePassword.text() passwordrepeat = self.systemInputRemotePasswordRepeat.text() if vncpassword == "": common.messageDialog("systemRemotePasswordError") return if vncpassword != passwordrepeat: common.messageDialog("systemPasswordComparisonError") return # check ssh password if self.systemInputSSH.isChecked() and self.sshPasswordChanged: sshpassword = self.systemInputsshPassword.text() passwordrepeat = self.systemInputsshPasswordRepeat.text() if sshpassword == "": common.messageDialog("systemsshPasswordError") return if sshpassword != passwordrepeat: common.messageDialog("systemPasswordComparisonError") return # action time is string, convert to datetime or hour:minute value = self.timeInputActionTime.text() if value != "": # hour:minute if value.startswith("+"): value = value.replace("+", "") try: time = datetime.strptime(value, "%H:%M") except ValueError as error: common.messageDialog("timeActionError") return else: try: time = datetime.strptime(value, "%Y-%m-%d %H:%M") except ValueError as error: common.messageDialog("timeActionError") return # network if self.networkInputSave.isChecked() == False: networkvalues = {} networkvalues[ "connection"] = self.networkInputInterface.currentText() networkvalues["address"] = self.networkInputAddress.text() networkvalues["subnetmask"] = self.networkInputSubnetmask.text() networkvalues["gateway"] = self.networkInputGateway.text() networkvalues["dns"] = self.networkInputDNS.text() networkvalues["ssid"] = self.networkInputWlanSSID.currentText() networkvalues["password"] = self.networkInputWlanPassword.text() if self.networkInputDHCP.isChecked(): common.networkWriteDHCP(networkvalues) else: result = common.networkWriteStaticIP(networkvalues) if not result: return # vpn vpn.vpnTransfer(self) # system if self.systemInputStartAdmin.isChecked(): values["startAdmin"] = "yes" else: values["startAdmin"] = "no" if self.systemInputRemoteVNC.isChecked(): if self.RemotePasswordChanged: common.remoteVNC(True, vncpassword) else: common.remoteVNC(False, None) if self.systemInputSSH.isChecked(): if self.sshPasswordChanged: common.remoteSSH(True, self.systemInputsshPassword.text()) else: common.remoteSSH(False, None) values["resolution"] = self.systemInputResolution.currentText() values["resolution2"] = self.systemInputResolution2.currentText() orientation = "left" if self.systemInputMultiMonitorLeft.isChecked(): orientation = "left" if self.systemInputMultiMonitorRight.isChecked(): orientation = "right" if self.systemInputMultiMonitorAbove.isChecked(): orientation = "above" if self.systemInputMultiMonitorBelow.isChecked(): orientation = "below" common.setMultiMonitor(True, orientation) values["language"] = self.systemInputLanguage.currentText() values["keyboardLayout"] = self.systemInputKeyboardLayout.currentText() values["startMinimized"] = "no" if self.systemInputMinimize.isChecked(): values["startMinimized"] = "yes" values["networkSave"] = "yes" if self.networkInputSave.isChecked(): values["networkSave"] = "no" # write system file common.writeSystem(values) common.writeKeyboardLayout(values["keyboardLayout"]) # write system file common.deleteConfigScript() if self.systemInputScreensaver.isChecked(): common.setScreensaver("on") else: common.setScreensaver("off") if self.systemInputMonitorStandby.isChecked(): common.setMonitorStandby("on") else: common.setMonitorStandby("off") common.deleteConfigScript() if self.systemInputScreensaver.isChecked(): common.setScreensaver("on") else: common.setScreensaver("off") if self.systemInputMonitorStandby.isChecked(): common.setMonitorStandby("on") else: common.setMonitorStandby("off") common.setResolution(self.systemInputResolution.currentText()) if self.systemInputUSBAutomount.isChecked(): common.setUSBAutomount("on") else: common.setUSBAutomount("off") if self.systemInputOneninedesign.isChecked(): common.setOneninedesign("on") else: common.setOneninedesign("off") if self.systemInputArgon1.isChecked(): common.setArgon1("on") else: common.setArgon1("off") common.setSoundCard(self.systemInputSound.currentText()) # write time values = {} values["save"] = "yes" if self.timeInputSave.isChecked(): values["save"] = "no" values["automatic"] = "no" if self.timeInputAuto.isChecked(): values["automatic"] = "yes" values["ntp"] = self.timeInputNTP.text() values["zone"] = self.timeInputTimezone.currentText() values["repeat"] = "no" if self.timeInputActionRepeat.isChecked(): values["repeat"] = "yes" values["time"] = self.timeInputTime.text() values["execute"] = "no" if self.timeInputAction.isChecked(): values["execute"] = "yes" values["action"] = self.timeInputActionAction.currentText() values["execat"] = self.timeInputActionTime.text() common.writeTime(values) # write time temp. file for save and reboot values = {} values["show"] = "no" if self.timeInputView.isChecked(): values["show"] = "yes" common.writeTimeTemp(values) # reboot system result = common.confirmDialog( self, common.getRessource("systemShutdownTitle"), common.getRessource("systemAssumeMessage")) if result: command = common.getRessource("commandReboot") common.runProgram(command)
def connectionExec(self, values): # logging configfile = common.ressourcefile loggingfilename = common.getRessourceByName(configfile, "loggingFileRun") debugfile = common.getRessourceByName(configfile, "debugSwitch") debug = False if os.path.isfile(debugfile): debug = True common.loggingStart(loggingfilename, debug) logging.info("connectionExec") run = 0 while run < 2: connectionname = values["name"] command = values["command"] systemlogin = values["systemlogin"] logging.info("connectionExec " + connectionname) result = True if systemlogin == "yes": common.runProgram(common.getRessource("commandWMDesktop")) logging.info("loginDialog") dialogLogin = dialoglogin.dialogLoginUI( configfile, connectionname) dialogLogin.exec_() result = dialogLogin.getResult() if result is True: # replace parameter <user> and <password> in command string command = command.replace( common.getRessource("commandPlaceholderUser"), dialogLogin.getLogin()) command = command.replace( common.getRessource("commandPlaceholderPassword"), dialogLogin.getPassword()) if result: result = common.isHostAlive(values["address"]) if result: break else: if "alternative" in values: if values["alternative"] != "": alternative = values["alternative"] values = [] values = common.readConnection(alternative) if not "name" in values: break else: break else: break run = run + 1 if result: # connect to Desktop 1 commandwm = common.getRessource("commandWMDesktop") command = commandwm + " " + command logging.info(command) # run connection as thread self.runconnect = connectThread.connectThread( command, connectionname) self.runconnect.threadCancel.connect(self.connectThreadCancel) self.runconnect.start() else: common.messageDialog("runNoConnection") self.close()