51 if connectionParams: |
51 if connectionParams: |
52 self.__editName = connectionParams[0] |
52 self.__editName = connectionParams[0] |
53 self.__populateFields(connectionParams) |
53 self.__populateFields(connectionParams) |
54 else: |
54 else: |
55 self.__editName = "" |
55 self.__editName = "" |
|
56 self.__updateOkButton() |
56 |
57 |
57 msh = self.minimumSizeHint() |
58 msh = self.minimumSizeHint() |
58 self.resize(max(self.width(), msh.width()), msh.height()) |
59 self.resize(max(self.width(), msh.width()), msh.height()) |
59 |
60 |
60 def __populateFields(self, params): |
61 def __populateFields(self, params): |
66 """ |
67 """ |
67 self.nameEdit.setText(params[0]) |
68 self.nameEdit.setText(params[0]) |
68 self.descriptionEdit.setText(params[1]) |
69 self.descriptionEdit.setText(params[1]) |
69 |
70 |
70 url = params[2].replace("ws://", "") |
71 url = params[2].replace("ws://", "") |
71 if "@" in url: |
72 password, hostPort = url.split("@", 1) if "@" in url else ("", url) |
72 password, hostPort = url.split("@", 1) |
73 host, port = hostPort.split(":", 1) if ":" in hostPort else (hostPort, "") |
73 else: |
|
74 password, hostPort = "", url |
|
75 if ":" in hostPort: |
|
76 host, port = hostPort.split(":", 1) |
|
77 else: |
|
78 host, port = hostPort, "" |
|
79 self.hostEdit.setText(host) |
74 self.hostEdit.setText(host) |
80 self.portEdit.setText(port) |
75 self.portEdit.setText(port) |
81 self.passwordEdit.setText(password) |
76 self.passwordEdit.setText(password) |
82 |
77 |
83 typeIndex = self.deviceTypeComboBox.findData(params["device_type"]) |
78 typeIndex = self.deviceTypeComboBox.findData(params["device_type"]) |
113 |
108 |
114 def getWebreplUrl(self): |
109 def getWebreplUrl(self): |
115 """ |
110 """ |
116 Public method to retrieve the entered WebREPL connection data. |
111 Public method to retrieve the entered WebREPL connection data. |
117 |
112 |
118 @return tuple containing the name, description and URL for the WebREPL |
113 @return tuple containing the name, description, URL and device type for |
119 connection |
114 the WebREPL connection |
120 @rtype tuple of (str, str, str) |
115 @rtype tuple of (str, str, str, str) |
121 """ |
116 """ |
122 password = self.passwordEdit.text() |
117 password = self.passwordEdit.text() |
123 host = self.hostEdit.text() |
118 host = self.hostEdit.text() |
124 port = self.portEdit.text() |
119 port = self.portEdit.text() |
125 |
120 |