src/eric7/Preferences/ConfigurationDialog.py

branch
eric7
changeset 10518
1682f3203ae5
parent 10439
21c28b0f9e41
child 10531
3308e8349e4c
child 10683
779cda568acb
--- a/src/eric7/Preferences/ConfigurationDialog.py	Sun Jan 21 13:00:42 2024 +0100
+++ b/src/eric7/Preferences/ConfigurationDialog.py	Sun Jan 21 15:38:51 2024 +0100
@@ -90,6 +90,7 @@
     PDFVIEWERMODE = 5
     PIPMANAGERMODE = 6
     SHELLMODE = 7
+    MICROPYTHONMODE = 8
 
 
 class ConfigurationWidget(QWidget):
@@ -527,7 +528,13 @@
                     "1editorMouseClickHandlers",
                     None,
                 ],
-                "0helpPage": [self.tr("Help"), "preferences-help", None, None, None],
+                "0helpPage": [
+                    self.tr("Help"),
+                    "preferences-help",
+                    None,
+                    None,
+                    None,
+                ],
                 "helpDocumentationPage": [
                     self.tr("Help Documentation"),
                     "preferences-helpdocumentation",
@@ -933,6 +940,13 @@
                     None,
                     None,
                 ],
+                "networkProxyPage": [
+                    self.tr("Network Proxy"),
+                    "preferences-network",
+                    "NetworkProxyPage",
+                    None,
+                    None,
+                ],
                 "pipPage": [
                     self.tr("Python Package Management"),
                     "pypi",
@@ -1050,6 +1064,44 @@
                 ],
             }
 
+        elif displayMode == ConfigurationMode.MICROPYTHONMODE:
+            self.configItems = {
+                # key : [display string, pixmap name, dialog module name or
+                #        page creation function, parent key,
+                #        reference to configuration page (must always be last)]
+                # The dialog module must have the module function 'create' to
+                # create the configuration page. This must have the method
+                # 'save' to save the settings.
+                "iconsPage": [
+                    self.tr("Icons"),
+                    "preferences-icons",
+                    "IconsPage",
+                    None,
+                    None,
+                ],
+                "interfacePage": [
+                    self.tr("Interface"),
+                    "preferences-interface",
+                    self.__createInterfaceLightPageWithSidebars,
+                    None,
+                    None,
+                ],
+                "microPythonPage": [
+                    self.tr("MicroPython"),
+                    "micropython",
+                    "MicroPythonPage",
+                    None,
+                    None,
+                ],
+                "networkProxyPage": [
+                    self.tr("Network Proxy"),
+                    "preferences-network",
+                    "NetworkProxyPage",
+                    None,
+                    None,
+                ],
+            }
+
         else:
             # display mode for generic use
             self.configItems = {
@@ -1352,7 +1404,10 @@
         @rtype ConfigurationPageBase
         """
         page = None
-        if isinstance(pageData[2], types.FunctionType):
+        if isinstance(
+            pageData[2],
+            (types.FunctionType, types.LambdaType, types.MethodType),
+        ):
             page = pageData[2](self)
         else:
             mod = self.__importConfigurationPage(pageData[2])
@@ -1422,6 +1477,20 @@
 
         self.__currentConfigurationPageName = pageName
 
+    def __createInterfaceLightPageWithSidebars(self, configDlg):  # noqa: U100
+        """
+        Private method to create the interface configuration page in light mode.
+
+        @param configDlg reference to the configuration dialog
+        @type ConfigurationWidget
+        @return reference to the configuration page
+        @rtype InterfaceLightPage
+        """
+        from .ConfigurationPages import InterfaceLightPage
+
+        page = InterfaceLightPage.create(self, withSidebars=True)
+        return page
+
     def resizeEvent(self, evt):
         """
         Protected method to handle the resizing of the widget.

eric ide

mercurial