|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2010 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the tray starter configuration page. |
|
8 """ |
|
9 |
|
10 import os |
|
11 |
|
12 from .ConfigurationPageBase import ConfigurationPageBase |
|
13 from .Ui_TrayStarterPage import Ui_TrayStarterPage |
|
14 |
|
15 import Preferences |
|
16 import UI.PixmapCache |
|
17 |
|
18 |
|
19 class TrayStarterPage(ConfigurationPageBase, Ui_TrayStarterPage): |
|
20 """ |
|
21 Class implementing the tray starter configuration page. |
|
22 """ |
|
23 def __init__(self): |
|
24 """ |
|
25 Constructor |
|
26 """ |
|
27 super().__init__() |
|
28 self.setupUi(self) |
|
29 self.setObjectName("TrayStarterPage") |
|
30 |
|
31 self.standardButton.setIcon(UI.PixmapCache.getIcon("erict")) |
|
32 self.highContrastButton.setIcon(UI.PixmapCache.getIcon("erict-hc")) |
|
33 self.blackWhiteButton.setIcon(UI.PixmapCache.getIcon("erict-bw")) |
|
34 self.blackWhiteInverseButton.setIcon( |
|
35 UI.PixmapCache.getIcon("erict-bwi")) |
|
36 |
|
37 # set initial values |
|
38 iconName = os.path.splitext( |
|
39 Preferences.getTrayStarter("TrayStarterIcon"))[0] |
|
40 if iconName == "erict": |
|
41 self.standardButton.setChecked(True) |
|
42 elif iconName == "erict-hc": |
|
43 self.highContrastButton.setChecked(True) |
|
44 elif iconName == "erict-bw": |
|
45 self.blackWhiteButton.setChecked(True) |
|
46 elif iconName == "erict-bwi": |
|
47 self.blackWhiteInverseButton.setChecked(True) |
|
48 |
|
49 def save(self): |
|
50 """ |
|
51 Public slot to save the Python configuration. |
|
52 """ |
|
53 if self.standardButton.isChecked(): |
|
54 iconName = "erict" |
|
55 elif self.highContrastButton.isChecked(): |
|
56 iconName = "erict-hc" |
|
57 elif self.blackWhiteButton.isChecked(): |
|
58 iconName = "erict-bw" |
|
59 elif self.blackWhiteInverseButton.isChecked(): |
|
60 iconName = "erict-bwi" |
|
61 Preferences.setTrayStarter("TrayStarterIcon", iconName) |
|
62 |
|
63 |
|
64 def create(dlg): |
|
65 """ |
|
66 Module function to create the configuration page. |
|
67 |
|
68 @param dlg reference to the configuration dialog |
|
69 @return reference to the instantiated page (ConfigurationPageBase) |
|
70 """ |
|
71 page = TrayStarterPage() |
|
72 return page |