Skip to content

Commit b00b3dd

Browse files
committed
gracefully handle failure to send notification, add hidden plyer import for pyinstaller
1 parent 701068c commit b00b3dd

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.github/workflows/gui.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ hiddenimports += collect_submodules('crcmod')
77
hiddenimports += collect_submodules('scapy')
88
hiddenimports += collect_submodules('pyserial')
99
hiddenimports += collect_submodules('pyusb')
10+
hiddenimports += collect_submodules('plyer')
1011
#hiddenimports += collect_submodules('about-time')
1112
#hiddenimports += collect_submodules('grapheme')
1213
#hiddenimports += collect_submodules('alive_progress')

_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.0.85'
1+
__version__ = '1.0.86'

gui.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ def click_handler (self, callback):
206206
worker.signals.error.connect(self.handle_exception)
207207
self.thread_manager.start(worker)
208208

209+
def send_notification (self, title: str, body: str) -> None:
210+
try:
211+
notification.notify(title=title, message=body)
212+
except Exception as e:
213+
print('[.] Non-critical: Exception while trying to send a notification: {}'.format(str(e)))
214+
209215
def handler_select_file_reading (self):
210216
filename = QFileDialog().getSaveFileName()[0]
211217
self.readingFileInput.setText(filename)
@@ -414,7 +420,7 @@ def gui_read_eeprom (self, ecu: ECU, address_start: int = 0x000000, address_stop
414420
log_callback.emit('[*] saved to {}'.format(home + "/" + output_filename))
415421

416422
log_callback.emit('[*] Done!')
417-
notification.notify(title='Reading finished', message='Saved to {}'.format(home + "\\" + output_filename))
423+
self.send_notification('Reading finished', 'Saved to {}'.format(home + "\\" + output_filename))
418424

419425
def gui_flash_eeprom (self, ecu: ECU, input_filename: str, flash_calibration: bool = True, flash_program: bool = True, log_callback=None, progress_callback=None):
420426
log_callback.emit('[*] Loading up {}'.format(input_filename))
@@ -480,7 +486,7 @@ def gui_flash_eeprom (self, ecu: ECU, input_filename: str, flash_calibration: bo
480486
progress_callback(100, 100)
481487
log_callback.emit('[*] ecu reset')
482488
log_callback.emit('[*] Done!')
483-
notification.notify(title='Flashing finished', message='Turn off your ignition for 10 seconds')
489+
self.send_notification('Flashing finished', 'Turn off your ignition for 10 seconds')
484490

485491
ecu.bus.transport.hardware.set_timeout(0.5)
486492
try:

0 commit comments

Comments
 (0)