Changed some code to let the editor determine the highlighter language for files loaded from a connected µPy device. eric7

Thu, 16 Mar 2023 09:20:00 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 16 Mar 2023 09:20:00 +0100
branch
eric7
changeset 9905
189b7a23c3c6
parent 9904
5d9a7d1afbd9
child 9906
39daf45010c8

Changed some code to let the editor determine the highlighter language for files loaded from a connected µPy device.

src/eric7/MicroPython/MicroPythonFileManagerWidget.py file | annotate | diff | comparison | revisions
src/eric7/SystemUtilities/PythonUtilities.py file | annotate | diff | comparison | revisions
--- a/src/eric7/MicroPython/MicroPythonFileManagerWidget.py	Wed Mar 15 18:01:11 2023 +0100
+++ b/src/eric7/MicroPython/MicroPythonFileManagerWidget.py	Thu Mar 16 09:20:00 2023 +0100
@@ -399,7 +399,7 @@
                 data = self.__fileManager.getData(name)
                 text = data.decode(encoding="utf-8")
                 ericApp().getObject("ViewManager").newEditorWithText(
-                    text, "Python3", "device:{0}".format(name)
+                    text, fileName="device:{0}".format(name)
                 )
 
     @pyqtSlot()
--- a/src/eric7/SystemUtilities/PythonUtilities.py	Wed Mar 15 18:01:11 2023 +0100
+++ b/src/eric7/SystemUtilities/PythonUtilities.py	Thu Mar 16 09:20:00 2023 +0100
@@ -94,7 +94,7 @@
 
     pyVer = 0
     if filename:
-        if not source:
+        if not source and os.path.exists(filename):
             source = Utilities.readEncodedFile(filename)[0]
         flags = Utilities.extractFlags(source)
         ext = os.path.splitext(filename)[1]

eric ide

mercurial