From 3e69d8f5ea4688ff06334d82b17e682f49287f98 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 26 Dec 2021 14:37:28 +0000 Subject: [PATCH] Snake case --- theme.py | 54 +++++++++++++++++++++++++++--------------------------- utils.py | 26 +++++++++++++------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/theme.py b/theme.py index 4a265e19d..fc57282ca 100644 --- a/theme.py +++ b/theme.py @@ -164,90 +164,90 @@ def _copyThemeHelpFiles(base_dir: str, theme_name: str, def _setThemeInConfig(base_dir: str, name: str) -> bool: """Sets the theme with the given name within config.json """ - configFilename = base_dir + '/config.json' - if not os.path.isfile(configFilename): + config_filename = base_dir + '/config.json' + if not os.path.isfile(config_filename): return False - configJson = loadJson(configFilename, 0) + configJson = loadJson(config_filename, 0) if not configJson: return False configJson['theme'] = name - return saveJson(configJson, configFilename) + return saveJson(configJson, config_filename) def _setNewswirePublishAsIcon(base_dir: str, useIcon: bool) -> bool: """Shows the newswire publish action as an icon or a button """ - configFilename = base_dir + '/config.json' - if not os.path.isfile(configFilename): + config_filename = base_dir + '/config.json' + if not os.path.isfile(config_filename): return False - configJson = loadJson(configFilename, 0) + configJson = loadJson(config_filename, 0) if not configJson: return False configJson['show_publish_as_icon'] = useIcon - return saveJson(configJson, configFilename) + return saveJson(configJson, config_filename) def _setIconsAsButtons(base_dir: str, useButtons: bool) -> bool: """Whether to show icons in the header (inbox, outbox, etc) as buttons """ - configFilename = base_dir + '/config.json' - if not os.path.isfile(configFilename): + config_filename = base_dir + '/config.json' + if not os.path.isfile(config_filename): return False - configJson = loadJson(configFilename, 0) + configJson = loadJson(config_filename, 0) if not configJson: return False configJson['icons_as_buttons'] = useButtons - return saveJson(configJson, configFilename) + return saveJson(configJson, config_filename) def _setRssIconAtTop(base_dir: str, atTop: bool) -> bool: """Whether to show RSS icon at the top of the timeline """ - configFilename = base_dir + '/config.json' - if not os.path.isfile(configFilename): + config_filename = base_dir + '/config.json' + if not os.path.isfile(config_filename): return False - configJson = loadJson(configFilename, 0) + configJson = loadJson(config_filename, 0) if not configJson: return False configJson['rss_icon_at_top'] = atTop - return saveJson(configJson, configFilename) + return saveJson(configJson, config_filename) def _setPublishButtonAtTop(base_dir: str, atTop: bool) -> bool: """Whether to show the publish button above the title image in the newswire column """ - configFilename = base_dir + '/config.json' - if not os.path.isfile(configFilename): + config_filename = base_dir + '/config.json' + if not os.path.isfile(config_filename): return False - configJson = loadJson(configFilename, 0) + configJson = loadJson(config_filename, 0) if not configJson: return False configJson['publish_button_at_top'] = atTop - return saveJson(configJson, configFilename) + return saveJson(configJson, config_filename) def _setFullWidthTimelineButtonHeader(base_dir: str, fullWidth: bool) -> bool: """Shows the timeline button header containing inbox, outbox, calendar, etc as full width """ - configFilename = base_dir + '/config.json' - if not os.path.isfile(configFilename): + config_filename = base_dir + '/config.json' + if not os.path.isfile(config_filename): return False - configJson = loadJson(configFilename, 0) + configJson = loadJson(config_filename, 0) if not configJson: return False configJson['full_width_tl_button_header'] = fullWidth - return saveJson(configJson, configFilename) + return saveJson(configJson, config_filename) def getTheme(base_dir: str) -> str: """Gets the current theme name from config.json """ - configFilename = base_dir + '/config.json' - if os.path.isfile(configFilename): - configJson = loadJson(configFilename, 0) + config_filename = base_dir + '/config.json' + if os.path.isfile(config_filename): + configJson = loadJson(config_filename, 0) if configJson: if configJson.get('theme'): return configJson['theme'] diff --git a/utils.py b/utils.py index 6535f6e8f..b604df548 100644 --- a/utils.py +++ b/utils.py @@ -494,35 +494,35 @@ def isSystemAccount(nickname: str) -> bool: return False -def _createConfig(base_dir: str) -> None: +def _create_config(base_dir: str) -> None: """Creates a configuration file """ - configFilename = base_dir + '/config.json' - if os.path.isfile(configFilename): + config_filename = base_dir + '/config.json' + if os.path.isfile(config_filename): return - configJson = { + config_json = { } - saveJson(configJson, configFilename) + saveJson(config_json, config_filename) def setConfigParam(base_dir: str, variableName: str, variableValue) -> None: """Sets a configuration value """ - _createConfig(base_dir) - configFilename = base_dir + '/config.json' + _create_config(base_dir) + config_filename = base_dir + '/config.json' configJson = {} - if os.path.isfile(configFilename): - configJson = loadJson(configFilename) + if os.path.isfile(config_filename): + configJson = loadJson(config_filename) configJson[variableName] = variableValue - saveJson(configJson, configFilename) + saveJson(configJson, config_filename) def get_config_param(base_dir: str, variableName: str): """Gets a configuration value """ - _createConfig(base_dir) - configFilename = base_dir + '/config.json' - configJson = loadJson(configFilename) + _create_config(base_dir) + config_filename = base_dir + '/config.json' + configJson = loadJson(config_filename) if configJson: if variableName in configJson: return configJson[variableName]