27 """ |
27 """ |
28 super().__init__(parent) |
28 super().__init__(parent) |
29 |
29 |
30 self.defaultStyleName = QApplication.style().objectName() |
30 self.defaultStyleName = QApplication.style().objectName() |
31 |
31 |
32 def setStyle(self, styleName, styleSheetFile): |
32 def setStyle(self, styleName, styleSheetFile, itemClickBehavior="default"): |
33 """ |
33 """ |
34 Public method to set the style of the interface. |
34 Public method to set the style of the interface. |
35 |
35 |
36 @param styleName name of the style to set |
36 @param styleName name of the style to set |
37 @type str |
37 @type str |
38 @param styleSheetFile name of a style sheet file to read to overwrite |
38 @param styleSheetFile name of a style sheet file to read to overwrite |
39 defaults of the given style |
39 defaults of the given style |
40 @type str |
40 @type str |
|
41 @param itemClickBehavior string describing the item activation behavior (one of |
|
42 "default", "doubleclick" or "singleclick") (defaults to "default") |
|
43 @type str (optional) |
41 """ |
44 """ |
42 # step 1: set the style |
45 # step 1: set the style |
43 style = None |
46 style = None |
44 if styleName != "System" and styleName in QStyleFactory.keys(): # noqa: Y118 |
47 if styleName != "System" and styleName in QStyleFactory.keys(): # noqa: Y118 |
45 style = QStyleFactory.create(styleName) |
48 style = QStyleFactory.create(styleName) |
46 if style is None: |
49 if style is None: |
47 style = QStyleFactory.create(self.defaultStyleName) |
50 style = QStyleFactory.create(self.defaultStyleName) |
48 |
51 |
49 if style is None: |
52 QApplication.setStyle( |
50 QApplication.setStyle(EricProxyStyle()) |
53 EricProxyStyle(style=style, itemClickBehavior=itemClickBehavior) |
51 else: |
54 ) |
52 QApplication.setStyle(EricProxyStyle(style)) |
|
53 |
55 |
54 # step 2: set a style sheet |
56 # step 2: set a style sheet |
55 ericApp().setStyleSheetFile(styleSheetFile) |
57 ericApp().setStyleSheetFile(styleSheetFile) |