Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.

Commit de724d7

Browse files
committed
feat: Add version indicator to GUI window title, fix potential py type error
1 parent 7642a66 commit de724d7

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/usr/share/tuxedo-backlight-control/backlight.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,20 @@ def error_no_driver():
3838
exit(error_no_driver())
3939

4040
colorlist = list(BacklightControl.colors.keys())
41+
4142
if cmd == "ui":
4243
from ui import init
43-
4444
init()
4545
exit()
46-
elif cmd == "off":
46+
47+
if cmd == "off":
4748
backlight.state = 0
4849
exit()
4950

51+
if len(argv) == 2 and cmd in backlight.modes:
52+
backlight.state = 1
53+
backlight.mode = cmd
54+
5055
if len(argv) < 3:
5156
exit(error_missing_arg(cmd))
5257

@@ -61,9 +66,6 @@ def error_no_driver():
6166
exit(error_invalid_brightness(arg))
6267

6368
backlight.brightness = arg
64-
elif len(argv) == 2 and cmd in backlight.modes:
65-
backlight.state = 1
66-
backlight.mode = cmd
6769
elif len(argv) == 3 and cmd == "color" and arg in colorlist:
6870
backlight.state = 1
6971
backlight.set_single_color(arg)

src/usr/share/tuxedo-backlight-control/backlight_control.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def state(self):
111111
return 1
112112

113113
@state.setter
114-
def state(self, value):
115-
self.set_device_param('state', value)
114+
def state(self, value:int):
115+
self.set_device_param('state', str(value))
116116

117117
@property
118118
def mode(self):
@@ -122,9 +122,9 @@ def mode(self):
122122
return None
123123

124124
@mode.setter
125-
def mode(self, value):
125+
def mode(self, value:str):
126126
index = self.modes.index(value)
127-
self.set_device_param('mode', index)
127+
self.set_device_param('mode', str(index))
128128

129129
@property
130130
def color_left(self):

src/usr/share/tuxedo-backlight-control/ui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, parent):
1818
ttk.Frame.__init__(self, parent)
1919
self.init_ttk_style()
2020
self.parent = parent
21-
self.parent.title('Tuxedo Backlight Ctrl')
21+
self.parent.title('Tuxedo Backlight Ctrl v' + backlight.VERSION)
2222
self.parent.iconphoto(parent._w, tk.PhotoImage(file=self.ICONPATH))
2323
self.parent.resizable(width=False, height=False)
2424
self.parent.grid(widthInc=8, heightInc=8, baseHeight=5, baseWidth=40)
@@ -55,7 +55,7 @@ def __init__(self, parent):
5555
'color_extra': ttk.Label(self.bg_frame, text='Color extra: ')
5656
}
5757

58-
if backlight.state == 1:
58+
if backlight.state == 1 and not backlight.mode == None:
5959
initial_mode = backlight.mode.capitalize()
6060
else:
6161
initial_mode = 'Select...'

0 commit comments

Comments
 (0)