Skip to content

Commit 82c726e

Browse files
authored
Merge pull request #8 from poly000/led-rgb-functioanlity-warn
2 parents a979771 + 7900cb3 commit 82c726e

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

awelc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
def init_device():
2121
# So that we don't get an USB device busy error
2222
device = usb.core.find(idVendor=0x187c, idProduct=0x0550)
23+
if not device:
24+
raise Exception('no such device was found. Do you have a RGB keyboard 187c:0550?')
25+
2326
ep = device[0].interfaces()[0].endpoints()[0]
2427
i = device[0].interfaces()[0].bInterfaceNumber
2528
device.reset()

main.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def init_acpi_call(self):
8787
self.is_root = (self.shell_exec("whoami")[1].find("root") != -1)
8888
if not self.is_root:
8989
print("Bash shell is NOT root. Disabling ACPI methods...")
90-
popup = QMessageBox.information(self,"Warning","No root access. Power related functions will not work, and will not be displayed.")
90+
popup = QMessageBox.warning(self,"Warning","No root access. Power related functions will not work, and will not be displayed.")
9191
return
9292

9393
print("Sh shell is root. Enabling ACPI methods...")
@@ -265,15 +265,19 @@ def combobox_choice(self):
265265
self.settings.setValue("Action", self.combobox_mode.currentText())
266266

267267
def apply_leds(self):
268-
if self.settings.value("Action", "Static Color") == "Static Color":
269-
self.apply_static()
270-
elif self.settings.value("Action", "Static Color") == "Morph":
271-
self.apply_morph()
272-
elif self.settings.value("Action", "Static Color") == "Color and Morph":
273-
self.apply_color_and_morph()
274-
else: #Off
275-
self.remove_animation()
276-
268+
try:
269+
if self.settings.value("Action", "Static Color") == "Static Color":
270+
self.apply_static()
271+
elif self.settings.value("Action", "Static Color") == "Morph":
272+
self.apply_morph()
273+
elif self.settings.value("Action", "Static Color") == "Color and Morph":
274+
self.apply_color_and_morph()
275+
else: #Off
276+
self.remove_animation()
277+
except Exception as err:
278+
QMessageBox.warning(self,"Error",f"Cannot apply LED settings:\n\n{err.__class__.__name__}: {err}")
279+
raise err
280+
277281
def combobox_power(self):
278282
self.fan1_boost.setValue(0)
279283
self.fan2_boost.setValue(0)

0 commit comments

Comments
 (0)