Closed appins closed 4 years ago
Also, I should detail what's going on. The code that used to be run in the plain logger.pyw
is now inside of a few functions: __init__
and start_keylogger
. Every previous global variable is now stored in env
so that they can be passed around through the functions and models and such as well.
This is what gets run when the app is run with python (not included in another python work):
__init__()
keylogger = logger_thread()
keylogger.set_func(start_keylogger)
app = gui(keylogger, env, env_lock)
app.exec_()
__init__
, which is the code for setting up the keyboard interface and steps that need to get process names, is run before anything else.
start_keylogger
is put on another thread and then run in the background. Each time a key is pressed, it freezes (locks) all of the variables in env
so that no one else can write to them (assuming they respect env_lock). It logs the key as normal here.
app = gui()
creates the actual interface for the app itself. It starts that thread in the background that keylogger is on. It also creates a tray icon and window, which are all controlled inside of the gui
class, (see logger_model.py
)
app.exec_()
will run until the program exists, which happens either when the keylogger thread ends (control-alt-x pressed) or the tray icon sends an exit event (logger_model.py:29 tracks that and logger_view.py:33 exits the program)
Great work. I'll merge it now.
I have two comments that we can work on as issues:
Show stats only one way (either through the notification OR the window) #22
This ended up taking quite a bit of code and two and a half hours to complete, mostly just because of how much code had to be changed. Because both the keylogger and the command to show the window are blocking, I had to move one of them to a separate thread and therefore also had to make sure that they can communicate without trying to write to the same memory at the same time.
Worth it though. We have a tray icon, three buttons when right clicked, and a very minimal display with the stats and status that updates each time the window is opened (TODO: Update status when rockettype is paused rather than just when the window is opened). Additionally, everything can be called with functions and mostly everything is handled with models (exception is the
env
dictionary that has a bunch of stuff that used to be global).Please give it a go, I think you'll be pretty satisfied with the results.