eric6/MicroPython/MicroPythonReplWidget.py

branch
micropython
changeset 7077
3b7475b7a1ef
parent 7069
a09a30251d4e
child 7081
ed510767c096
equal deleted inserted replaced
7070:3368ce0e7879 7077:3b7475b7a1ef
36 try: 36 try:
37 from .MicroPythonGraphWidget import MicroPythonGraphWidget 37 from .MicroPythonGraphWidget import MicroPythonGraphWidget
38 HAS_QTCHART = True 38 HAS_QTCHART = True
39 except ImportError: 39 except ImportError:
40 HAS_QTCHART = False 40 HAS_QTCHART = False
41 from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget
41 42
42 import Globals 43 import Globals
43 import UI.PixmapCache 44 import UI.PixmapCache
44 import Preferences 45 import Preferences
45 46
876 877
877 if not self.__device: 878 if not self.__device:
878 self.__showNoDeviceMessage() 879 self.__showNoDeviceMessage()
879 return 880 return
880 881
881 if self.__ui is None:
882 self.__ui = e5App().getObject("UserInterface")
883
884 if self.__plotterRunning: 882 if self.__plotterRunning:
885 if self.__chartWidget.isDirty(): 883 if self.__chartWidget.isDirty():
886 res = E5MessageBox.okToClearData( 884 res = E5MessageBox.okToClearData(
887 self, 885 self,
888 self.tr("Unsaved Chart Data"), 886 self.tr("Unsaved Chart Data"),
937 """ 935 """
938 Public slot handling a data flood from the device. 936 Public slot handling a data flood from the device.
939 """ 937 """
940 self.on_disconnectButton_clicked() 938 self.on_disconnectButton_clicked()
941 self.__device.handleDataFlood() 939 self.__device.handleDataFlood()
940
941 @pyqtSlot()
942 def on_filesButton_clicked(self):
943 """
944 Private slot to open a file manager window to the connected device.
945 """
946 if not self.__device:
947 self.__showNoDeviceMessage()
948 return
949
950 if self.__fileManagerRunning:
951 self.__fileManagerWidget.stop()
952 self.__ui.removeSideWidget(self.__fileManagerWidget)
953
954 self.__device.setFileManager(False)
955 self.__fileManagerRunning = False
956 else:
957 ok, reason = self.__device.canStartFileManager()
958 if not ok:
959 E5MessageBox.warning(
960 self,
961 self.tr("Start File Manager"),
962 self.tr("""<p>The File Manager cannot be started.</p>"""
963 """<p>Reason: {0}</p>""").format(reason))
964 return
965
966 port = self.__getCurrentPort()
967 self.__fileManagerWidget = MicroPythonFileManagerWidget(port, self)
968
969 self.__ui.addSideWidget(self.__ui.BottomSide,
970 self.__fileManagerWidget,
971 UI.PixmapCache.getIcon("filemanager"),
972 self.tr("μPy Files"))
973 self.__ui.showSideWidget(self.__fileManagerWidget)
974
975 self.__device.setFileManager(True)
976 self.__fileManagerRunning = True
977
978 self.__fileManagerWidget.start()

eric ide

mercurial