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