--- a/eric7/MicroPython/MicroPythonWidget.py Sat May 22 17:01:51 2021 +0200 +++ b/eric7/MicroPython/MicroPythonWidget.py Sat May 22 18:51:46 2021 +0200 @@ -19,11 +19,11 @@ QTextEdit, QToolButton, QDialog ) -from E5Gui.E5ZoomWidget import E5ZoomWidget -from E5Gui import E5MessageBox, E5FileDialog -from E5Gui.E5Application import e5App -from E5Gui.E5ProcessDialog import E5ProcessDialog -from E5Gui.E5OverrideCursor import E5OverrideCursor, E5OverridenCursor +from E5Gui.EricZoomWidget import EricZoomWidget +from E5Gui import EricMessageBox, EricFileDialog +from E5Gui.EricApplication import ericApp +from E5Gui.EricProcessDialog import EricProcessDialog +from E5Gui.EricOverrideCursor import EricOverrideCursor, EricOverridenCursor from .Ui_MicroPythonWidget import Ui_MicroPythonWidget @@ -246,7 +246,7 @@ self.__zoomLayout.addSpacerItem(spacerItem) self.__zoom0 = self.replEdit.fontPointSize() - self.__zoomWidget = E5ZoomWidget( + self.__zoomWidget = EricZoomWidget( UI.PixmapCache.getPixmap("zoomOut"), UI.PixmapCache.getPixmap("zoomIn"), UI.PixmapCache.getPixmap("zoomReset"), self) @@ -381,7 +381,7 @@ set(unknownDevices) - ignoredUnknown - uf2Devices ) if newUnknownDevices: - button = E5MessageBox.information( + button = EricMessageBox.information( self, self.tr("Unknown MicroPython Device"), self.tr( @@ -399,14 +399,14 @@ desc, vid, pid) for vid, pid, desc in newUnknownDevices]), BugAddress), - E5MessageBox.Ignore | E5MessageBox.Ok + EricMessageBox.Ignore | EricMessageBox.Ok ) - if button == E5MessageBox.Ignore: + if button == EricMessageBox.Ignore: ignoredUnknown = list(ignoredUnknown | newUnknownDevices) Preferences.setMicroPython("IgnoredUnknownDevices", ignoredUnknown) else: - yes = E5MessageBox.yesNo( + yes = EricMessageBox.yesNo( self, self.tr("Unknown MicroPython Device"), self.tr("""Would you like to add them to the list of""" @@ -576,7 +576,7 @@ """ Private method to show a message dialog indicating a missing device. """ - E5MessageBox.critical( + EricMessageBox.critical( self, self.tr("No device attached"), self.tr("""Please ensure the device is plugged into your""" @@ -603,7 +603,7 @@ if checked: ok, reason = self.__device.canStartRepl() if not ok: - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("Start REPL"), self.tr("""<p>The REPL cannot be started.</p><p>Reason:""" @@ -638,7 +638,7 @@ currently connected device. """ if self.__connected: - with E5OverrideCursor(): + with EricOverrideCursor(): self.__disconnectFromDevice() if self.replButton.isChecked(): @@ -648,7 +648,7 @@ if self.chartButton.isChecked(): self.on_chartButton_clicked(False) else: - with E5OverrideCursor(): + with EricOverrideCursor(): self.__connectToDevice() @pyqtSlot() @@ -1036,7 +1036,7 @@ port = self.getCurrentPort() if not port: from .ConnectionSelectionDialog import ConnectionSelectionDialog - with E5OverridenCursor(): + with EricOverridenCursor(): dlg = ConnectionSelectionDialog( self.__unknownPorts, self.__lastPort, self.__lastDeviceType ) @@ -1061,8 +1061,8 @@ self.__device.hasTimeCommands()): self.__synchronizeTime(quiet=True) else: - with E5OverridenCursor(): - E5MessageBox.warning( + with EricOverridenCursor(): + EricMessageBox.warning( self, self.tr("Serial Device Connect"), self.tr("""<p>Cannot connect to device at serial""" @@ -1088,9 +1088,9 @@ self.__showNoDeviceMessage() return - aw = e5App().getObject("ViewManager").activeWindow() + aw = ericApp().getObject("ViewManager").activeWindow() if aw is None: - E5MessageBox.critical( + EricMessageBox.critical( self, self.tr("Run Script"), self.tr("""There is no editor open. Abort...""")) @@ -1098,7 +1098,7 @@ script = aw.text() if not script: - E5MessageBox.critical( + EricMessageBox.critical( self, self.tr("Run Script"), self.tr("""The current editor does not contain a script.""" @@ -1107,7 +1107,7 @@ ok, reason = self.__device.canRunScript() if not ok: - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("Run Script"), self.tr("""<p>Cannot run script.</p><p>Reason:""" @@ -1131,13 +1131,13 @@ workspace = self.getDeviceWorkspace() if workspace: - fileName = E5FileDialog.getOpenFileName( + fileName = EricFileDialog.getOpenFileName( self, self.tr("Open Python File"), workspace, self.tr("Python3 Files (*.py);;All Files (*)")) if fileName: - e5App().getObject("ViewManager").openSourceFile(fileName) + ericApp().getObject("ViewManager").openSourceFile(fileName) @pyqtSlot() def on_saveButton_clicked(self): @@ -1148,7 +1148,7 @@ self.__showNoDeviceMessage() return - aw = e5App().getObject("ViewManager").activeWindow() + aw = ericApp().getObject("ViewManager").activeWindow() if aw: workspace = self.getDeviceWorkspace() if workspace: @@ -1176,7 +1176,7 @@ if checked: ok, reason = self.__device.canStartPlotter() if not ok: - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("Start Chart"), self.tr("""<p>The Chart cannot be started.</p><p>Reason:""" @@ -1205,7 +1205,7 @@ self.__device.setPlotter(True) else: if self.__chartWidget.isDirty(): - res = E5MessageBox.okToClearData( + res = EricMessageBox.okToClearData( self, self.tr("Unsaved Chart Data"), self.tr("""The chart contains unsaved data."""), @@ -1256,14 +1256,14 @@ if checked: ok, reason = self.__device.canStartFileManager() if not ok: - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("Start File Manager"), self.tr("""<p>The File Manager cannot be started.</p>""" """<p>Reason: {0}</p>""").format(reason)) return - with E5OverrideCursor(): + with EricOverrideCursor(): if not self.__interface.isConnected(): self.__connectToDevice() if self.__connected: @@ -1355,7 +1355,7 @@ act.setEnabled(available) act = self.__superMenu.addAction( self.tr("Compile Current Editor"), self.__compileEditor2Mpy) - aw = e5App().getObject("ViewManager").activeWindow() + aw = ericApp().getObject("ViewManager").activeWindow() act.setEnabled(available and bool(aw)) self.__superMenu.addSeparator() if self.__device: @@ -1404,7 +1404,7 @@ else: msg = self.tr("No version information available.") - E5MessageBox.information( + EricMessageBox.information( self, self.tr("Device Version Information"), msg) @@ -1432,7 +1432,7 @@ impInfo["version"] ) - E5MessageBox.information( + EricMessageBox.information( self, self.tr("Device Implementation Information"), self.tr( @@ -1457,8 +1457,8 @@ self.__interface.syncTime(self.__device.getDeviceType()) if not quiet: - with E5OverridenCursor(): - E5MessageBox.information( + with EricOverridenCursor(): + EricMessageBox.information( self, self.tr("Synchronize Time"), self.tr("<p>The time of the connected device was" @@ -1506,7 +1506,7 @@ """ msg = self.__getDeviceTime() if msg: - E5MessageBox.information( + EricMessageBox.information( self, self.tr("Device Date and Time"), msg) @@ -1519,7 +1519,7 @@ localdatetime = time.localtime() localdate = time.strftime('%Y-%m-%d', localdatetime) localtime = time.strftime('%H:%M:%S', localdatetime) - E5MessageBox.information( + EricMessageBox.information( self, self.tr("Local Date and Time"), self.tr("<h3>Local Date and Time</h3>" @@ -1545,7 +1545,7 @@ devicedate, devicetime = ( deviceDateTimeString.strip().split(None, 1) ) - E5MessageBox.information( + EricMessageBox.information( self, self.tr("Date and Time"), self.tr("<table>" @@ -1562,7 +1562,7 @@ devicedate, devicetime) ) except ValueError: - E5MessageBox.information( + EricMessageBox.information( self, self.tr("Date and Time"), self.tr("<table>" @@ -1586,8 +1586,8 @@ @param error error message @type str """ - with E5OverridenCursor(): - E5MessageBox.warning( + with EricOverridenCursor(): + EricMessageBox.warning( self, self.tr("Error handling device"), self.tr("<p>There was an error communicating with the" @@ -1627,7 +1627,7 @@ if not program: program = "mpy-cross" if not Utilities.isinpath(program): - E5MessageBox.critical( + EricMessageBox.critical( self, title, self.tr("""The MicroPython cross compiler""" @@ -1638,7 +1638,7 @@ if not pythonFile: defaultDirectory = "" - aw = e5App().getObject("ViewManager").activeWindow() + aw = ericApp().getObject("ViewManager").activeWindow() if aw: fn = aw.getFileName() if fn: @@ -1649,7 +1649,7 @@ Preferences.getMultiProject("Workspace") or os.path.expanduser("~") ) - pythonFile = E5FileDialog.getOpenFileName( + pythonFile = EricFileDialog.getOpenFileName( self, title, defaultDirectory, @@ -1659,7 +1659,7 @@ return if not os.path.exists(pythonFile): - E5MessageBox.critical( + EricMessageBox.critical( self, title, self.tr("""The Python file <b>{0}</b> does not exist.""" @@ -1669,7 +1669,7 @@ compileArgs = [ pythonFile, ] - dlg = E5ProcessDialog(self.tr("'mpy-cross' Output"), title) + dlg = EricProcessDialog(self.tr("'mpy-cross' Output"), title) res = dlg.startProcess(program, compileArgs) if res: dlg.exec() @@ -1686,13 +1686,13 @@ """ Private slot to cross compile the current editor to a .mpy file. """ - aw = e5App().getObject("ViewManager").activeWindow() + aw = ericApp().getObject("ViewManager").activeWindow() if not aw.checkDirty(): # editor still has unsaved changes, abort... return if not aw.isPyFile(): # no Python file - E5MessageBox.critical( + EricMessageBox.critical( self, self.tr("Compile Current Editor"), self.tr("""The current editor does not contain a Python""" @@ -1714,7 +1714,7 @@ return url = self.__device.getDocumentationUrl() - e5App().getObject("UserInterface").launchHelpViewer(url) + ericApp().getObject("UserInterface").launchHelpViewer(url) @pyqtSlot() def __downloadFirmware(self): @@ -1739,7 +1739,7 @@ return if url: - e5App().getObject("UserInterface").launchHelpViewer(url) + ericApp().getObject("UserInterface").launchHelpViewer(url) @pyqtSlot() def __manageIgnored(self): @@ -1761,7 +1761,7 @@ """ Private slot to open the MicroPython configuration page. """ - e5App().getObject("UserInterface").showPreferences("microPythonPage") + ericApp().getObject("UserInterface").showPreferences("microPythonPage") @pyqtSlot() def __manageUnknownDevices(self): @@ -1783,8 +1783,8 @@ from .AddEditDevicesDialog import AddEditDevicesDialog if len(devices) > 1: - from E5Gui.E5ListSelectionDialog import E5ListSelectionDialog - sdlg = E5ListSelectionDialog( + from E5Gui.EricListSelectionDialog import EricListSelectionDialog + sdlg = EricListSelectionDialog( [d[2] for d in devices], title=self.tr("Add Unknown Devices"), message=self.tr("Select the devices to be added:"),