diff --git a/src/buskill_gui.py b/src/buskill_gui.py index e8d3c7619..0eff1e684 100755 --- a/src/buskill_gui.py +++ b/src/buskill_gui.py @@ -1418,6 +1418,7 @@ def build_config(self, config): Config.read( self.bk.CONF_FILE ) Config.setdefaults('buskill', { 'buskill_trigger': 'lock-screen', + 'persistent_log': 'False' }) # TODO: don't hard-code this, pull it from kivy/config.py diff --git a/src/packages/buskill/__init__.py b/src/packages/buskill/__init__.py index 830472b21..4d4ee8257 100644 --- a/src/packages/buskill/__init__.py +++ b/src/packages/buskill/__init__.py @@ -227,7 +227,8 @@ def __init__(self): # BusKill class was always initialised after finding the log file path Therefore in the new setup we are initialising it before the log file path is found # This will prevent it from out of index error - self.LOG_FILE_PATH = logger.root.handlers[0].baseFilename if logger.root.handlers else None + handler = logger.root.handlers[0] if logger.root.handlers else None + self.LOG_FILE_PATH = getattr(handler, "baseFilename", None) if handler else None # Handle logging handlers without baseFilename # Default value as False, because if no one updates the config.ini file then reverting back to old file path self.PERSISTENT_LOG = False @@ -427,7 +428,7 @@ def __init__(self): # top to make UX *slightly* better for a user who wants to manually # edit the config file. if we don't do this, then kivy will put it # below its own settings, making the user scroll a lot to find them - contents = "[buskill]\n" + contents = "[buskill]\npersistent_log = False\n" # Updating the config option with open( self.CONF_FILE, 'w' ) as fd: fd.write( contents ) diff --git a/src/packages/buskill/settings_buskill.json b/src/packages/buskill/settings_buskill.json index 8ea93bd42..26816a205 100644 --- a/src/packages/buskill/settings_buskill.json +++ b/src/packages/buskill/settings_buskill.json @@ -12,6 +12,19 @@ "confirmation": ["", "This selection may cause data loss! Are you sure you want to continue?\n\nThe 'soft-shutdown' trigger will immediately cause your computer to shutdown. This could cause you to lose work if, for example, you're writing an email or typing a text document.\n\nAre you sure you want to select the 'soft-shutdown' trigger, despite the risk of data loss?" ], "options_icons": ["\ue1bf","\ue62a"] }, + { + "icon": "\ue873", + "type": "complex-options", + "title": "Persistent Logging", + "desc": "Do you want to store the log file persistently (keeping the data after your computer reboots)?", + "section": "buskill", + "key": "persistent_log", + "options": ["True","False"], + "options_human": ["True","False"], + "options_long": ["Log file will be not deleted after your system restarts","Log file will be deleted once you restart the computer"], + "confirmation": ["Please restart the app so the changes can be implimented","Please restart the app so the changes can be implimented"], + "options_icons": ["\ue161","\ue5cd"] + }, { "type": "title", "title": "Look & Feel"