Sat, 26 Apr 2025 12:34:32 +0200
MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.
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 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
3 | # Copyright (c) 2010 - 2025 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 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
12 | from eric7 import Preferences |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
13 | from eric7.EricGui import EricPixmapCache |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
14 | |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | 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
|
16 | 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
|
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 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
23 | |
6380
4a932a7ab987
Configuration pages: corrected the constructor of some configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
24 | 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
|
25 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | Constructor |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
28 | super().__init__() |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | 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
|
30 | self.setObjectName("TrayStarterPage") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
31 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
32 | self.standardButton.setIcon(EricPixmapCache.getIcon("erict")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
33 | self.highContrastButton.setIcon(EricPixmapCache.getIcon("erict-hc")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
34 | self.blackWhiteButton.setIcon(EricPixmapCache.getIcon("erict-bw")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
35 | self.blackWhiteInverseButton.setIcon(EricPixmapCache.getIcon("erict-bwi")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
36 | |
701
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 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
38 | iconName = os.path.splitext(Preferences.getTrayStarter("TrayStarterIcon"))[0] |
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
|
39 | 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
|
40 | 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
|
41 | 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
|
42 | 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
|
43 | 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
|
44 | 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
|
45 | 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
|
46 | self.blackWhiteInverseButton.setChecked(True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
47 | |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | 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
|
49 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | 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
|
51 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | 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
|
53 | 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
|
54 | 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
|
55 | 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
|
56 | 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
|
57 | 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
|
58 | 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
|
59 | 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
|
60 | Preferences.setTrayStarter("TrayStarterIcon", iconName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
61 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
62 | |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
63 | def create(_dlg): |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | Module function to create the configuration page. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
66 | |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
67 | @param _dlg reference to the configuration dialog (unused) |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
68 | @type ConfigurationDialog |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
69 | @return reference to the instantiated page |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
70 | @rtype ConfigurationPageBase |
701
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | """ |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | page = TrayStarterPage() |
fc587a1c2f8b
Added an option to configure the icon of the tray starter application.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | return page |