diff -r 3368ce0e7879 -r 3b7475b7a1ef eric6/MicroPython/MicroPythonReplWidget.py --- a/eric6/MicroPython/MicroPythonReplWidget.py Sat Jul 20 14:48:09 2019 +0200 +++ b/eric6/MicroPython/MicroPythonReplWidget.py Sun Jul 21 19:54:15 2019 +0200 @@ -38,6 +38,7 @@ HAS_QTCHART = True except ImportError: HAS_QTCHART = False +from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget import Globals import UI.PixmapCache @@ -878,9 +879,6 @@ self.__showNoDeviceMessage() return - if self.__ui is None: - self.__ui = e5App().getObject("UserInterface") - if self.__plotterRunning: if self.__chartWidget.isDirty(): res = E5MessageBox.okToClearData( @@ -939,3 +937,42 @@ """ self.on_disconnectButton_clicked() self.__device.handleDataFlood() + + @pyqtSlot() + def on_filesButton_clicked(self): + """ + Private slot to open a file manager window to the connected device. + """ + if not self.__device: + self.__showNoDeviceMessage() + return + + if self.__fileManagerRunning: + self.__fileManagerWidget.stop() + self.__ui.removeSideWidget(self.__fileManagerWidget) + + self.__device.setFileManager(False) + self.__fileManagerRunning = False + else: + ok, reason = self.__device.canStartFileManager() + if not ok: + E5MessageBox.warning( + self, + self.tr("Start File Manager"), + self.tr("""<p>The File Manager cannot be started.</p>""" + """<p>Reason: {0}</p>""").format(reason)) + return + + port = self.__getCurrentPort() + self.__fileManagerWidget = MicroPythonFileManagerWidget(port, self) + + self.__ui.addSideWidget(self.__ui.BottomSide, + self.__fileManagerWidget, + UI.PixmapCache.getIcon("filemanager"), + self.tr("μPy Files")) + self.__ui.showSideWidget(self.__fileManagerWidget) + + self.__device.setFileManager(True) + self.__fileManagerRunning = True + + self.__fileManagerWidget.start()