From 4c7192fd41d040837f565c0350b2294337d9556c Mon Sep 17 00:00:00 2001 From: Kevin Matz Date: Sun, 17 Nov 2019 11:10:48 -0500 Subject: [PATCH] more comments --- buttond.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/buttond.py b/buttond.py index 17f5f82..692feb4 100755 --- a/buttond.py +++ b/buttond.py @@ -25,12 +25,14 @@ from signal import pause # Device.pin_factory = MockFactory() +# callback intermidiary to sanitize user input def _activate(macro): if macro is None: return macro = macro.strip('\"').upper() if macro is "": return + # pass macro to baconscript print("doing macro ", macro) comment(macro) @@ -63,12 +65,15 @@ for b in config.get('button', 'names').split(','): print('Error configuring button', b, e) continue + +# clear temp variables off the stack try: - # clear temp variables off the stack del pin, closed, opened except (NameError): pass + +# when run directly, sleep until button signal or KeyboardInterrupt if __name__ == '__main__': try: pause()