aboutsummaryrefslogtreecommitdiff
path: root/macropad.pyw
diff options
context:
space:
mode:
Diffstat (limited to 'macropad.pyw')
-rwxr-xr-xmacropad.pyw17
1 files changed, 11 insertions, 6 deletions
diff --git a/macropad.pyw b/macropad.pyw
index a175931..98e97e4 100755
--- a/macropad.pyw
+++ b/macropad.pyw
@@ -28,9 +28,6 @@ config = configparser.ConfigParser(delimiters="=")
config.read(config_file)
-#
-# Guess the platform and the load the corresponding event listener
-#
#
# How to connect to the peripherical
@@ -97,7 +94,10 @@ class Icon():
self.show_hide.set()
def reset(self):
- mapping.reset()
+ """ Read the configuration file again, and update the mapping list.
+ """
+ config.read(config_file)
+ mapping.set(config)
class Application():
""" The main application.
@@ -190,7 +190,11 @@ class Application():
self.visible = not self.visible
@component.adapter(IMessage)
- def log(self, message : str):
+ def log(self, message : IMessage):
+ """ Log a message.
+ The message is printed in the console, and displayed in the
+ application window.
+ """
print(message.content)
try:
self.text.insert("1.0", "\n")
@@ -220,6 +224,7 @@ if __name__ == '__main__':
# Start the main application, Initializing the message listener before
# listening desktop events
app = Application()
+ # The application is started, ready to display any error message.
mapping = Mapping(config)
component.provideUtility(mapping, interfaces.configuration.IConfiguration)
app.connect_desktop()
@@ -228,7 +233,7 @@ if __name__ == '__main__':
app.exec()
try:
app.window.mainloop()
- except BaseException as e:
+ except BaseException:
app.running = False
app.window.destroy()
app.icon.quit()