def __init__(self, name, configfile): super(self.__class__, self).__init__() self.setupUi(self) self.connectionname = name # label common.setRessourceFile(configfile) self.setWindowTitle(common.getRessource("xdmcpDialogTitle")) self.xdmcpOKButton.setText(common.getRessource("ButtonOK")) self.xdmcpCancelButton.setText(common.getRessource("ButtonCancel")) self.xdmcpLabelName.setText(common.getRessource("configDialogLabelName")) self.xdmcpLabelAddress.setText(common.getRessource("configDialogLabelAddress")) self.xdmcpLabelPort.setText(common.getRessource("configDialogLabelPort")) self.xdmcpLabelResolution.setText(common.getRessource("configDialogLabelResolution")) self.xdmcpLabelParameter.setText(common.getRessource("configDialogLabelParameter")) self.xdmcpInputRepeat.setText(common.getRessource("configDialogLabelRepeat")) self.xdmcpLabelAlternative.setText(common.getRessource("configDialogLabelAlternative")) self.xdmcpInputIcon.setText(common.getRessource("configDialogLabelIcon")) self.xdmcpLabelIconName.setText(common.getRessource("configDialogLabelIconName")) # fill ComboBox common.fillComboBox(self, "xdmcpResolutions", self.xdmcpInputResolution) common.fillComboBoxConnections(self, self.xdmcpInputAlternative) # action self.xdmcpOKButton.clicked.connect(self.ButtonOK) self.xdmcpCancelButton.clicked.connect(self.ButtonCancel) if self.connectionname != "": # read connection parameter and fill dialog connection = common.readConnection(self.connectionname) self.xdmcpInputName.setText(self.connectionname) self.xdmcpInputAddress.setText(connection["address"]) self.xdmcpInputPort.setText(connection["port"]) self.xdmcpInputParameter.setText(connection["parameter"]) # Resolution index = self.xdmcpInputResolution.findText(connection["resolution"], QtCore.Qt.MatchFixedString) if index >= 0: self.xdmcpInputResolution.setCurrentIndex(index) autostart = connection["autostart"] # Autostart if autostart == "yes": self.xdmcpInputAutostart.setChecked(True) # Repeat repeat = connection["repeat"] if repeat == "yes": self.x2goInputRepeat.setChecked(True) # Alternative alternative = connection["alternative"] if alternative != "": index = self.xdmcpInputAlternative.findText(alternative, QtCore.Qt.MatchFixedString) self.xdmcpInputAlternative.setCurrentIndex(index) # Icon icon = "no" if "icon" in connection: icon = connection["icon"] if icon == "yes": self.xdmcpInputIcon.setChecked(True) iconname = "" if "iconname" in connection: iconname = connection["iconname"] self.xdmcpInputIconName.setText(iconname)
def autostart(self): logging.info("autostart") connections = common.readAllConnections() for index in range(len(connections)): name = connections[index] values = common.readConnection(name) if values["autostart"] == "yes": self.connectionExec(values)
def connection(self): logging.info("connection") item = self.connectList.currentItem() if item is not None: name = item.text() if not name in self.connectedThreads: values = common.readConnection(name) self.connectionExec(values) self.fillListWidgets()
def __init__(self, name, configfile): super(self.__class__, self).__init__() self.setupUi(self) self.connectionname = name # label common.setRessourceFile(configfile) self.setWindowTitle(common.getRessource("sshDialogTitle")) self.sshOKButton.setText(common.getRessource("ButtonOK")) self.sshCancelButton.setText(common.getRessource("ButtonCancel")) self.sshLabelName.setText(common.getRessource("configDialogLabelName")) self.sshLabelAddress.setText( common.getRessource("configDialogLabelAddress")) self.sshLabelPort.setText(common.getRessource("configDialogLabelPort")) self.sshLabelLogin.setText( common.getRessource("configDialogLabelLogin")) self.sshLabelApplication.setText( common.getRessource("configDialogLabelApplication")) self.sshLabelPassword.setText( common.getRessource("configDialogLabelPassword")) self.sshLabelParameter.setText( common.getRessource("configDialogLabelParameter")) self.sshInputRepeat.setText( common.getRessource("configDialogLabelRepeat")) self.sshLabelAlternative.setText( common.getRessource("configDialogLabelAlternative")) # action self.sshOKButton.clicked.connect(self.ButtonOK) self.sshCancelButton.clicked.connect(self.ButtonCancel) # fill comboBox common.fillComboBoxConnections(self, self.sshInputAlternative) if self.connectionname != "": # read connection parameter and fill dialog connection = common.readConnection(self.connectionname) self.sshInputName.setText(self.connectionname) self.sshInputAddress.setText(connection["address"]) self.sshInputPort.setText(connection["port"]) self.sshInputLogin.setText(connection["login"]) self.sshInputApplication.setText(connection["application"]) self.sshInputPassword.setText(connection["password"]) self.sshInputParameter.setText(connection["parameter"]) autostart = connection["autostart"] if autostart == "yes": self.sshInputAutostart.setChecked(True) # Repeat repeat = connection["repeat"] if repeat == "yes": self.sshInputRepeat.setChecked(True) # Alternative alternative = connection["alternative"] if alternative != "": index = self.sshInputAlternative.findText( alternative, QtCore.Qt.MatchFixedString) self.sshInputAlternative.setCurrentIndex(index)
def configEdit(self): logging.info("configEdit") item = self.configList.currentItem() if item is not None: name = item.text() connection = common.readConnection(name) if connection["typ"] == "vnc": viewer = common.getVNCViewer() if viewer == "tigervnc": dialogConnection = dialogtigervnc.dialogTigerVNCUI( name, self.configfile) if viewer == "tightvnc": dialogConnection = dialogtightvnc.dialogTightVNCUI( name, self.configfile) if viewer == "realvnc": dialogConnection = dialogrealvnc.dialogRealVNCUI( name, self.configfile) dialogConnection.exec_() if connection["typ"] == "ssh": dialogConnection = dialogssh.dialogsshUI(name, self.configfile) dialogConnection.exec_() if connection["typ"] == "xdmcp": dialogConnection = dialogxdmcp.dialogxdmcpUI( name, self.configfile) dialogConnection.exec_() if connection["typ"] == "x2go": dialogConnection = dialogx2go.dialogx2goUI( name, self.configfile) dialogConnection.exec_() if connection["typ"] == "rdp": dialogConnection = dialogrdp.dialogRDPUI(name, self.configfile) dialogConnection.exec_() if connection["typ"] == "rdesktop": dialogConnection = dialogrdesktop.dialogRDesktopUI( name, self.configfile) dialogConnection.exec_() self.fillListWidgets()
def __init__(self, name, configfile): super(self.__class__, self).__init__() self.setupUi(self) self.connectionname = name # label common.setRessourceFile(configfile) self.setWindowTitle(common.getRessource("rdesktopDialogTitle")) self.rdesktopOKButton.setText(common.getRessource("ButtonOK")) self.rdesktopCancelButton.setText(common.getRessource("ButtonCancel")) self.rdesktopLabelName.setText( common.getRessource("configDialogLabelName")) self.rdesktopLabelAddress.setText( common.getRessource("configDialogLabelAddress")) self.rdesktopLabelResolution.setText( common.getRessource("configDialogLabelResolution")) self.rdesktopLabelColor.setText( common.getRessource("configDialogLabelColor")) self.rdesktopLabelParameter.setText( common.getRessource("configDialogLabelParameter")) self.rdesktopInputAutostart.setText( common.getRessource("configDialogLabelAutostart")) self.rdesktopInputRepeat.setText( common.getRessource("configDialogLabelRepeat")) self.rdesktopInputSystemLogin.setText( common.getRessource("configDialogLabelSystemLogin")) self.rdesktopLabelAlternative.setText( common.getRessource("configDialogLabelAlternative")) #action self.rdesktopOKButton.clicked.connect(self.ButtonOK) self.rdesktopCancelButton.clicked.connect(self.ButtonCancel) # fill ComboBox common.fillComboBox(self, "rdesktopResolutions", self.rdesktopInputResolution) common.fillComboBox(self, "rdesktopColorLevel", self.rdesktopInputColor) common.fillComboBoxConnections(self, self.rdesktopInputAlternative) if self.connectionname != "": # read connection parameter and fill dialog connection = common.readConnection(self.connectionname) self.rdesktopInputName.setText(self.connectionname) self.rdesktopInputAddress.setText(connection["address"]) self.rdesktopInputParameter.setText(connection["parameter"]) # Resolution index = self.rdesktopInputResolution.findText( connection["resolution"], QtCore.Qt.MatchFixedString) if index >= 0: self.rdesktopInputResolution.setCurrentIndex(index) # Color index = self.rdesktopInputColor.findText( connection["color"], QtCore.Qt.MatchFixedString) if index >= 0: self.rdesktopInputColor.setCurrentIndex(index) # Autostart autostart = connection["autostart"] if autostart == "yes": self.rdesktopInputAutostart.setChecked(True) # Repeat repeat = connection["repeat"] if repeat == "yes": self.rdesktopInputRepeat.setChecked(True) # Own Login systemlogin = connection["systemlogin"] if systemlogin == "yes": self.rdesktopInputSystemLogin.setChecked(True) # Alternative alternative = connection["alternative"] if alternative != "": index = self.rdesktopInputAlternative.findText( alternative, QtCore.Qt.MatchFixedString) self.rdesktopInputAlternative.setCurrentIndex(index)
def __init__(self, name, configfile): super(self.__class__, self).__init__() self.setupUi(self) self.connectionname = name # label common.setRessourceFile(configfile) self.setWindowTitle(common.getRessource("x2goDialogTitle")) self.x2goOKButton.setText(common.getRessource("ButtonOK")) self.x2goCancelButton.setText(common.getRessource("ButtonCancel")) self.x2goLabelName.setText(common.getRessource("configDialogLabelName")) self.x2goLabelAddress.setText(common.getRessource("configDialogLabelAddress")) self.x2goLabelUser.setText(common.getRessource("configDialogLabelUser")) self.x2goLabelPassword.setText(common.getRessource("configDialogLabelPassword")) self.x2goLabelKeyboard.setText(common.getRessource("configDialogLabelKeyboard")) self.x2goLabelResolution.setText(common.getRessource("configDialogLabelResolution")) self.x2goLabelDesktop.setText(common.getRessource("configDialogLabelDesktop")) self.x2goLabelParameter.setText(common.getRessource("configDialogLabelParameter")) self.x2goInputRepeat.setText(common.getRessource("configDialogLabelRepeat")) self.x2goLabelAlternative.setText(common.getRessource("configDialogLabelAlternative")) self.x2goInputSystemLogin.setText(common.getRessource("configDialogLabelSystemLogin")) self.x2goInputIcon.setText(common.getRessource("configDialogLabelIcon")) self.x2goLabelIconName.setText(common.getRessource("configDialogLabelIconName")) # fill ComboBox common.fillComboBox(self, "x2goResolutions", self.x2goInputResolution) common.fillComboBox(self, "x2goKeyboardLayout", self.x2goInputKeyboard) common.fillComboBox(self, "x2goDesktop", self.x2goInputDesktop) common.fillComboBoxConnections(self, self.x2goInputAlternative) # action self.x2goOKButton.clicked.connect(self.ButtonOK) self.x2goCancelButton.clicked.connect(self.ButtonCancel) if self.connectionname != "": # read connection parameter and fill dialog connection = common.readConnection(self.connectionname) self.x2goInputName.setText(self.connectionname) self.x2goInputAddress.setText(connection["address"]) self.x2goInputUser.setText(connection["user"]) self.x2goInputPassword.setText(connection["password"]) self.x2goInputParameter.setText(connection["parameter"]) # Keyboard layout index = self.x2goInputKeyboard.findText(connection["keyboard"], QtCore.Qt.MatchFixedString) if index >= 0: self.x2goInputKeyboard.setCurrentIndex(index) # Resolution index = self.x2goInputResolution.findText(connection["resolution"], QtCore.Qt.MatchFixedString) if index >= 0: self.x2goInputResolution.setCurrentIndex(index) # Desktop index = self.x2goInputDesktop.findText(connection["desktop"], QtCore.Qt.MatchFixedString) if index >= 0: self.x2goInputDesktop.setCurrentIndex(index) # Own Login systemlogin = connection["systemlogin"] if systemlogin == "yes": self.x2goInputSystemLogin.setChecked(True) # Autostart autostart = connection["autostart"] if autostart == "yes": self.x2goInputAutostart.setChecked(True) # Repeat repeat = connection["repeat"] if repeat == "yes": self.x2goInputRepeat.setChecked(True) # Alternative alternative = connection["alternative"] if alternative != "": index = self.x2goInputAlternative.findText(alternative, QtCore.Qt.MatchFixedString) self.x2goInputAlternative.setCurrentIndex(index) # Icon icon = "no" if "icon" in connection: icon = connection["icon"] if icon == "yes": self.x2goInputIcon.setChecked(True) iconname = "" if "iconname" in connection: iconname = connection["iconname"] self.x2goInputIconName.setText(iconname)
def repeatConnection(self, name): result = common.isRepeat(name) logging.info(result) if result is True: values = common.readConnection(name) self.connectionExec(values)
def connectionExec(self, values): logging.info("connectionExec") repeat = True while repeat: 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( self.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 runconnect = connectThread.connectThread( command, connectionname) runconnect.threadCancel.connect(self.connectThreadCancel) #self.connect(runconnect, QtCore.SIGNAL( # "connectThreadCancel(QString)"), self.connectThreadCancel) self.connectedThreads[connectionname] = runconnect runconnect.start() break else: #common.messageDialog("connectNoConnection", False) repeat = common.cancelDialog("connectNoConnection")
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()
def __init__(self, connectionname): super(self.__class__, self).__init__() self.setupUi(self) values = common.readConnection(connectionname) self.connectionExec(values)