summaryrefslogtreecommitdiff
path: root/grc/gui/Config.py
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2016-09-18 16:57:41 -0600
committerSebastian Koslowski <koslowski@kit.edu>2016-09-19 04:17:40 -0600
commit577cd09c42a02c7824bbd6f6c3a76c53dc114658 (patch)
treeb3ba3ec976452e79b03ad7dd376484d2e5b2f8a1 /grc/gui/Config.py
parent824017be176e46655215c7bbfe3a4d0adff8aed4 (diff)
grc: refactor: make gr.prefs() optional (for testing)
Diffstat (limited to 'grc/gui/Config.py')
-rw-r--r--grc/gui/Config.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/grc/gui/Config.py b/grc/gui/Config.py
index b6556ad724..0f40e06fce 100644
--- a/grc/gui/Config.py
+++ b/grc/gui/Config.py
@@ -40,21 +40,21 @@ class Config(_Config):
@property
def editor(self):
- return self.prefs.get_string('grc', 'editor', '')
+ return self._gr_prefs.get_string('grc', 'editor', '')
@editor.setter
def editor(self, value):
- self.prefs.get_string('grc', 'editor', value)
- self.prefs.save()
+ self._gr_prefs.get_string('grc', 'editor', value)
+ self._gr_prefs.save()
@property
def xterm_executable(self):
- return self.prefs.get_string('grc', 'xterm_executable', 'xterm')
+ return self._gr_prefs.get_string('grc', 'xterm_executable', 'xterm')
@property
def default_canvas_size(self):
try: # ugly, but matches current code style
- raw = self.prefs.get_string('grc', 'canvas_default_size', '1280, 1024')
+ raw = self._gr_prefs.get_string('grc', 'canvas_default_size', '1280, 1024')
value = tuple(int(x.strip('() ')) for x in raw.split(','))
if len(value) != 2 or not all(300 < x < 4096 for x in value):
raise Exception()
@@ -66,8 +66,8 @@ class Config(_Config):
@property
def font_size(self):
try: # ugly, but matches current code style
- font_size = self.prefs.get_long('grc', 'canvas_font_size',
- Constants.DEFAULT_FONT_SIZE)
+ font_size = self._gr_prefs.get_long('grc', 'canvas_font_size',
+ Constants.DEFAULT_FONT_SIZE)
if font_size <= 0:
raise Exception()
except:
@@ -75,3 +75,12 @@ class Config(_Config):
print("Error: invalid 'canvas_font_size' setting.", file=sys.stderr)
return font_size
+
+ @property
+ def default_qss_theme(self):
+ return self._gr_prefs.get_string('qtgui', 'qss', '')
+
+ @default_qss_theme.setter
+ def default_qss_theme(self, value):
+ self._gr_prefs.set_string("qtgui", "qss", value)
+ self._gr_prefs.save() \ No newline at end of file