MicroPython: added more MicroPython type related handling.

Thu, 29 Aug 2019 19:00:33 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 29 Aug 2019 19:00:33 +0200
changeset 7178
43e994af5ee0
parent 7177
29e9027f28c0
child 7179
912bc70b5b01

MicroPython: added more MicroPython type related handling.

eric6/Plugins/PluginCodeStyleChecker.py file | annotate | diff | comparison | revisions
eric6/Plugins/PluginEricapi.py file | annotate | diff | comparison | revisions
eric6/Plugins/PluginEricdoc.py file | annotate | diff | comparison | revisions
eric6/Plugins/PluginTabnanny.py file | annotate | diff | comparison | revisions
eric6/Project/Project.py file | annotate | diff | comparison | revisions
eric6/Project/ProjectBrowser.py file | annotate | diff | comparison | revisions
eric6/QScintilla/Editor.py file | annotate | diff | comparison | revisions
eric6/QScintilla/MiniEditor.py file | annotate | diff | comparison | revisions
eric6/QScintilla/TypingCompleters/__init__.py file | annotate | diff | comparison | revisions
scripts/install.py file | annotate | diff | comparison | revisions
--- a/eric6/Plugins/PluginCodeStyleChecker.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/Plugins/PluginCodeStyleChecker.py	Thu Aug 29 19:00:33 2019 +0200
@@ -335,7 +335,7 @@
         if menuName == "Checks" and self.__projectAct is not None:
             self.__projectAct.setEnabled(
                 e5App().getObject("Project").getProjectLanguage() in
-                ["Python3", "Python2", "Python"])
+                ["Python3", "Python2", "Python", "MicroPython"])
     
     def __projectBrowserShowMenu(self, menuName, menu):
         """
@@ -347,7 +347,7 @@
         """
         if menuName == "Checks" and \
            e5App().getObject("Project").getProjectLanguage() in \
-                ["Python3", "Python2", "Python"]:
+                ["Python3", "Python2", "Python", "MicroPython"]:
             self.__projectBrowserMenu = menu
             if self.__projectBrowserAct is None:
                 self.__projectBrowserAct = E5Action(
--- a/eric6/Plugins/PluginEricapi.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/Plugins/PluginEricapi.py	Thu Aug 29 19:00:33 2019 +0200
@@ -143,7 +143,7 @@
             if self.__projectAct is not None:
                 self.__projectAct.setEnabled(
                     e5App().getObject("Project").getProjectLanguage() in
-                    ["Python", "Python2", "Python3", "Ruby"])
+                    ["Python", "Python2", "Python3", "Ruby", "MicroPython"])
     
     def __doEricapi(self):
         """
--- a/eric6/Plugins/PluginEricdoc.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/Plugins/PluginEricdoc.py	Thu Aug 29 19:00:33 2019 +0200
@@ -186,7 +186,7 @@
             if self.__projectAct is not None:
                 self.__projectAct.setEnabled(
                     e5App().getObject("Project").getProjectLanguage() in
-                    ["Python", "Python2", "Python3", "Ruby"])
+                    ["Python", "Python2", "Python3", "Ruby", "MicroPython"])
     
     def __doEricdoc(self):
         """
--- a/eric6/Plugins/PluginTabnanny.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/Plugins/PluginTabnanny.py	Thu Aug 29 19:00:33 2019 +0200
@@ -292,7 +292,7 @@
         if menuName == "Checks" and self.__projectAct is not None:
             self.__projectAct.setEnabled(
                 e5App().getObject("Project").getProjectLanguage() in
-                ["Python3", "Python2", "Python"])
+                ["Python3", "Python2", "Python", "MicroPython"])
     
     def __projectBrowserShowMenu(self, menuName, menu):
         """
@@ -304,7 +304,7 @@
         """
         if menuName == "Checks" and \
            e5App().getObject("Project").getProjectLanguage() in \
-                ["Python3", "Python2", "Python"]:
+                ["Python3", "Python2", "Python", "MicroPython"]:
             self.__projectBrowserMenu = menu
             if self.__projectBrowserAct is None:
                 self.__projectBrowserAct = E5Action(
--- a/eric6/Project/Project.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/Project/Project.py	Thu Aug 29 19:00:33 2019 +0200
@@ -2688,7 +2688,7 @@
                         self.projectLanguageAdded.emit(qm)
             if not self.pdata["MAINSCRIPT"] and bool(mainscriptname):
                 if self.pdata["PROGLANGUAGE"] in \
-                        ["Python", "Python2", "Python3"]:
+                        ["Python", "Python2", "Python3", "MicroPython"]:
                     self.pdata["MAINSCRIPT"] = '{0}.py'.format(mainscriptname)
                 elif self.pdata["PROGLANGUAGE"] == "Ruby":
                     self.pdata["MAINSCRIPT"] = '{0}.rb'.format(mainscriptname)
--- a/eric6/Project/ProjectBrowser.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/Project/ProjectBrowser.py	Thu Aug 29 19:00:33 2019 +0200
@@ -288,6 +288,8 @@
                     icon = UI.PixmapCache.getIcon("projectSourcesPyMixed.png")
                 else:
                     icon = UI.PixmapCache.getIcon("projectSourcesPy.png")
+            elif self.project.getProjectLanguage() == "MicroPython":
+                icon = UI.PixmapCache.getIcon("micropython")
             elif self.project.getProjectLanguage() == "Ruby":
                 if self.project.isMixedLanguageProject():
                     icon = UI.PixmapCache.getIcon("projectSourcesRbMixed.png")
--- a/eric6/QScintilla/Editor.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/QScintilla/Editor.py	Thu Aug 29 19:00:33 2019 +0200
@@ -622,7 +622,8 @@
             supportedLanguages = Lexers.getSupportedLanguages()
             if self.filetype in supportedLanguages:
                 bindName = supportedLanguages[self.filetype][1]
-            elif self.filetype in ["Python", "Python2", "Python3"]:
+            elif self.filetype in ["Python", "Python2", "Python3",
+                                   "MicroPython"]:
                 bindName = "dummy.py"
         
         if not bindName and line0.startswith("#!"):
--- a/eric6/QScintilla/MiniEditor.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/QScintilla/MiniEditor.py	Thu Aug 29 19:00:33 2019 +0200
@@ -3118,7 +3118,8 @@
             supportedLanguages = Lexers.getSupportedLanguages()
             if self.filetype in supportedLanguages:
                 bindName = supportedLanguages[self.filetype][1]
-            elif self.filetype in ["Python", "Python2", "Python3"]:
+            elif self.filetype in ["Python", "Python2", "Python3",
+                                   "MicroPython"]:
                 bindName = "dummy.py"
         
         if not bindName and line0.startswith("#!"):
--- a/eric6/QScintilla/TypingCompleters/__init__.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/eric6/QScintilla/TypingCompleters/__init__.py	Thu Aug 29 19:00:33 2019 +0200
@@ -21,7 +21,7 @@
     @return reference to the instanciated lexer object (QsciLexer)
     """
     try:
-        if language in ["Python", "Python2", "Python3"]:
+        if language in ["Python", "Python2", "Python3", "MicroPython"]:
             from .CompleterPython import CompleterPython
             return CompleterPython(editor, parent)
         elif language == "Ruby":
--- a/scripts/install.py	Thu Aug 29 18:59:54 2019 +0200
+++ b/scripts/install.py	Thu Aug 29 19:00:33 2019 +0200
@@ -974,6 +974,25 @@
                         except EnvironmentError:
                             print("Could not install '{0}' (no permission)."
                                   .format(apiName))
+                
+                # copy MicroPython API files to the same destination
+                for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs",
+                                                      "MicroPython", "*.api")):
+                    try:
+                        shutilCopy(apiName, apidir)
+                    except EnvironmentError:
+                        print("Could not install '{0}' (no permission)."
+                              .format(apiName))
+                for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs",
+                                                      "MicroPython", "*.bas")):
+                    if os.path.exists(os.path.join(
+                        apidir, os.path.basename(
+                            apiName.replace(".bas", ".api")))):
+                        try:
+                            shutilCopy(apiName, apidir)
+                        except EnvironmentError:
+                            print("Could not install '{0}' (no permission)."
+                                  .format(apiName))
     
     # Create menu entry for Linux systems
     if sys.platform.startswith("linux"):
@@ -1335,6 +1354,12 @@
                     glob.glob(os.path.join(eric6SourceDir, "APIs", "Python3",
                                            "*.api"))):
                     apis.append(os.path.basename(apiName))
+                
+                # treat MicroPython API files the same as Python API files
+                for apiName in sorted(
+                    glob.glob(os.path.join(eric6SourceDir, "APIs",
+                                           "MicroPython", "*.api"))):
+                    apis.append(os.path.basename(apiName))
     
     config = (
         """# -*- coding: utf-8 -*-\n"""

eric ide

mercurial