From 93b5498e04225a3d3db86c9035735d7b8a9967ec Mon Sep 17 00:00:00 2001 From: chrys Date: Thu, 14 Feb 2019 00:12:29 +0100 Subject: [PATCH] finish quick menu --- .../commands/commands/next_quick_menu_value.py | 2 -- .../commands/quickMenu/next_quick_menu_value.py | 9 +++------ src/fenrirscreenreader/core/quickMenuManager.py | 16 ++++++++-------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/fenrirscreenreader/commands/commands/next_quick_menu_value.py b/src/fenrirscreenreader/commands/commands/next_quick_menu_value.py index 152eb675..35e0c57b 100644 --- a/src/fenrirscreenreader/commands/commands/next_quick_menu_value.py +++ b/src/fenrirscreenreader/commands/commands/next_quick_menu_value.py @@ -21,5 +21,3 @@ class command(): self.env['runtime']['outputManager'].presentText(value, interrupt=True) def setCallback(self, callback): pass - def setCallback(self, callback): - pass diff --git a/src/fenrirscreenreader/commands/quickMenu/next_quick_menu_value.py b/src/fenrirscreenreader/commands/quickMenu/next_quick_menu_value.py index ae92958c..35e0c57b 100644 --- a/src/fenrirscreenreader/commands/quickMenu/next_quick_menu_value.py +++ b/src/fenrirscreenreader/commands/quickMenu/next_quick_menu_value.py @@ -16,11 +16,8 @@ class command(): def getDescription(self): return _('get next quick menu value') def run(self): - try: - if self.env['runtime']['quickMenuManager'].nextValue(): - value = self.env['runtime']['quickMenuManager'].getCurrentValue() - self.env['runtime']['outputManager'].presentText(value, interrupt=True) - except Exception as e: - print(e) + if self.env['runtime']['quickMenuManager'].nextValue(): + value = self.env['runtime']['quickMenuManager'].getCurrentValue() + self.env['runtime']['outputManager'].presentText(value, interrupt=True) def setCallback(self, callback): pass diff --git a/src/fenrirscreenreader/core/quickMenuManager.py b/src/fenrirscreenreader/core/quickMenuManager.py index a5089669..1f15170f 100644 --- a/src/fenrirscreenreader/core/quickMenuManager.py +++ b/src/fenrirscreenreader/core/quickMenuManager.py @@ -67,18 +67,18 @@ class quickMenuManager(): if not valueString in ['True','False']: return False value = not value - self.env['runtime']['settingsManager'].setSettingAsBool(section, setting, value) + self.env['runtime']['settingsManager'].setSetting(section, setting, str(value)) elif isinstance(self.settings[section][setting], int): value = int(valueString) value += 1 - self.env['runtime']['settingsManager'].setSettingAsInt(section, setting, value) + self.env['runtime']['settingsManager'].setSetting(section, setting, str(value)) elif isinstance(self.settings[section][setting], float): value = float(valueString) value += 0.05 if value > 1.0: value = 1.0 - self.env['runtime']['settingsManager'].setSettingAsFloat(section, setting, value) - except: + self.env['runtime']['settingsManager'].setSetting(section, setting, str(value)) + except Exception as e: return False return True def prevValue(self): @@ -99,20 +99,20 @@ class quickMenuManager(): if not valueString in ['True','False']: return False value = not value - self.env['runtime']['settingsManager'].setSettingAsBool(section, setting, value) + self.env['runtime']['settingsManager'].setSetting(section, setting, str(value)) elif isinstance(self.settings[section][setting], int): value = int(valueString) value -= 1 if value < 0: value = 0 - self.env['runtime']['settingsManager'].setSettingAsInt(section, setting, value) + self.env['runtime']['settingsManager'].setSetting(section, setting, str(value)) elif isinstance(self.settings[section][setting], float): value = float(valueString) value -= 0.05 if value < 0.0: value = 0.0 - self.env['runtime']['settingsManager'].setSettingAsFloat(section, setting, value) - except: + self.env['runtime']['settingsManager'].setSetting(section, setting, str(value)) + except Exception as e: return False return True def getCurrentEntry(self):