From 9807e1e888f9bdda9a99fe2eccd2a58f400ef35d Mon Sep 17 00:00:00 2001 From: Jeffrey Gill Date: Sun, 17 Jan 2021 01:44:45 -0500 Subject: [PATCH] Group auto_check_for_updates under app heading in global config file --- neurotic/__init__.py | 4 +++- neurotic/global_config_template.txt | 9 ++++++--- neurotic/gui/standalone.py | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/neurotic/__init__.py b/neurotic/__init__.py index c13d604..e1dcd2c 100644 --- a/neurotic/__init__.py +++ b/neurotic/__init__.py @@ -78,7 +78,6 @@ def format(self, record): global_config = { - 'auto_check_for_updates': True, 'defaults': { # defaults used by the command line interface 'file': False, @@ -96,6 +95,9 @@ def format(self, record): 'tokens_file': os.path.join(neurotic_dir, 'gdrive-creds', 'tokens.json'), 'save_tokens': False, }, + 'app': { + 'auto_check_for_updates': True, + }, } # keep a copy of the original config before it is modified diff --git a/neurotic/global_config_template.txt b/neurotic/global_config_template.txt index 530f0cd..a0bdd59 100644 --- a/neurotic/global_config_template.txt +++ b/neurotic/global_config_template.txt @@ -2,9 +2,6 @@ # Use this file to configure the way neurotic behaves. This file uses the TOML # format. -# When the app is launched, neurotic automatically checks for updates unless -# this parameter is set to false. -# auto_check_for_updates = true [defaults] # When the app is launched, the following customizable defaults are used unless @@ -42,3 +39,9 @@ # file. # save_tokens = false + + +[app] +# When the app is launched, neurotic automatically checks for updates unless +# this parameter is set to false. +# auto_check_for_updates = true diff --git a/neurotic/gui/standalone.py b/neurotic/gui/standalone.py index 3a9034b..a487b71 100644 --- a/neurotic/gui/standalone.py +++ b/neurotic/gui/standalone.py @@ -192,7 +192,7 @@ def showEvent(self, event): """ QT.QMainWindow.showEvent(self, event) - if global_config['auto_check_for_updates']: + if global_config['app']['auto_check_for_updates']: self.check_for_updates(show_new_only=True) def create_menus(self): @@ -627,7 +627,7 @@ def on_version_check_finished(self, latest_release, show_new_only):

How do I update neurotic?

-

Automatically check for updates at launch: {'Yes' if global_config['auto_check_for_updates'] else 'No'}
+

Automatically check for updates at launch: {'Yes' if global_config['app']['auto_check_for_updates'] else 'No'}
Learn how to change this

""" title = 'Check for updates' @@ -643,7 +643,7 @@ def on_version_check_finished(self, latest_release, show_new_only): Latest version: {latest_release}

-

Automatically check for updates at launch: {'Yes' if global_config['auto_check_for_updates'] else 'No'}
+

Automatically check for updates at launch: {'Yes' if global_config['app']['auto_check_for_updates'] else 'No'}
Learn how to change this

""" title = 'Check for updates' @@ -663,7 +663,7 @@ def on_version_check_finished(self, latest_release, show_new_only):

How do I update neurotic?

-

Automatically check for updates at launch: {'Yes' if global_config['auto_check_for_updates'] else 'No'}
+

Automatically check for updates at launch: {'Yes' if global_config['app']['auto_check_for_updates'] else 'No'}
Learn how to change this

""" title = 'Check for updates'