-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
4 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
File: buskill_cli.py | ||
Authors: Michael Altfield <[email protected]> | ||
Created: 2020-06-23 | ||
Updated: 2023-06-14 | ||
Updated: 2023-06-16 | ||
Version: 0.3 | ||
This is the code to handle the BusKill app via CLI | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
File: buskill_gui.py | ||
Authors: Michael Altfield <[email protected]> | ||
Created: 2020-06-23 | ||
Updated: 2023-06-14 | ||
Updated: 2023-06-16 | ||
Version: 0.4 | ||
This is the code to launch the BusKill GUI app | ||
|
@@ -105,9 +105,6 @@ def __init__(self, **kwargs): | |
# as soon as we've loaded | ||
Clock.schedule_once(self.handle_upgrades, 1) | ||
|
||
# TODO: remove auto-switch to Settings screen | ||
#Clock.schedule_once( lambda dt: self.switchToScreen('settings') ) | ||
|
||
super(MainWindow, self).__init__(**kwargs) | ||
|
||
def on_pre_enter( self, *args ): | ||
|
@@ -147,9 +144,7 @@ def toggle_buskill(self): | |
child.background_color = self.color_red | ||
|
||
# check for messages from the usb_handler child process | ||
# TODO: change this back to 0.01 after we're done debugging windows | ||
#Clock.schedule_interval( self.bk.check_usb_handler, 0.01 ) | ||
Clock.schedule_interval( self.bk.check_usb_handler, 4 ) | ||
Clock.schedule_interval( self.bk.check_usb_handler, 0.01 ) | ||
|
||
else: | ||
self.toggle_btn.text = 'Arm' | ||
|
@@ -166,15 +161,6 @@ def toggle_buskill(self): | |
# stop checking for messages from the usb_handler child process | ||
Clock.unschedule( self.bk.check_usb_handler ) | ||
|
||
# TODO: remove me after fixing bug https://github.com/BusKill/buskill-app/issues/73#issuecomment-1592195471 | ||
if self.bk.trigger == 'soft-shutdown': | ||
Clock.schedule_interval(self.check_root_child, 10) | ||
|
||
# TODO: remove me after fixing bug https://github.com/BusKill/buskill-app/issues/73#issuecomment-1592195471 | ||
def check_root_child(self, dt): | ||
msg = "DEBUG: bk.root_child:|" +str(self.bk.root_child)+ "|" | ||
print( msg ); logger.debug( msg ) | ||
|
||
def switchToScreen( self, screen ): | ||
self.manager.current = screen | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
Authors: Michael Altfield <[email protected]> | ||
Co-Auth: Steven Johnson <[email protected]> | ||
Created: 2020-06-23 | ||
Updated: 2023-06-14 | ||
Updated: 2023-06-16 | ||
Version: 0.5 | ||
This is the heart of the buskill app, shared by both the cli and gui | ||
|
@@ -136,16 +136,8 @@ class Notification: | |
|
||
def __init__( self, buskill ): | ||
|
||
# TODO: remove debugging lines when windows triggers are fixed | ||
msg = "DEBUG: instantiating Windows Notification object" | ||
print( msg ); logger.debug( msg ) | ||
|
||
self.bk = buskill | ||
|
||
# TODO: remove debugging lines when windows triggers are fixed | ||
msg = "DEBUG: \t self.bk.usb_hander_queue:|" +str(self.bk.usb_handler_queue)+ "|" | ||
print( msg ); logger.debug( msg ) | ||
|
||
message_map = { | ||
win32con.WM_DEVICECHANGE: self.hotplugCallbackWin | ||
} | ||
|
@@ -180,17 +172,12 @@ def hotplugCallbackWin(self, hwnd, message, wparam, lparam): | |
msg = "DEBUG: called hotplubCallbackWin()" | ||
print( msg ); logger.debug( msg ) | ||
|
||
# TODO: remove debugging lines when windows triggers are fixed | ||
msg = "DEBUG: \t self.bk.usb_hander_queue:|" +str(self.bk.usb_handler_queue)+ "|" | ||
print( msg ); logger.debug( msg ) | ||
|
||
dev_broadcast_hdr = DEV_BROADCAST_HDR.from_address(lparam) | ||
|
||
if wparam == DBT_DEVICEREMOVECOMPLETE: | ||
msg = "DEBUG: Determined USB hotplug event to be a removal" | ||
print( msg ); logger.debug( msg ) | ||
|
||
#self.bk.triggerWin() | ||
self.bk.usb_handler_queue.put( 'trigger' ) | ||
|
||
msg = "hwnd:|" +str(hwnd)+ "|" | ||
|
@@ -963,7 +950,6 @@ def toggle(self): | |
# launch an asynchronous child process that'll loop and listen for | ||
# usb events | ||
self.usb_handler = self.Process( | ||
# self.usb_handler = multiprocessing.Process( | ||
target = self.ARM_FUNCTION | ||
) | ||
self.usb_handler.start() | ||
|
@@ -1011,13 +997,6 @@ def hotplugCallbackNix( self, *argv ): | |
|
||
# checks the queue from the child usb_handler process | ||
def check_usb_handler( self, dt ): | ||
# TODO: remove debugging lines when windows triggers are fixed | ||
msg = "DEBUG: called check_usb_handler()" | ||
print( msg ); logger.debug( msg ) | ||
|
||
# TODO: remove debugging lines when windows triggers are fixed | ||
msg = "DEBUG: \t self.usb_hander_queue:|" +str(self.usb_handler_queue)+ "|" | ||
print( msg ); logger.debug( msg ) | ||
|
||
# is there a message on the queue? | ||
if not self.usb_handler_queue.empty(): | ||
|
@@ -1091,9 +1070,6 @@ def armNix( self ): | |
return 0 | ||
|
||
def armWin( self ): | ||
# TODO: remove debugging lines when windows triggers are fixed | ||
msg = "DEBUG: called armWin()" | ||
print( msg ); logger.debug( msg ) | ||
|
||
# are we just simulating this USB removal? | ||
if self.SIMULATE_HOTPLUG_REMOVAL: | ||
|
@@ -1115,16 +1091,7 @@ def armWin( self ): | |
|
||
return | ||
|
||
# TODO: remove debugging lines when windows triggers are fixed | ||
msg = "DEBUG: pre-instantiate Notification" | ||
print( msg ); logger.debug( msg ) | ||
|
||
w = Notification( self ) | ||
|
||
# TODO: remove debugging lines when windows triggers are fixed | ||
msg = "DEBUG: post-instantiate Notification" | ||
print( msg ); logger.debug( msg ) | ||
|
||
win32gui.PumpMessages() | ||
|
||
##################### | ||
|
@@ -1741,7 +1708,6 @@ def upgrade_bg(self): | |
# memory and we can't specify a callback when it finishes. | ||
|
||
self.upgrade_process = self.Process( | ||
# self.upgrade_process = multiprocessing.Process( | ||
target = self.upgrade | ||
) | ||
self.upgrade_process.start() | ||
|