53 wifiMenu.addSeparator() |
53 wifiMenu.addSeparator() |
54 wifiMenu.addAction(self.tr("Write WiFi Credentials"), self.__writeCredentials) |
54 wifiMenu.addAction(self.tr("Write WiFi Credentials"), self.__writeCredentials) |
55 wifiMenu.addAction(self.tr("Remove WiFi Credentials"), self.__removeCredentials) |
55 wifiMenu.addAction(self.tr("Remove WiFi Credentials"), self.__removeCredentials) |
56 wifiMenu.addSeparator() |
56 wifiMenu.addSeparator() |
57 wifiMenu.addAction(self.tr("Start WiFi Access Point"), self.__startAccessPoint) |
57 wifiMenu.addAction(self.tr("Start WiFi Access Point"), self.__startAccessPoint) |
|
58 wifiMenu.addAction( |
|
59 self.tr("Show Connected Clients"), self.__showConnectedClients |
|
60 ) |
58 wifiMenu.addAction(self.tr("Stop WiFi Access Point"), self.__stopAccessPoint) |
61 wifiMenu.addAction(self.tr("Stop WiFi Access Point"), self.__stopAccessPoint) |
59 wifiMenu.addSeparator() |
62 wifiMenu.addSeparator() |
60 wifiMenu.addAction( |
63 wifiMenu.addAction( |
61 self.tr("Deactivate Client Interface"), |
64 self.tr("Deactivate Client Interface"), |
62 lambda: self.__deactivateInterface("STA") |
65 lambda: self.__deactivateInterface("STA"), |
63 ) |
66 ) |
64 wifiMenu.addAction( |
67 wifiMenu.addAction( |
65 self.tr("Deactivate Access Point Interface"), |
68 self.tr("Deactivate Access Point Interface"), |
66 lambda: self.__deactivateInterface("AP") |
69 lambda: self.__deactivateInterface("AP"), |
67 ) |
70 ) |
68 |
71 |
69 # add device specific entries (if there are any) |
72 # add device specific entries (if there are any) |
70 self.__mpy.getDevice().addDeviceWifiEntries(wifiMenu) |
73 self.__mpy.getDevice().addDeviceWifiEntries(wifiMenu) |
71 |
74 |
127 success, error = self.__mpy.getDevice().disconnectWifi() |
130 success, error = self.__mpy.getDevice().disconnectWifi() |
128 if success: |
131 if success: |
129 EricMessageBox.information( |
132 EricMessageBox.information( |
130 None, |
133 None, |
131 self.tr("Disconnect WiFi"), |
134 self.tr("Disconnect WiFi"), |
132 self.tr( |
135 self.tr("<p>The device was disconnected from the WiFi network.</p>"), |
133 "<p>The device was disconnected from the WiFi network.</p>" |
|
134 ), |
|
135 ) |
136 ) |
136 else: |
137 else: |
137 EricMessageBox.critical( |
138 EricMessageBox.critical( |
138 None, |
139 None, |
139 self.tr("Disconnect WiFi"), |
140 self.tr("Disconnect WiFi"), |
140 self.tr( |
141 self.tr( |
141 "<p>The device could not be disconnected.</p>" |
142 "<p>The device could not be disconnected.</p><p>Reason: {0}</p>" |
142 "<p>Reason: {0}</p>" |
|
143 ).format(error if error else self.tr("unknown")), |
143 ).format(error if error else self.tr("unknown")), |
144 ) |
144 ) |
145 |
145 |
146 @pyqtSlot() |
146 @pyqtSlot() |
147 def __checkInternet(self): |
147 def __checkInternet(self): |
148 """ |
148 """ |
149 Private slot to check the availability of an internet connection. |
149 Private slot to check the availability of an internet connection. |
150 """ |
150 """ |
151 # TODO: not implemented yet |
151 success, error = self.__mpy.getDevice().checkInternet() |
152 pass |
152 if not error: |
|
153 msg = ( |
|
154 self.tr("<p>The internet connection is <b>available</b>.</p>") |
|
155 if success |
|
156 else self.tr("<p>The internet connection is <b>not available</b>.</p>") |
|
157 ) |
|
158 EricMessageBox.information( |
|
159 None, |
|
160 self.tr("Check Internet Connection"), |
|
161 msg, |
|
162 ) |
|
163 else: |
|
164 EricMessageBox.critical( |
|
165 None, |
|
166 self.tr("Check Internet Connection"), |
|
167 self.tr( |
|
168 "<p>The internet is not available.</p><p>Reason: {0}</p>" |
|
169 ).format(error if error else self.tr("unknown")), |
|
170 ) |
153 |
171 |
154 @pyqtSlot() |
172 @pyqtSlot() |
155 def __scanNetwork(self): |
173 def __scanNetwork(self): |
156 """ |
174 """ |
157 Private slot to scan for visible WiFi networks. |
175 Private slot to scan for visible WiFi networks. |
158 """ |
176 """ |
159 # TODO: not implemented yet |
177 from .WifiNetworksWindow import WifiNetworksWindow |
160 pass |
178 |
|
179 win = WifiNetworksWindow(self.__mpy.getDevice(), self.__mpy) |
|
180 win.show() |
|
181 win.scanNetworks() |
161 |
182 |
162 @pyqtSlot() |
183 @pyqtSlot() |
163 def __writeCredentials(self): |
184 def __writeCredentials(self): |
164 """ |
185 """ |
165 Private slot to save the WiFi login credentials to the connected device. |
186 Private slot to save the WiFi login credentials to the connected device. |
190 |
211 |
191 @pyqtSlot() |
212 @pyqtSlot() |
192 def __stopAccessPoint(self): |
213 def __stopAccessPoint(self): |
193 """ |
214 """ |
194 Private slot to stop the Access Point interface of the connected device. |
215 Private slot to stop the Access Point interface of the connected device. |
|
216 """ |
|
217 # TODO: not implemented yet |
|
218 pass |
|
219 |
|
220 @pyqtSlot() |
|
221 def __showConnectedClients(self): |
|
222 """ |
|
223 Private slot to show a list of WiFi clients connected to the Access Point |
|
224 interface. |
195 """ |
225 """ |
196 # TODO: not implemented yet |
226 # TODO: not implemented yet |
197 pass |
227 pass |
198 |
228 |
199 def __deactivateInterface(self, interface): |
229 def __deactivateInterface(self, interface): |