Sat, 25 Feb 2023 19:47:23 +0100
Merged with branch 'eric7' in order to prevent deviating too much.
--- a/src/eric7/APIs/Python3/eric7.api Sat Feb 25 19:18:43 2023 +0100 +++ b/src/eric7/APIs/Python3/eric7.api Sat Feb 25 19:47:23 2023 +0100 @@ -8417,12 +8417,14 @@ eric7.QScintilla.Editor.Editor.insertDocstring?4() eric7.QScintilla.Editor.Editor.isClone?4(editor) eric7.QScintilla.Editor.Editor.isCythonFile?4() +eric7.QScintilla.Editor.Editor.isDeviceFile?4() eric7.QScintilla.Editor.Editor.isJavascriptFile?4() eric7.QScintilla.Editor.Editor.isLastEditPositionAvailable?4() eric7.QScintilla.Editor.Editor.isLocalFile?4() eric7.QScintilla.Editor.Editor.isMicroPythonFile?4() eric7.QScintilla.Editor.Editor.isPy3File?4() eric7.QScintilla.Editor.Editor.isPyFile?4() +eric7.QScintilla.Editor.Editor.isRemoteFile?4() eric7.QScintilla.Editor.Editor.isRubyFile?4() eric7.QScintilla.Editor.Editor.isSpellCheckRegion?4(pos) eric7.QScintilla.Editor.Editor.joinLines?4() @@ -8475,6 +8477,7 @@ eric7.QScintilla.Editor.Editor.removeCompletionListHook?4(key) eric7.QScintilla.Editor.Editor.removeMouseClickHandler?4(modifiers, button) eric7.QScintilla.Editor.Editor.removeMouseClickHandlers?4(name) +eric7.QScintilla.Editor.Editor.resetOnlineChangeTraceInfo?4() eric7.QScintilla.Editor.Editor.resizeEvent?4(evt) eric7.QScintilla.Editor.Editor.revertToUnmodified?4() eric7.QScintilla.Editor.Editor.saveFile?4(saveas=False, path=None)
--- a/src/eric7/Documentation/Help/source.qhp Sat Feb 25 19:18:43 2023 +0100 +++ b/src/eric7/Documentation/Help/source.qhp Sat Feb 25 19:47:23 2023 +0100 @@ -4444,7 +4444,6 @@ <keyword name="Editor.__reopenWithEncodingMenuTriggered" id="Editor.__reopenWithEncodingMenuTriggered" ref="eric7.QScintilla.Editor.html#Editor.__reopenWithEncodingMenuTriggered" /> <keyword name="Editor.__replaceLeadingUnderscores" id="Editor.__replaceLeadingUnderscores" ref="eric7.QScintilla.Editor.html#Editor.__replaceLeadingUnderscores" /> <keyword name="Editor.__resetLanguage" id="Editor.__resetLanguage" ref="eric7.QScintilla.Editor.html#Editor.__resetLanguage" /> - <keyword name="Editor.__resetOnlineChangeTraceInfo" id="Editor.__resetOnlineChangeTraceInfo" ref="eric7.QScintilla.Editor.html#Editor.__resetOnlineChangeTraceInfo" /> <keyword name="Editor.__resetOnlineChangeTraceTimer" id="Editor.__resetOnlineChangeTraceTimer" ref="eric7.QScintilla.Editor.html#Editor.__resetOnlineChangeTraceTimer" /> <keyword name="Editor.__resetOnlineSyntaxCheckTimer" id="Editor.__resetOnlineSyntaxCheckTimer" ref="eric7.QScintilla.Editor.html#Editor.__resetOnlineSyntaxCheckTimer" /> <keyword name="Editor.__resizeLinenoMargin" id="Editor.__resizeLinenoMargin" ref="eric7.QScintilla.Editor.html#Editor.__resizeLinenoMargin" /> @@ -4617,12 +4616,14 @@ <keyword name="Editor.insertDocstring" id="Editor.insertDocstring" ref="eric7.QScintilla.Editor.html#Editor.insertDocstring" /> <keyword name="Editor.isClone" id="Editor.isClone" ref="eric7.QScintilla.Editor.html#Editor.isClone" /> <keyword name="Editor.isCythonFile" id="Editor.isCythonFile" ref="eric7.QScintilla.Editor.html#Editor.isCythonFile" /> + <keyword name="Editor.isDeviceFile" id="Editor.isDeviceFile" ref="eric7.QScintilla.Editor.html#Editor.isDeviceFile" /> <keyword name="Editor.isJavascriptFile" id="Editor.isJavascriptFile" ref="eric7.QScintilla.Editor.html#Editor.isJavascriptFile" /> <keyword name="Editor.isLastEditPositionAvailable" id="Editor.isLastEditPositionAvailable" ref="eric7.QScintilla.Editor.html#Editor.isLastEditPositionAvailable" /> <keyword name="Editor.isLocalFile" id="Editor.isLocalFile" ref="eric7.QScintilla.Editor.html#Editor.isLocalFile" /> <keyword name="Editor.isMicroPythonFile" id="Editor.isMicroPythonFile" ref="eric7.QScintilla.Editor.html#Editor.isMicroPythonFile" /> <keyword name="Editor.isPy3File" id="Editor.isPy3File" ref="eric7.QScintilla.Editor.html#Editor.isPy3File" /> <keyword name="Editor.isPyFile" id="Editor.isPyFile" ref="eric7.QScintilla.Editor.html#Editor.isPyFile" /> + <keyword name="Editor.isRemoteFile" id="Editor.isRemoteFile" ref="eric7.QScintilla.Editor.html#Editor.isRemoteFile" /> <keyword name="Editor.isRubyFile" id="Editor.isRubyFile" ref="eric7.QScintilla.Editor.html#Editor.isRubyFile" /> <keyword name="Editor.isSpellCheckRegion" id="Editor.isSpellCheckRegion" ref="eric7.QScintilla.Editor.html#Editor.isSpellCheckRegion" /> <keyword name="Editor.joinLines" id="Editor.joinLines" ref="eric7.QScintilla.Editor.html#Editor.joinLines" /> @@ -4669,6 +4670,7 @@ <keyword name="Editor.removeCompletionListHook" id="Editor.removeCompletionListHook" ref="eric7.QScintilla.Editor.html#Editor.removeCompletionListHook" /> <keyword name="Editor.removeMouseClickHandler" id="Editor.removeMouseClickHandler" ref="eric7.QScintilla.Editor.html#Editor.removeMouseClickHandler" /> <keyword name="Editor.removeMouseClickHandlers" id="Editor.removeMouseClickHandlers" ref="eric7.QScintilla.Editor.html#Editor.removeMouseClickHandlers" /> + <keyword name="Editor.resetOnlineChangeTraceInfo" id="Editor.resetOnlineChangeTraceInfo" ref="eric7.QScintilla.Editor.html#Editor.resetOnlineChangeTraceInfo" /> <keyword name="Editor.resizeEvent" id="Editor.resizeEvent" ref="eric7.QScintilla.Editor.html#Editor.resizeEvent" /> <keyword name="Editor.revertToUnmodified" id="Editor.revertToUnmodified" ref="eric7.QScintilla.Editor.html#Editor.revertToUnmodified" /> <keyword name="Editor.saveFile" id="Editor.saveFile" ref="eric7.QScintilla.Editor.html#Editor.saveFile" />
--- a/src/eric7/Documentation/Source/eric7.QScintilla.Editor.html Sat Feb 25 19:18:43 2023 +0100 +++ b/src/eric7/Documentation/Source/eric7.QScintilla.Editor.html Sat Feb 25 19:47:23 2023 +0100 @@ -683,10 +683,6 @@ <td>Private method used to reset the language selection.</td> </tr> <tr> -<td><a href="#Editor.__resetOnlineChangeTraceInfo">__resetOnlineChangeTraceInfo</a></td> -<td>Private slot to reset the online change trace info.</td> -</tr> -<tr> <td><a href="#Editor.__resetOnlineChangeTraceTimer">__resetOnlineChangeTraceTimer</a></td> <td>Private method to reset the online syntax check timer.</td> </tr> @@ -1375,6 +1371,10 @@ <td>Public method to return a flag indicating a Cython file.</td> </tr> <tr> +<td><a href="#Editor.isDeviceFile">isDeviceFile</a></td> +<td>Public method to check, if the editor contains a MCU device file.</td> +</tr> +<tr> <td><a href="#Editor.isJavascriptFile">isJavascriptFile</a></td> <td>Public method to return a flag indicating a Javascript file.</td> </tr> @@ -1399,6 +1399,10 @@ <td>Public method to return a flag indicating a Python (2 or 3) file.</td> </tr> <tr> +<td><a href="#Editor.isRemoteFile">isRemoteFile</a></td> +<td>Public method to check, if the editor contains a remote file.</td> +</tr> +<tr> <td><a href="#Editor.isRubyFile">isRubyFile</a></td> <td>Public method to return a flag indicating a Ruby file.</td> </tr> @@ -1583,6 +1587,10 @@ <td>Public method to un-registered all mouse click handlers of a plug-in.</td> </tr> <tr> +<td><a href="#Editor.resetOnlineChangeTraceInfo">resetOnlineChangeTraceInfo</a></td> +<td>Public slot to reset the online change trace info.</td> +</tr> +<tr> <td><a href="#Editor.resizeEvent">resizeEvent</a></td> <td>Protected method handling resize events.</td> </tr> @@ -3588,13 +3596,6 @@ flag indicating to propagate the change (boolean) </dd> </dl> -<a NAME="Editor.__resetOnlineChangeTraceInfo" ID="Editor.__resetOnlineChangeTraceInfo"></a> -<h4>Editor.__resetOnlineChangeTraceInfo</h4> -<b>__resetOnlineChangeTraceInfo</b>(<i></i>) - -<p> - Private slot to reset the online change trace info. -</p> <a NAME="Editor.__resetOnlineChangeTraceTimer" ID="Editor.__resetOnlineChangeTraceTimer"></a> <h4>Editor.__resetOnlineChangeTraceTimer</h4> <b>__resetOnlineChangeTraceTimer</b>(<i></i>) @@ -5879,6 +5880,25 @@ bool </dd> </dl> +<a NAME="Editor.isDeviceFile" ID="Editor.isDeviceFile"></a> +<h4>Editor.isDeviceFile</h4> +<b>isDeviceFile</b>(<i></i>) + +<p> + Public method to check, if the editor contains a MCU device file. +</p> +<dl> +<dt>Return:</dt> +<dd> +flag indicating a MCU device file +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> <a NAME="Editor.isJavascriptFile" ID="Editor.isJavascriptFile"></a> <h4>Editor.isJavascriptFile</h4> <b>isJavascriptFile</b>(<i></i>) @@ -5969,6 +5989,25 @@ flag indicating a Python3 file (boolean) </dd> </dl> +<a NAME="Editor.isRemoteFile" ID="Editor.isRemoteFile"></a> +<h4>Editor.isRemoteFile</h4> +<b>isRemoteFile</b>(<i></i>) + +<p> + Public method to check, if the editor contains a remote file. +</p> +<dl> +<dt>Return:</dt> +<dd> +flag indicating a remote file +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> <a NAME="Editor.isRubyFile" ID="Editor.isRubyFile"></a> <h4>Editor.isRubyFile</h4> <b>isRubyFile</b>(<i></i>) @@ -6447,6 +6486,13 @@ name of the plug-in </dd> </dl> +<a NAME="Editor.resetOnlineChangeTraceInfo" ID="Editor.resetOnlineChangeTraceInfo"></a> +<h4>Editor.resetOnlineChangeTraceInfo</h4> +<b>resetOnlineChangeTraceInfo</b>(<i></i>) + +<p> + Public slot to reset the online change trace info. +</p> <a NAME="Editor.resizeEvent" ID="Editor.resizeEvent"></a> <h4>Editor.resizeEvent</h4> <b>resizeEvent</b>(<i>evt</i>)
--- a/src/eric7/MicroPython/Devices/DeviceBase.py Sat Feb 25 19:18:43 2023 +0100 +++ b/src/eric7/MicroPython/Devices/DeviceBase.py Sat Feb 25 19:47:23 2023 +0100 @@ -1020,26 +1020,26 @@ except AttributeError: res['flash_info_available'] = False -import binascii as __ba_ try: import machine as __mc_ if isinstance(__mc_.freq(), tuple): res['mc_frequency_mhz'] = __mc_.freq()[0] / 1000000.0 else: res['mc_frequency_mhz'] = __mc_.freq() / 1000000.0 - res['mc_id'] = __ba_.hexlify(__mc_.unique_id(), ':').decode().upper() + res['mc_id'] = __mc_.unique_id() del __mc_ except ImportError: try: import microcontroller as __mc_ res['mc_frequency_mhz'] = __mc_.cpu.frequency / 1000000.0 res['mc_temp_c'] = __mc_.cpu.temperature - res['mc_id'] = __ba_.hexlify(__mc_.cpu.uid, ':').decode().upper() + res['mc_id'] = __mc_.cpu.uid del __mc_ except ImportError: res['mc_frequency'] = None res['mc_temp'] = None -del __ba_ +if 'mc_id' in res: + res['mc_id'] = ':'.join('{0:02X}'.format(x) for x in res['mc_id']) try: import ulab as __ulab_
--- a/src/eric7/MicroPython/MicroPythonFileManagerWidget.py Sat Feb 25 19:18:43 2023 +0100 +++ b/src/eric7/MicroPython/MicroPythonFileManagerWidget.py Sat Feb 25 19:47:23 2023 +0100 @@ -781,6 +781,7 @@ self.__fileManager.putData(filename, text.encode("utf-8")) aw.setModified(False) + aw.resetOnlineChangeTraceInfo() @pyqtSlot() def on_saveAsButton_clicked(self):
--- a/src/eric7/QScintilla/Editor.py Sat Feb 25 19:18:43 2023 +0100 +++ b/src/eric7/QScintilla/Editor.py Sat Feb 25 19:47:23 2023 +0100 @@ -636,6 +636,24 @@ """ return not self.fileName.startswith(("device:", "remote:")) + def isDeviceFile(self): + """ + Public method to check, if the editor contains a MCU device file. + + @return flag indicating a MCU device file + @rtype bool + """ + return self.fileName.startswith("device:") + + def isRemoteFile(self): + """ + Public method to check, if the editor contains a remote file. + + @return flag indicating a remote file + @rtype bool + """ + return self.fileName.startswith("remote:") + def __registerImages(self): """ Private method to register images for autocompletion lists. @@ -3090,9 +3108,9 @@ self.changeMarkersUpdated.emit(self) self.__markerMap.update() - def __resetOnlineChangeTraceInfo(self): - """ - Private slot to reset the online change trace info. + def resetOnlineChangeTraceInfo(self): + """ + Public slot to reset the online change trace info. """ self.__lastSavedText = self.text() self.__deleteAllChangeMarkers() @@ -3512,6 +3530,7 @@ """ if not saveas and (not self.isModified() or not self.isLocalFile()): # do nothing if text wasn't changed or is not a local file + # TODO: write the file back to the MCU if isDeviceFile() return False newName = None @@ -3569,7 +3588,7 @@ self.editorSaved.emit(self.fileName) self.checkSyntax() self.extractTasks() - self.__resetOnlineChangeTraceInfo() + self.resetOnlineChangeTraceInfo() self.__checkEncoding() return True else: