|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2010 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the tray starter configuration page. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
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(TrayStarterPage, self).__init__() |
|
28 self.setupUi(self) |
|
29 self.setObjectName("TrayStarterPage") |
|
30 |
|
31 self.standardButton.setIcon(UI.PixmapCache.getIcon("erict.png")) |
|
32 self.highContrastButton.setIcon(UI.PixmapCache.getIcon("erict-hc.png")) |
|
33 self.blackWhiteButton.setIcon(UI.PixmapCache.getIcon("erict-bw.png")) |
|
34 self.blackWhiteInverseButton.setIcon( |
|
35 UI.PixmapCache.getIcon("erict-bwi.png")) |
|
36 |
|
37 # set initial values |
|
38 iconName = Preferences.getTrayStarter("TrayStarterIcon") |
|
39 if iconName == "erict.png": |
|
40 self.standardButton.setChecked(True) |
|
41 elif iconName == "erict-hc.png": |
|
42 self.highContrastButton.setChecked(True) |
|
43 elif iconName == "erict-bw.png": |
|
44 self.blackWhiteButton.setChecked(True) |
|
45 elif iconName == "erict-bwi.png": |
|
46 self.blackWhiteInverseButton.setChecked(True) |
|
47 |
|
48 def save(self): |
|
49 """ |
|
50 Public slot to save the Python configuration. |
|
51 """ |
|
52 if self.standardButton.isChecked(): |
|
53 iconName = "erict.png" |
|
54 elif self.highContrastButton.isChecked(): |
|
55 iconName = "erict-hc.png" |
|
56 elif self.blackWhiteButton.isChecked(): |
|
57 iconName = "erict-bw.png" |
|
58 elif self.blackWhiteInverseButton.isChecked(): |
|
59 iconName = "erict-bwi.png" |
|
60 Preferences.setTrayStarter("TrayStarterIcon", iconName) |
|
61 |
|
62 |
|
63 def create(dlg): |
|
64 """ |
|
65 Module function to create the configuration page. |
|
66 |
|
67 @param dlg reference to the configuration dialog |
|
68 @return reference to the instantiated page (ConfigurationPageBase) |
|
69 """ |
|
70 page = TrayStarterPage() |
|
71 return page |