diff options
Diffstat (limited to 'grc/python')
-rw-r--r-- | grc/python/Constants.py | 5 | ||||
-rw-r--r-- | grc/python/Platform.py | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/grc/python/Constants.py b/grc/python/Constants.py index 0e974df43c..79ff8bab35 100644 --- a/grc/python/Constants.py +++ b/grc/python/Constants.py @@ -25,7 +25,10 @@ _gr_prefs = gr.prefs() #setup paths PATH_SEP = {'/':':', '\\':';'}[os.path.sep] -HIER_BLOCKS_LIB_DIR = os.path.join(os.path.expanduser('~'), '.grc_gnuradio') +HIER_BLOCKS_LIB_DIR = os.environ.get('GRC_HIER_PATH', + os.path.expanduser('~/.grc_gnuradio')) +PREFS_FILE = os.environ.get('GRC_PREFS_PATH', + os.path.join(os.path.expanduser('~/.grc'))) BLOCKS_DIRS = filter( #filter blank strings lambda x: x, PATH_SEP.join([ os.environ.get('GRC_BLOCKS_PATH', ''), diff --git a/grc/python/Platform.py b/grc/python/Platform.py index f6adaf47a5..f4f55e9d16 100644 --- a/grc/python/Platform.py +++ b/grc/python/Platform.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ import os +from collections import OrderedDict from gnuradio import gr from .. base.Platform import Platform as _Platform from .. gui.Platform import Platform as _GUIPlatform @@ -29,7 +30,7 @@ from Param import Param as _Param from Generator import Generator from Constants import \ HIER_BLOCKS_LIB_DIR, BLOCK_DTD, \ - DEFAULT_FLOW_GRAPH, BLOCKS_DIRS + DEFAULT_FLOW_GRAPH, BLOCKS_DIRS, PREFS_FILE import Constants COLORS = [(name, color) for name, key, sizeof, color in Constants.CORE_TYPES] @@ -42,8 +43,10 @@ class Platform(_Platform, _GUIPlatform): """ #ensure hier dir if not os.path.exists(HIER_BLOCKS_LIB_DIR): os.mkdir(HIER_BLOCKS_LIB_DIR) - #convert block paths to absolute paths - block_paths = set(map(os.path.abspath, BLOCKS_DIRS)) + # Convert block paths to absolute paths: + # - Create a mapping from the absolute path to what was passed in + # - Keep each unique absolute path and maintain order + block_paths = OrderedDict(map(lambda x: (os.path.abspath(x), x), BLOCKS_DIRS)) #init _Platform.__init__( self, @@ -58,7 +61,11 @@ class Platform(_Platform, _GUIPlatform): generator=Generator, colors=COLORS, ) - _GUIPlatform.__init__(self) + + _GUIPlatform.__init__( + self, + prefs_file=PREFS_FILE + ) ############################################## # Constructors |