コード例 #1
0
	def saveSettings(self):
		server = Server()
		server.setName(self.name.originalText())
		server.setHostIP(self.hostIP.originalText())
		server.setPort(str(self.port.value()))
		server.setSwitches(str(self.switches.originalText()))
		server.setLogin(self.login.originalText())
		if (Qt.Checked == self.passCheckbox.checkState()):
			server.setAuthenticationType(AUTH_TYPE_PASSWORD)
			server.setPassword(self.password.originalText())
		elif (Qt.Checked == self.keyCheckbox.checkState()):
			server.setAuthenticationType(AUTH_TYPE_PRIVATE_KEY)
			server.setKeyPath(self.keyFilePath.originalText())
		else:
			server.setAuthenticationType(AUTH_TYPE_NONE)
			
		if self.isEdit:
			self.parent.saveServer(self.oldName, server)
		else:
			self.parent.addServer(server)
コード例 #2
0
ファイル: main.py プロジェクト: vgevorgyan/easy-ssh-connect
	def readServersData(self):
		config = self.getConfig()
		if config.hasGroupImpl(CONFIG_SERVERS):
			configServers = config.groupImpl(CONFIG_SERVERS)
			list = configServers.groupList()
			if (list.count() > 0):
				for i in range(list.count()):
					serverData = KConfigGroup(configServers, list.__getitem__(i))

					server = Server()
					server.setName(list.__getitem__(i))
					server.setHostIP(serverData.readEntry(SERVER_DATA_HOST_IP))
					server.setPort(serverData.readEntry(SERVER_DATA_PORT))
					server.setLogin(serverData.readEntry(SERVER_DATA_LOGIN))
					server.setSwitches(serverData.readEntry(SERVER_DATA_SWITCHES))
					server.setAuthenticationType(serverData.readEntry(SERVER_DATA_AUTHENTICATION_TYPE))
					if server.authenticationType == AUTH_TYPE_PRIVATE_KEY:
						server.setKeyPath(serverData.readEntry(AUTH_TYPE_PRIVATE_KEY))
					
					self.servers[server.name] = server