eric7/EricWidgets/EricMainWindow.py

branch
eric7
changeset 8843
586ee2c4553a
parent 8358
144a6b854f70
child 8881
54e42bc2437a
diff -r 80ce644a6067 -r 586ee2c4553a eric7/EricWidgets/EricMainWindow.py
--- a/eric7/EricWidgets/EricMainWindow.py	Sun Dec 19 19:38:18 2021 +0100
+++ b/eric7/EricWidgets/EricMainWindow.py	Mon Dec 20 14:51:29 2021 +0100
@@ -7,11 +7,9 @@
 Module implementing a main window class with styling support.
 """
 
-from PyQt6.QtCore import QCoreApplication
 from PyQt6.QtWidgets import QMainWindow, QStyleFactory, QApplication
 
 from .EricApplication import ericApp
-from . import EricMessageBox
 
 
 class EricMainWindow(QMainWindow):
@@ -22,7 +20,8 @@
         """
         Constructor
         
-        @param parent reference to the parent widget (QWidget)
+        @param parent reference to the parent widget
+        @type QWidget
         """
         super().__init__(parent)
         
@@ -32,9 +31,11 @@
         """
         Public method to set the style of the interface.
         
-        @param styleName name of the style to set (string)
+        @param styleName name of the style to set
+        @type str
         @param styleSheetFile name of a style sheet file to read to overwrite
-            defaults of the given style (string)
+            defaults of the given style
+        @type str
         """
         # step 1: set the style
         style = None
@@ -47,22 +48,4 @@
             QApplication.setStyle(style)
         
         # step 2: set a style sheet
-        if styleSheetFile:
-            try:
-                with open(styleSheetFile, "r", encoding="utf-8") as f:
-                    styleSheet = f.read()
-            except OSError as msg:
-                EricMessageBox.warning(
-                    self,
-                    QCoreApplication.translate(
-                        "EricMainWindow", "Loading Style Sheet"),
-                    QCoreApplication.translate(
-                        "EricMainWindow",
-                        """<p>The Qt Style Sheet file <b>{0}</b> could"""
-                        """ not be read.<br>Reason: {1}</p>""")
-                    .format(styleSheetFile, str(msg)))
-                return
-        else:
-            styleSheet = ""
-        
-        ericApp().setStyleSheet(styleSheet)
+        ericApp().setStyleSheetFile(styleSheetFile)

eric ide

mercurial