Corrected the style sheet path replacement function to use a path with forward slashes (i.e. non-native on Windows platforms). eric7

Wed, 29 Dec 2021 19:40:16 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 29 Dec 2021 19:40:16 +0100
branch
eric7
changeset 8880
4b631598f752
parent 8879
159a4d6bab47
child 8881
54e42bc2437a

Corrected the style sheet path replacement function to use a path with forward slashes (i.e. non-native on Windows platforms).

eric7/EricWidgets/EricApplication.py file | annotate | diff | comparison | revisions
eric7/UI/Previewers/PreviewerQSS.py file | annotate | diff | comparison | revisions
--- a/eric7/EricWidgets/EricApplication.py	Wed Dec 29 17:54:06 2021 +0100
+++ b/eric7/EricWidgets/EricApplication.py	Wed Dec 29 19:40:16 2021 +0100
@@ -180,14 +180,18 @@
         
         return self.__pluginObjectRegistry[name][1]
     
-    def getStyleIconsPath(self):
+    def getStyleIconsPath(self, universal=False):
         """
         Public method to get the path for the style icons.
         
+        @param universal flag indicating a universal file path (defaults to
+            False)
+        @type bool (optional)
         @return directory path containing the style icons
         @rtype str
         """
         import Preferences
+        import Utilities
         from eric7config import getConfig
         
         styleIconsPath = Preferences.getUI("StyleIconsPath")
@@ -197,7 +201,10 @@
             styleIconsPath = os.path.join(
                 getConfig('ericIconDir'), "StyleIcons")
         
-        return styleIconsPath
+        if universal:
+            return Utilities.fromNativeSeparators(styleIconsPath)
+        else:
+            return styleIconsPath
     
     def setStyleSheetFile(self, filename):
         """
@@ -226,9 +233,9 @@
             styleSheet = ""
         
         if styleSheet:
-            # preprocess the style sheet to replace the placeholder for the
+            # pre-process the style sheet to replace the placeholder for the
             # path to the icons
-            styleIconsPath = self.getStyleIconsPath()
+            styleIconsPath = self.getStyleIconsPath(universal=True)
             styleSheet = styleSheet.replace("${path}", styleIconsPath)
         
         if "QPalette {" in styleSheet:
--- a/eric7/UI/Previewers/PreviewerQSS.py	Wed Dec 29 17:54:06 2021 +0100
+++ b/eric7/UI/Previewers/PreviewerQSS.py	Wed Dec 29 19:40:16 2021 +0100
@@ -20,6 +20,7 @@
 from .Ui_PreviewerQSS import Ui_PreviewerQSS
 
 import Preferences
+import Utilities
 import UI.PixmapCache
 
 from eric7config import getConfig
@@ -123,7 +124,9 @@
                             # icons directory
                             styleIconsPath = os.path.join(
                                 getConfig('ericIconDir'), "StyleIcons")
-                        
+                    
+                    styleIconsPath =  Utilities.fromNativeSeparators(
+                        styleIconsPath)
                     styleSheet = styleSheet.replace("${path}", styleIconsPath)
                     self.scrollAreaWidgetContents.setStyleSheet(styleSheet)
                 else:

eric ide

mercurial