59 |
59 |
60 @return tuple containing a flag indicating it is safe to start a REPL |
60 @return tuple containing a flag indicating it is safe to start a REPL |
61 and a reason why it cannot. |
61 and a reason why it cannot. |
62 @rtype tuple of (bool, str) |
62 @rtype tuple of (bool, str) |
63 """ |
63 """ |
64 if self.__fileManagerActive: |
64 return True, "" |
65 return False, self.tr("The REPL and the file manager use the same" |
|
66 " USB serial connection. Only one can be" |
|
67 " active at any time. Toggle the file" |
|
68 " manager off and try again.") |
|
69 else: |
|
70 return True, "" |
|
71 |
65 |
72 def setRepl(self, on): |
66 def setRepl(self, on): |
73 """ |
67 """ |
74 Public method to set the REPL status and dependent status. |
68 Public method to set the REPL status and dependent status. |
75 |
69 |
76 @param on flag indicating the active status |
70 @param on flag indicating the active status |
77 @type bool |
71 @type bool |
78 """ |
72 """ |
79 self.__replActive = on |
73 self.__replActive = on |
80 self.microPython.setActionButtons( |
|
81 files=not (on or self.__plotterActive)) |
|
82 |
74 |
83 def canStartPlotter(self): |
75 def canStartPlotter(self): |
84 """ |
76 """ |
85 Public method to determine, if a Plotter can be started. |
77 Public method to determine, if a Plotter can be started. |
86 |
78 |
87 @return tuple containing a flag indicating it is safe to start a |
79 @return tuple containing a flag indicating it is safe to start a |
88 Plotter and a reason why it cannot. |
80 Plotter and a reason why it cannot. |
89 @rtype tuple of (bool, str) |
81 @rtype tuple of (bool, str) |
90 """ |
82 """ |
91 if self.__fileManagerActive: |
83 return True, "" |
92 return False, self.tr("The Plotter and the file manager use the" |
|
93 " same USB serial connection. Only one can" |
|
94 " be active at any time. Toggle the file" |
|
95 " manager off and try again.") |
|
96 else: |
|
97 return True, "" |
|
98 |
84 |
99 def setPlotter(self, on): |
85 def setPlotter(self, on): |
100 """ |
86 """ |
101 Public method to set the Plotter status and dependent status. |
87 Public method to set the Plotter status and dependent status. |
102 |
88 |
103 @param on flag indicating the active status |
89 @param on flag indicating the active status |
104 @type bool |
90 @type bool |
105 """ |
91 """ |
106 self.__plotterActive = on |
92 self.__plotterActive = on |
107 self.microPython.setActionButtons( |
|
108 files=not (on or self.__replActive)) |
|
109 |
93 |
110 def canRunScript(self): |
94 def canRunScript(self): |
111 """ |
95 """ |
112 Public method to determine, if a script can be executed. |
96 Public method to determine, if a script can be executed. |
113 |
97 |
133 |
117 |
134 @return tuple containing a flag indicating it is safe to start a |
118 @return tuple containing a flag indicating it is safe to start a |
135 File Manager and a reason why it cannot. |
119 File Manager and a reason why it cannot. |
136 @rtype tuple of (bool, str) |
120 @rtype tuple of (bool, str) |
137 """ |
121 """ |
138 if self.__replActive or self.__plotterActive: |
122 return True, "" |
139 return False, self.tr("The file manager and the REPL/plotter use" |
|
140 " the same USB serial connection. Only one" |
|
141 " can be active at any time. Disconnect the" |
|
142 " REPL/plotter and try again.") |
|
143 else: |
|
144 return True, "" |
|
145 |
123 |
146 def setFileManager(self, on): |
124 def setFileManager(self, on): |
147 """ |
125 """ |
148 Public method to set the File Manager status and dependent status. |
126 Public method to set the File Manager status and dependent status. |
149 |
127 |
150 @param on flag indicating the active status |
128 @param on flag indicating the active status |
151 @type bool |
129 @type bool |
152 """ |
130 """ |
153 self.__fileManagerActive = on |
131 self.__fileManagerActive = on |
154 self.microPython.setActionButtons( |
|
155 run=not on, repl=not on, chart=HAS_QTCHART and not on) |
|
156 |
132 |
157 @pyqtSlot() |
133 @pyqtSlot() |
158 def handleDataFlood(self): |
134 def handleDataFlood(self): |
159 """ |
135 """ |
160 Public slot handling a data floof from the device. |
136 Public slot handling a data flood from the device. |
161 """ |
137 """ |
162 self.microPython.setActionButtons(files=True) |
138 self.microPython.setActionButtons(files=True) |