Changed the 'small-screen' related code. eric7

Thu, 28 Oct 2021 18:15:55 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 28 Oct 2021 18:15:55 +0200
branch
eric7
changeset 8729
226da2e26a84
parent 8728
62b44a7c0a3a
child 8736
cdea58e2d4d0

Changed the 'small-screen' related code.

eric7/EricWidgets/EricApplication.py file | annotate | diff | comparison | revisions
eric7/UI/UserInterface.py file | annotate | diff | comparison | revisions
eric7/eric7.py file | annotate | diff | comparison | revisions
--- a/eric7/EricWidgets/EricApplication.py	Wed Oct 27 20:03:03 2021 +0200
+++ b/eric7/EricWidgets/EricApplication.py	Thu Oct 28 18:15:55 2021 +0200
@@ -33,6 +33,27 @@
         
         self.__objectRegistry = {}
         self.__pluginObjectRegistry = {}
+        
+        self.__smallScreen = False
+        if "--small-screen" in argv:
+            self.__smallScreen = True
+            argv.remove("--small-screen")
+        if not self.__smallScreen:
+            primaryScreenSize = self.primaryScreen().size()
+            self.__smallScreen = (
+                primaryScreenSize.width() < 1920 or
+                primaryScreenSize.height() < 1080
+            )
+    
+    def usesSmallScreen(self):
+        """
+        Public method to determine, if the application is used on a small
+        screen.
+        
+        @return flag indicating the use of a small screen
+        @rtype bool
+        """
+        return self.__smallScreen
     
     def registerObject(self, name, objectRef):
         """
--- a/eric7/UI/UserInterface.py	Wed Oct 27 20:03:03 2021 +0200
+++ b/eric7/UI/UserInterface.py	Thu Oct 28 18:15:55 2021 +0200
@@ -169,7 +169,7 @@
     
     def __init__(self, app, locale, splash, plugin, disabledPlugins,
                  noOpenAtStartup, noCrashOpenAtStartup, disableCrashSession,
-                 smallScreen, restartArguments, originalPathString):
+                 restartArguments, originalPathString):
         """
         Constructor
         
@@ -194,9 +194,6 @@
         @param disableCrashSession flag indicating to disable the crash session
             support
         @type bool
-        @param smallScreen flag indicating to use the interface for small
-            screens (i.e. smaller than 1920 x 1080)
-        @type bool
         @param restartArguments list of command line parameters to be used for
             a restart
         @type list of str
@@ -219,12 +216,7 @@
         
         self.__originalPathString = originalPathString
         
-        primaryScreenSize = app.primaryScreen().size()
-        if (
-            smallScreen or
-            primaryScreenSize.width() < 1920 or
-            primaryScreenSize.height() < 1080
-        ):
+        if app.usesSmallScreen():
             # override settings for small screens
             Preferences.setUI("LayoutType", "Sidebars")
             Preferences.setUI("CombinedLeftRightSidebar", True)
--- a/eric7/eric7.py	Wed Oct 27 20:03:03 2021 +0200
+++ b/eric7/eric7.py	Thu Oct 28 18:15:55 2021 +0200
@@ -342,7 +342,6 @@
     nocrash = False
     disablecrash = False
     disabledPlugins = []
-    smallScreen = False
     if "--no-open" in sys.argv and sys.argv.index("--no-open") < ddindex:
         sys.argv.remove("--no-open")
         ddindex -= 1
@@ -358,10 +357,6 @@
         sys.argv.remove("--disable-crash")
         ddindex -= 1
         disablecrash = True
-    if "--small-screen" in sys.argv:
-        sys.argv.remove("--small-screen")
-        ddindex -= 1
-        smallScreen = True
     for arg in sys.argv[:]:
         if (
             arg.startswith("--disable-plugin=") and
@@ -408,8 +403,8 @@
     splash.showMessage(
         QCoreApplication.translate("eric7", "Generating Main Window..."))
     mainWindow = UserInterface(app, loc, splash, pluginFile, disabledPlugins,
-                               noopen, nocrash, disablecrash, smallScreen,
-                               restartArgs, originalPathString)
+                               noopen, nocrash, disablecrash, restartArgs,
+                               originalPathString)
     app.lastWindowClosed.connect(app.quit)
     mainWindow.show()
     

eric ide

mercurial