Make a neatness change and enable debug with --debug

This commit is contained in:
Sofia 2018-12-11 00:58:02 +02:00
parent 8250f43f61
commit 1aaae114e7

View File

@ -16,10 +16,14 @@ class Main:
bongocat = Bongocat() bongocat = Bongocat()
clackmanager = Clackmanager() clackmanager = Clackmanager()
debug = True debug = len(sys.argv) > 1 and sys.argv[1] == '--debug'
sounds = False sounds = False
def init(self, linux): def init(self, linux):
if linux:
from pyxhook import HookManager
else:
from pyHook import HookManager
hooks_manager = HookManager() hooks_manager = HookManager()
hooks_manager.KeyDown = self.OnKeyDown hooks_manager.KeyDown = self.OnKeyDown
@ -70,7 +74,6 @@ class Main:
def OnKeyDown(self, event): def OnKeyDown(self, event):
self.input_manager.press_key(event.Key) self.input_manager.press_key(event.Key)
print event.Message
return True return True
def OnKeyUp(self, event): def OnKeyUp(self, event):
@ -88,10 +91,8 @@ class Main:
if __name__ == "__main__": if __name__ == "__main__":
from sys import platform from sys import platform
if platform == "linux" or platform == "linux2": if platform == "linux" or platform == "linux2":
from pyxhook import HookManager
linux = True linux = True
else: else:
from pyHook import HookManager
linux = False linux = False
main = Main() main = Main()