69 ) |
69 ) |
70 wifiMenu.addAction( |
70 wifiMenu.addAction( |
71 self.tr("Deactivate Access Point Interface"), |
71 self.tr("Deactivate Access Point Interface"), |
72 lambda: self.__deactivateInterface("AP"), |
72 lambda: self.__deactivateInterface("AP"), |
73 ) |
73 ) |
74 |
74 wifiMenu.addSeparator() |
75 if self.__mpy.getDevice().hasNetworkTime(): |
75 wifiMenu.addAction(self.tr("Set Network Time"), self.__setNetworkTime) |
76 wifiMenu.addSeparator() |
|
77 wifiMenu.addAction(self.tr("Set Network Time"), self.__setNetworkTime) |
|
78 |
76 |
79 # add device specific entries (if there are any) |
77 # add device specific entries (if there are any) |
80 self.__mpy.getDevice().addDeviceWifiEntries(wifiMenu) |
78 self.__mpy.getDevice().addDeviceWifiEntries(wifiMenu) |
81 |
79 |
82 return wifiMenu |
80 return wifiMenu |
374 """ |
372 """ |
375 Private method to synchronize the device clock to network time. |
373 Private method to synchronize the device clock to network time. |
376 """ |
374 """ |
377 from ..NtpParametersDialog import NtpParametersDialog |
375 from ..NtpParametersDialog import NtpParametersDialog |
378 |
376 |
|
377 device = self.__mpy.getDevice() |
|
378 if not device.getDeviceData("ntp"): |
|
379 if device.hasCircuitPython(): |
|
380 EricMessageBox.warning( |
|
381 None, |
|
382 self.tr("Set Network Time"), |
|
383 self.tr( |
|
384 "<p>The device does not support network time synchronization." |
|
385 " The module <b>adafruit_ntp</b> is not installed.</p>" |
|
386 ), |
|
387 ) |
|
388 else: |
|
389 EricMessageBox.critical( |
|
390 None, |
|
391 self.tr("Set Network Time"), |
|
392 self.tr( |
|
393 "<p>The device does not support network time synchronization." |
|
394 " The module <b>ntptime</b> is not available.</p>" |
|
395 ), |
|
396 ) |
|
397 return |
|
398 |
379 dlg = NtpParametersDialog(self.__mpy) |
399 dlg = NtpParametersDialog(self.__mpy) |
380 if dlg.exec() == QDialog.DialogCode.Accepted: |
400 if dlg.exec() == QDialog.DialogCode.Accepted: |
381 server, tzOffset, isDst, timeout = dlg.getParameters() |
401 server, tzOffset, isDst, timeout = dlg.getParameters() |
382 if isDst: |
402 if isDst: |
383 tzOffset += 1 |
403 tzOffset += 1 |