Skip to content

Commit

Permalink
Merge pull request #310 from jpgill86/global-config-check-for-updates
Browse files Browse the repository at this point in the history
Group auto_check_for_updates under app heading in global config file
  • Loading branch information
jpgill86 committed Jan 17, 2021
2 parents 460fac0 + 9807e1e commit 1452316
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 3 additions & 1 deletion neurotic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
9 changes: 6 additions & 3 deletions neurotic/global_config_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions neurotic/gui/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -627,7 +627,7 @@ def on_version_check_finished(self, latest_release, show_new_only):
<p><a href='{urls['updating']}'>How do I update <i>neurotic</i>?</a></p>
<p>Automatically check for updates at launch: {'Yes' if global_config['auto_check_for_updates'] else 'No'}<br/>
<p>Automatically check for updates at launch: {'Yes' if global_config['app']['auto_check_for_updates'] else 'No'}<br/>
<a href='{urls['globalconfig']}'>Learn how to change this</a></p>
"""
title = 'Check for updates'
Expand All @@ -643,7 +643,7 @@ def on_version_check_finished(self, latest_release, show_new_only):
<tr><td>Latest version:</td> <td>{latest_release}</td></tr>
</table></p>
<p>Automatically check for updates at launch: {'Yes' if global_config['auto_check_for_updates'] else 'No'}<br/>
<p>Automatically check for updates at launch: {'Yes' if global_config['app']['auto_check_for_updates'] else 'No'}<br/>
<a href='{urls['globalconfig']}'>Learn how to change this</a></p>
"""
title = 'Check for updates'
Expand All @@ -663,7 +663,7 @@ def on_version_check_finished(self, latest_release, show_new_only):
<p><a href='{urls['updating']}'>How do I update <i>neurotic</i>?</a></p>
<p>Automatically check for updates at launch: {'Yes' if global_config['auto_check_for_updates'] else 'No'}<br/>
<p>Automatically check for updates at launch: {'Yes' if global_config['app']['auto_check_for_updates'] else 'No'}<br/>
<a href='{urls['globalconfig']}'>Learn how to change this</a></p>
"""
title = 'Check for updates'
Expand Down

0 comments on commit 1452316

Please sign in to comment.