diff options
author | Marcus Müller <marcus@hostalia.de> | 2018-09-21 00:00:57 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-09-21 00:00:57 +0200 |
commit | 267d669eb21c514c18a6ee979f5cf247d251f1ad (patch) | |
tree | c6120f5993f82daf13894e8bf905c4169493152e /grc/core/Config.py | |
parent | 896d1c9da31963ecf5b0d90942c2af51ca998a69 (diff) | |
parent | 7b20b28a9e5aa4e32ee37e89e7f80d74485344e8 (diff) |
Merge branch 'merge_next' (which merges next)
This has been in the making far too long.
We finally merge the next branch into master, in preparation of
releasing GNU Radio 3.8.
There will be breakage.
There will be awesomeness.
There will be progress in the greatest SDR framework to ever grace the
surface of the earth.
Hold tight for now.
Diffstat (limited to 'grc/core/Config.py')
-rw-r--r-- | grc/core/Config.py | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/grc/core/Config.py b/grc/core/Config.py index 78ff344998..4accb74c63 100644 --- a/grc/core/Config.py +++ b/grc/core/Config.py @@ -1,5 +1,4 @@ -""" -Copyright 2016 Free Software Foundation, Inc. +"""Copyright 2016 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -17,6 +16,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ +from __future__ import absolute_import + import os from os.path import expanduser, normpath, expandvars, exists @@ -24,18 +25,18 @@ from . import Constants class Config(object): - - key = 'grc' name = 'GNU Radio Companion (no gui)' license = __doc__.strip() website = 'http://gnuradio.org' hier_block_lib_dir = os.environ.get('GRC_HIER_PATH', Constants.DEFAULT_HIER_BLOCK_LIB_DIR) - def __init__(self, prefs_file, version, version_parts=None): - self.prefs = prefs_file + def __init__(self, version, version_parts=None, name=None, prefs=None): + self._gr_prefs = prefs if prefs else DummyPrefs() self.version = version self.version_parts = version_parts or version[1:].split('-', 1)[0].split('.')[:3] + if name: + self.name = name @property def block_paths(self): @@ -44,8 +45,8 @@ class Config(object): paths_sources = ( self.hier_block_lib_dir, os.environ.get('GRC_BLOCKS_PATH', ''), - self.prefs.get_string('grc', 'local_blocks_path', ''), - self.prefs.get_string('grc', 'global_blocks_path', ''), + self._gr_prefs.get_string('grc', 'local_blocks_path', ''), + self._gr_prefs.get_string('grc', 'global_blocks_path', ''), ) collected_paths = sum((paths.split(path_list_sep) @@ -60,7 +61,22 @@ class Config(object): def default_flow_graph(self): user_default = ( os.environ.get('GRC_DEFAULT_FLOW_GRAPH') or - self.prefs.get_string('grc', 'default_flow_graph', '') or + self._gr_prefs.get_string('grc', 'default_flow_graph', '') or os.path.join(self.hier_block_lib_dir, 'default_flow_graph.grc') ) return user_default if exists(user_default) else Constants.DEFAULT_FLOW_GRAPH + + +class DummyPrefs(object): + + def get_string(self, category, item, default): + return str(default) + + def set_string(self, category, item, value): + pass + + def get_long(self, category, item, default): + return int(default) + + def save(self): + pass |