src/eric7/MicroPython/MicroPythonWidget.py

branch
eric7
changeset 9763
52f982c08301
parent 9759
4543b7876047
child 9765
6378da868bb0
--- a/src/eric7/MicroPython/MicroPythonWidget.py	Tue Feb 14 09:43:26 2023 +0100
+++ b/src/eric7/MicroPython/MicroPythonWidget.py	Tue Feb 14 10:05:29 2023 +0100
@@ -237,9 +237,6 @@
 
         self.deviceIconLabel.setPixmap(Devices.getDeviceIcon("", False))
 
-        self.openButton.setIcon(EricPixmapCache.getIcon("open"))
-        self.saveButton.setIcon(EricPixmapCache.getIcon("fileSaveAs"))
-
         self.checkButton.setIcon(EricPixmapCache.getIcon("question"))
         self.runButton.setIcon(EricPixmapCache.getIcon("start"))
         self.replButton.setIcon(EricPixmapCache.getIcon("terminal"))
@@ -535,10 +532,6 @@
             are 'run', 'repl', 'files', 'chart', 'open', 'save'
         @type dict
         """
-        if "open" in kwargs:
-            self.openButton.setEnabled(kwargs["open"] and self.__connected)
-        if "save" in kwargs:
-            self.saveButton.setEnabled(kwargs["save"] and self.__connected)
         if "run" in kwargs:
             self.runButton.setEnabled(kwargs["run"] and self.__connected)
         if "repl" in kwargs:
@@ -721,7 +714,7 @@
                 self.on_chartButton_clicked(False)
         else:
             with EricOverrideCursor():
-                self.__connectToDevice()
+                self.__connectToDevice(withAutostart=True)
 
     @pyqtSlot()
     def __clear(self):
@@ -1130,9 +1123,13 @@
         else:
             return ""
 
-    def __connectToDevice(self):
+    def __connectToDevice(self, withAutostart=False):
         """
         Private method to connect to the selected device.
+
+        @param withAutostart flag indicating to start the repl and file manager
+            automatically
+        @type bool
         """
         from .ConnectionSelectionDialog import ConnectionSelectionDialog
 
@@ -1190,6 +1187,13 @@
                 )
 
         self.__device.setButtons()
+        if withAutostart:
+            self.on_replButton_clicked(
+                self.replButton.isEnabled() and self.__linkConnected
+            )
+            self.on_filesButton_clicked(
+                self.filesButton.isEnabled() and self.__connected
+            )
 
     def __disconnectFromDevice(self):
         """
@@ -1247,41 +1251,6 @@
         if self.replButton.isChecked():
             self.__device.runScript(script)
 
-    @pyqtSlot()
-    def on_openButton_clicked(self):
-        """
-        Private slot to open a file of the connected device.
-        """
-        if not self.__device:
-            self.__showNoDeviceMessage()
-            return
-
-        workspace = self.getDeviceWorkspace()
-        if workspace:
-            fileName = EricFileDialog.getOpenFileName(
-                self,
-                self.tr("Open Python File"),
-                workspace,
-                self.tr("Python3 Files (*.py);;All Files (*)"),
-            )
-            if fileName:
-                ericApp().getObject("ViewManager").openSourceFile(fileName)
-
-    @pyqtSlot()
-    def on_saveButton_clicked(self):
-        """
-        Private slot to save the current editor to the connected device.
-        """
-        if not self.__device:
-            self.__showNoDeviceMessage()
-            return
-
-        aw = ericApp().getObject("ViewManager").activeWindow()
-        if aw:
-            workspace = self.getDeviceWorkspace()
-            if workspace:
-                aw.saveFileAs(workspace)
-
     @pyqtSlot(bool)
     def on_chartButton_clicked(self, checked):
         """

eric ide

mercurial