Wed, 30 Dec 2020 11:00:05 +0100
Updated copyright for 2021.
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
7923
91e843545d9a
Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
3 | # Copyright (c) 2010 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the tray starter configuration page. |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
10 | import os |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
11 | |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | from .ConfigurationPageBase import ConfigurationPageBase |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | from .Ui_TrayStarterPage import Ui_TrayStarterPage |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | import Preferences |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | import UI.PixmapCache |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
18 | |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | class TrayStarterPage(ConfigurationPageBase, Ui_TrayStarterPage): |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | Class implementing the tray starter configuration page. |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | """ |
6380
4a932a7ab987
Configuration pages: corrected the constructor of some configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
23 | def __init__(self): |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | Constructor |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | """ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
27 | super(TrayStarterPage, self).__init__() |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | self.setupUi(self) |
2907
108abcc64724
Moved the pyflakes config options to the editor syntax checker page and renamed it to editor code checkers page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
29 | self.setObjectName("TrayStarterPage") |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
31 | self.standardButton.setIcon(UI.PixmapCache.getIcon("erict")) |
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
32 | self.highContrastButton.setIcon(UI.PixmapCache.getIcon("erict-hc")) |
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
33 | self.blackWhiteButton.setIcon(UI.PixmapCache.getIcon("erict-bw")) |
3010
befeff46ec0f
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2964
diff
changeset
|
34 | self.blackWhiteInverseButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
35 | UI.PixmapCache.getIcon("erict-bwi")) |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | # set initial values |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
38 | iconName = os.path.splitext( |
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
39 | Preferences.getTrayStarter("TrayStarterIcon"))[0] |
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
40 | if iconName == "erict": |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | self.standardButton.setChecked(True) |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
42 | elif iconName == "erict-hc": |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | self.highContrastButton.setChecked(True) |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
44 | elif iconName == "erict-bw": |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | self.blackWhiteButton.setChecked(True) |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
46 | elif iconName == "erict-bwi": |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | self.blackWhiteInverseButton.setChecked(True) |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | def save(self): |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | Public slot to save the Python configuration. |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | if self.standardButton.isChecked(): |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
54 | iconName = "erict" |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | elif self.highContrastButton.isChecked(): |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
56 | iconName = "erict-hc" |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | elif self.blackWhiteButton.isChecked(): |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
58 | iconName = "erict-bw" |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | elif self.blackWhiteInverseButton.isChecked(): |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
60 | iconName = "erict-bwi" |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | Preferences.setTrayStarter("TrayStarterIcon", iconName) |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
63 | |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | def create(dlg): |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | Module function to create the configuration page. |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | @param dlg reference to the configuration dialog |
2964
84b65fb9e780
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2907
diff
changeset
|
69 | @return reference to the instantiated page (ConfigurationPageBase) |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | page = TrayStarterPage() |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | return page |