Fri, 25 Oct 2024 09:47:48 +0200
MicroPython Interface
- Modified dialog usage to always include a valid parent (needed for Wayland).
--- a/src/eric7/MicroPython/BluetoothDialogs/BluetoothController.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/BluetoothDialogs/BluetoothController.py Fri Oct 25 09:47:48 2024 +0200 @@ -71,7 +71,7 @@ status = self.__mpy.getDevice().getBluetoothStatus() # status is a list of user labels and associated values - dlg = BluetoothStatusDialog(status, self.__mpy) + dlg = BluetoothStatusDialog(status, parent=self.__mpy) dlg.exec() except Exception as exc: self.__mpy.showError("getBluetoothStatus()", str(exc))
--- a/src/eric7/MicroPython/Devices/CircuitPythonDevices.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/Devices/CircuitPythonDevices.py Fri Oct 25 09:47:48 2024 +0200 @@ -492,7 +492,7 @@ """ from ..UF2FlashDialog import UF2FlashDialog - dlg = UF2FlashDialog(boardType="circuitpython") + dlg = UF2FlashDialog(boardType="circuitpython", parent=self.microPython) dlg.exec() @pyqtSlot() @@ -559,7 +559,7 @@ """ from .EspDevices import flashPythonFirmware - flashPythonFirmware(self.microPython.getCurrentPort()) + flashPythonFirmware(self.microPython.getCurrentPort(), parent=self.microPython) @pyqtSlot() def __esp32FlashAddons(self): @@ -568,7 +568,7 @@ """ from .EspDevices import flashAddonFirmware - flashAddonFirmware(self.microPython.getCurrentPort()) + flashAddonFirmware(self.microPython.getCurrentPort(), parent=self.microPython) @pyqtSlot() def showCircuitPythonVersions(self):
--- a/src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircuitPythonUpdaterInterface.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircuitPythonUpdaterInterface.py Fri Oct 25 09:47:48 2024 +0200 @@ -166,7 +166,9 @@ from .ShowBundlesDialog import ShowBundlesDialog with EricOverrideCursor(): - dlg = ShowBundlesDialog(withModules=withModules) + dlg = ShowBundlesDialog( + withModules=withModules, parent=self.__device.microPython + ) dlg.exec() @pyqtSlot() @@ -301,7 +303,9 @@ circup.CPY_VERSION = cpyVersion with EricOverrideCursor(): - dlg = ShowOutdatedDialog(devicePath=devicePath) + dlg = ShowOutdatedDialog( + devicePath=devicePath, parent=self.__device.microPython + ) dlg.exec() @pyqtSlot() @@ -317,7 +321,11 @@ circup.CPY_VERSION = cpyVersion with EricOverrideCursor(): - dlg = ShowOutdatedDialog(devicePath=devicePath, selectionMode=True) + dlg = ShowOutdatedDialog( + devicePath=devicePath, + selectionMode=True, + parent=self.__device.microPython, + ) if dlg.exec() == QDialog.DialogCode.Accepted: modules = dlg.getSelection() self.__doUpdateModules(modules) @@ -399,7 +407,7 @@ availableModules = circup.get_bundle_versions(circup.get_bundles_list()) moduleNames = [m.replace(".py", "") for m in availableModules] - dlg = ShowModulesDialog(moduleNames) + dlg = ShowModulesDialog(moduleNames, parent=self.__device.microPython) dlg.exec() @pyqtSlot() @@ -412,7 +420,9 @@ devicePath = self.__device.getWorkspace() with EricOverrideCursor(): - dlg = ShowInstalledDialog(devicePath=devicePath) + dlg = ShowInstalledDialog( + devicePath=devicePath, parent=self.__device.microPython + ) dlg.exec() @pyqtSlot() @@ -426,7 +436,9 @@ availableModules = circup.get_bundle_versions(circup.get_bundles_list()) moduleNames = [m.replace(".py", "") for m in availableModules] - dlg = ShowModulesDialog(moduleNames, selectionMode=True) + dlg = ShowModulesDialog( + moduleNames, selectionMode=True, parent=self.__device.microPython + ) if dlg.exec() == QDialog.DialogCode.Accepted: modules = dlg.getSelection() self.__installModules(modules) @@ -658,7 +670,9 @@ cpyVersion, _board_id = circup.get_circuitpython_version(devicePath) circup.CPY_VERSION = cpyVersion - dlg = RequirementsDialog(devicePath=devicePath) + dlg = RequirementsDialog( + devicePath=devicePath, parent=self.__device.microPython + ) dlg.exec() @pyqtSlot()
--- a/src/eric7/MicroPython/Devices/EspDevices.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/Devices/EspDevices.py Fri Oct 25 09:47:48 2024 +0200 @@ -271,14 +271,14 @@ """ Private slot to flash a MicroPython firmware to the device. """ - flashPythonFirmware(self.microPython.getCurrentPort()) + flashPythonFirmware(self.microPython.getCurrentPort(), parent=self.microPython) @pyqtSlot() def __flashAddons(self): """ Private slot to flash some additional firmware images. """ - flashAddonFirmware(self.microPython.getCurrentPort()) + flashAddonFirmware(self.microPython.getCurrentPort(), parent=self.microPython) @pyqtSlot() def __backupFlash(self): @@ -289,7 +289,7 @@ EspBackupRestoreFirmwareDialog, ) - dlg = EspBackupRestoreFirmwareDialog(backupMode=True) + dlg = EspBackupRestoreFirmwareDialog(backupMode=True, parent=self.microPython) if dlg.exec() == QDialog.DialogCode.Accepted: chip, flashSize, baudRate, flashMode, firmware = dlg.getData() flashArgs = [ @@ -327,7 +327,7 @@ EspBackupRestoreFirmwareDialog, ) - dlg = EspBackupRestoreFirmwareDialog(backupMode=False) + dlg = EspBackupRestoreFirmwareDialog(backupMode=False, parent=self.microPython) if dlg.exec() == QDialog.DialogCode.Accepted: chip, flashSize, baudRate, flashMode, firmware = dlg.getData() flashArgs = [ @@ -1351,7 +1351,7 @@ """ from ..WifiDialogs.WifiCountryDialog import WifiCountryDialog - dlg = WifiCountryDialog() + dlg = WifiCountryDialog(parent=self.microPython) if dlg.exec() == QDialog.DialogCode.Accepted: country, remember = dlg.getCountry() if remember: @@ -1783,16 +1783,18 @@ @pyqtSlot() -def flashPythonFirmware(port): +def flashPythonFirmware(port, parent=None): """ Slot to flash a MicroPython firmware to the device. @param port name of the serial port device to be used @type str + @param parent reference to the parent widget (defaults to None) + @type QWidget """ from .EspDialogs.EspFirmwareSelectionDialog import EspFirmwareSelectionDialog - dlg = EspFirmwareSelectionDialog() + dlg = EspFirmwareSelectionDialog(parent=parent) if dlg.exec() == QDialog.DialogCode.Accepted: chip, firmware, baudRate, flashMode, flashAddress = dlg.getData() flashArgs = [ @@ -1829,16 +1831,18 @@ @pyqtSlot() -def flashAddonFirmware(port): +def flashAddonFirmware(port, parent=None): """ Slot to flash some additional firmware images. @param port name of the serial port device to be used @type str + @param parent reference to the parent widget (defaults to None) + @type QWidget """ from .EspDialogs.EspFirmwareSelectionDialog import EspFirmwareSelectionDialog - dlg = EspFirmwareSelectionDialog(addon=True) + dlg = EspFirmwareSelectionDialog(addon=True, parent=parent) if dlg.exec() == QDialog.DialogCode.Accepted: chip, firmware, baudRate, flashMode, flashAddress = dlg.getData() flashArgs = [
--- a/src/eric7/MicroPython/Devices/RP2Devices.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/Devices/RP2Devices.py Fri Oct 25 09:47:48 2024 +0200 @@ -230,7 +230,7 @@ """ from ..UF2FlashDialog import UF2FlashDialog - dlg = UF2FlashDialog(boardType="rp2") + dlg = UF2FlashDialog(boardType="rp2", parent=self.microPython) dlg.exec() @pyqtSlot() @@ -1409,7 +1409,7 @@ """ from ..WifiDialogs.WifiCountryDialog import WifiCountryDialog - dlg = WifiCountryDialog() + dlg = WifiCountryDialog(parent=self.microPython) if dlg.exec() == QDialog.DialogCode.Accepted: country, remember = dlg.getCountry() if remember:
--- a/src/eric7/MicroPython/EthernetDialogs/EthernetController.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/EthernetDialogs/EthernetController.py Fri Oct 25 09:47:48 2024 +0200 @@ -86,7 +86,7 @@ status = self.__mpy.getDevice().getEthernetStatus() # status is a list of user labels and associated values - dlg = EthernetStatusDialog(status, self.__mpy) + dlg = EthernetStatusDialog(status, parent=self.__mpy) dlg.exec() except Exception as exc: self.__mpy.showError("getEthernetStatus()", str(exc)) @@ -98,7 +98,7 @@ """ from .HostnameDialog import HostnameDialog - dlg = HostnameDialog(self.__mpy) + dlg = HostnameDialog(parent=self.__mpy) hostname = ( dlg.getHostname() if dlg.exec() == QDialog.DialogCode.Accepted else "" ) @@ -342,7 +342,7 @@ ) return - dlg = NtpParametersDialog(self.__mpy) + dlg = NtpParametersDialog(parent=self.__mpy) if dlg.exec() == QDialog.DialogCode.Accepted: server, tzOffset, isDst, timeout = dlg.getParameters() if isDst:
--- a/src/eric7/MicroPython/MicroPythonFileManagerWidget.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/MicroPythonFileManagerWidget.py Fri Oct 25 09:47:48 2024 +0200 @@ -937,7 +937,7 @@ from .MicroPythonProgressInfoDialog import MicroPythonProgressInfoDialog if self.__progressInfoDialog is None: - self.__progressInfoDialog = MicroPythonProgressInfoDialog(self) + self.__progressInfoDialog = MicroPythonProgressInfoDialog(parent=self) self.__progressInfoDialog.finished.connect( self.__progressInfoDialogFinished )
--- a/src/eric7/MicroPython/MicroPythonWidget.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/MicroPythonWidget.py Fri Oct 25 09:47:48 2024 +0200 @@ -359,7 +359,7 @@ ) webreplUrlsDict = Preferences.getMicroPython("WebreplUrls") - dlg = MicroPythonWebreplUrlsConfigDialog(webreplUrlsDict) + dlg = MicroPythonWebreplUrlsConfigDialog(webreplUrlsDict, parent=self) if dlg.exec() == QDialog.DialogCode.Accepted: webreplUrlsDict = dlg.getWebreplDict() Preferences.setMicroPython("WebreplUrls", webreplUrlsDict) @@ -666,7 +666,10 @@ if not port: with EricOverridenCursor(): dlg = ConnectionSelectionDialog( - self.__unknownPorts, self.__lastPort, self.__lastDeviceType + self.__unknownPorts, + self.__lastPort, + self.__lastDeviceType, + parent=self, ) if dlg.exec() == QDialog.DialogCode.Accepted: vid, pid, port, deviceType = dlg.getData() @@ -687,7 +690,7 @@ if not port: with EricOverridenCursor(): dlg = MicroPythonWebreplConnectionDialog( - self.__lastWebreplUrl, self.__lastDeviceType + self.__lastWebreplUrl, self.__lastDeviceType, parent=self ) if dlg.exec() == QDialog.DialogCode.Accepted: port, deviceType = dlg.getWebreplConnectionParameters() @@ -1240,7 +1243,7 @@ ) boardInfo["ntp"] = self.__device.hasNetworkTime() - dlg = BoardDataDialog(boardInfo) + dlg = BoardDataDialog(boardInfo, parent=self) dlg.exec() except Exception as exc: self.showError("getBoardInformation()", str(exc)) @@ -1568,7 +1571,7 @@ from .IgnoredDevicesDialog import IgnoredDevicesDialog dlg = IgnoredDevicesDialog( - Preferences.getMicroPython("IgnoredUnknownDevices"), self + Preferences.getMicroPython("IgnoredUnknownDevices"), parent=self ) if dlg.exec() == QDialog.DialogCode.Accepted: ignoredDevices = dlg.getDevices() @@ -1589,7 +1592,7 @@ """ from .UnknownDevicesDialog import UnknownDevicesDialog - dlg = UnknownDevicesDialog() + dlg = UnknownDevicesDialog(parent=None) dlg.exec() def __addUnknownDevices(self, devices): @@ -1617,7 +1620,7 @@ manualDevices = Preferences.getMicroPython("ManualDevices") for vid, pid, description in devices: if description in selectedDevices: - dlg = AddEditDevicesDialog(vid, pid, description) + dlg = AddEditDevicesDialog(vid, pid, description, parent=self) if dlg.exec() == QDialog.DialogCode.Accepted: manualDevices.append(dlg.getDeviceDict()) Preferences.setMicroPython("ManualDevices", manualDevices) @@ -1631,7 +1634,7 @@ Private slot to flash MicroPython/CircuitPython to a device support the UF2 bootloader. """ - dlg = UF2FlashDialog.UF2FlashDialog() + dlg = UF2FlashDialog.UF2FlashDialog(parent=self) dlg.exec() @pyqtSlot() @@ -1639,7 +1642,7 @@ """ Private slot to convert a non-UF2 MicroPython firmware file to UF2. """ - dlg = ConvertToUF2Dialog.ConvertToUF2Dialog() + dlg = ConvertToUF2Dialog.ConvertToUF2Dialog(parent=self) dlg.exec() @pyqtSlot() @@ -1682,7 +1685,7 @@ if method in ("local_mip", "mip"): title = self.tr("Install Package") - dlg = MipPackageDialog(self) + dlg = MipPackageDialog(parent=self) if dlg.exec() == QDialog.DialogCode.Accepted: package, version, mpy, target, index = dlg.getData() if method == "mip":
--- a/src/eric7/MicroPython/UnknownDevicesDialog.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/UnknownDevicesDialog.py Fri Oct 25 09:47:48 2024 +0200 @@ -85,7 +85,9 @@ # play it safe return - dlg = AddEditDevicesDialog(deviceData=item.data(self.DeviceDataRole)) + dlg = AddEditDevicesDialog( + deviceData=item.data(self.DeviceDataRole), parent=self + ) if dlg.exec() == QDialog.DialogCode.Accepted: deviceDict = dlg.getDeviceDict() item.setData(self.DeviceDataRole, deviceDict)
--- a/src/eric7/MicroPython/WifiDialogs/WifiController.py Fri Oct 25 08:42:57 2024 +0200 +++ b/src/eric7/MicroPython/WifiDialogs/WifiController.py Fri Oct 25 09:47:48 2024 +0200 @@ -25,7 +25,7 @@ Constructor @param microPython reference to the MicroPython widget - @type MicroPythonWidgep + @type MicroPythonWidget @param parent reference to the parent object (defaults to None) @type QObject (optional) """ @@ -93,7 +93,9 @@ try: clientStatus, apStatus, overallStatus = self.__mpy.getDevice().getWifiData() - dlg = WifiStatusDialog(clientStatus, apStatus, overallStatus) + dlg = WifiStatusDialog( + clientStatus, apStatus, overallStatus, parent=self.__mpy + ) dlg.exec() except Exception as exc: self.__mpy.showError("getWifiData()", str(exc)) @@ -105,7 +107,7 @@ """ from .WifiConnectionDialog import WifiConnectionDialog - dlg = WifiConnectionDialog() + dlg = WifiConnectionDialog(parent=self.__mpy) if dlg.exec() == QDialog.DialogCode.Accepted: ssid, password, hostname = dlg.getConnectionParameters() success, error = self.__mpy.getDevice().connectWifi( @@ -196,7 +198,10 @@ """ from .WifiConnectionDialog import WifiConnectionDialog - dlg = WifiConnectionDialog(withCountry=self.__mpy.getDevice().hasWifiCountry()) + dlg = WifiConnectionDialog( + withCountry=self.__mpy.getDevice().hasWifiCountry(), + parent=self.__mpy, + ) if dlg.exec() == QDialog.DialogCode.Accepted: ssid, password, hostname = dlg.getConnectionParameters() country = dlg.getCountryCode() @@ -296,7 +301,7 @@ """ from .WifiApConfigDialog import WifiApConfigDialog - dlg = WifiApConfigDialog(withIP=withIP) + dlg = WifiApConfigDialog(withIP=withIP, parent=self.__mpy) if dlg.exec() == QDialog.DialogCode.Accepted: ssid, password, security, hostname, ifconfig = dlg.getApConfig() @@ -370,7 +375,7 @@ self.__mpy.showError("getConnectedClients()", err) else: if stations: - dlg = WifiApStationsDialog(stations) + dlg = WifiApStationsDialog(stations, parent=self.__mpy) dlg.exec() else: EricMessageBox.information( @@ -433,7 +438,7 @@ ) return - dlg = NtpParametersDialog(self.__mpy) + dlg = NtpParametersDialog(parent=self.__mpy) if dlg.exec() == QDialog.DialogCode.Accepted: server, tzOffset, isDst, timeout = dlg.getParameters() if isDst: @@ -476,7 +481,7 @@ MicroPythonWebreplParametersDialog, ) - dlg = MicroPythonWebreplParametersDialog() + dlg = MicroPythonWebreplParametersDialog(parent=self.__mpy) if dlg.exec() == QDialog.DialogCode.Accepted: (password,) = dlg.getParameters() success, error = self.__mpy.getDevice().enableWebrepl(password)