[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/13: grc: honour order of block paths, pr
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/13: grc: honour order of block paths, print them out on startup, override hier block and pref file path with GRC_HIER_PATH & GRC_PREFS_PATH |
Date: |
Tue, 15 Apr 2014 23:55:53 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 0b69cb314c4e63dc82bd971551cb2cdbae12a302
Author: Balint Seeber <address@hidden>
Date: Fri Apr 4 09:32:42 2014 -0700
grc: honour order of block paths, print them out on startup, override hier
block and pref file path with GRC_HIER_PATH & GRC_PREFS_PATH
---
grc/gui/Preferences.py | 4 +++-
grc/python/Constants.py | 2 +-
grc/python/Platform.py | 16 +++++++++++++++-
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/grc/gui/Preferences.py b/grc/gui/Preferences.py
index c315436..061bda9 100644
--- a/grc/gui/Preferences.py
+++ b/grc/gui/Preferences.py
@@ -24,7 +24,7 @@ _platform = None
_config_parser = ConfigParser.ConfigParser()
def file_extension(): return '.'+_platform.get_key()
-def _prefs_file(): return os.path.join(os.path.expanduser('~'),
file_extension())
+def _prefs_file(): return os.environ.get('GRC_PREFS_PATH',
os.path.join(os.path.expanduser('~'), file_extension()))
def load(platform):
global _platform
@@ -32,9 +32,11 @@ def load(platform):
#create sections
_config_parser.add_section('main')
_config_parser.add_section('files_open')
+ print "Reading preferences from:", _prefs_file()
try: _config_parser.read(_prefs_file())
except: pass
def save():
+ print "Writing preferences to:", _prefs_file()
try: _config_parser.write(open(_prefs_file(), 'w'))
except: pass
diff --git a/grc/python/Constants.py b/grc/python/Constants.py
index 0e974df..9f27589 100644
--- a/grc/python/Constants.py
+++ b/grc/python/Constants.py
@@ -25,7 +25,7 @@ _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.path.join(os.path.expanduser('~'),
os.environ.get('GRC_HIER_PATH', '.grc_gnuradio'))
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 f6adaf4..7e5ad81 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
@@ -43,7 +44,20 @@ 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))
+ # Create a mapping from the absolute path to what was passed in
+ user_to_abs_path = map(lambda x: (os.path.abspath(x), x), BLOCKS_DIRS)
+ # Keep each unique absolute path and maintain order
+ paths_dict = OrderedDict(user_to_abs_path)
+ # Prepare the ordered, unique absolute path list for _Platform
+ block_paths = paths_dict.keys()
+ # Print out the paths that are used (differently, depending on whether
they
+ # were transformed from their original state)
+ print "Block paths:"
+ for p in block_paths:
+ if p != paths_dict[p]:
+ print "\t%s (%s)" % (paths_dict[p], p)
+ else:
+ print "\t%s" % (p)
#init
_Platform.__init__(
self,
- [Commit-gnuradio] [gnuradio] 10/13: Merge remote-tracking branch 'bolin/master', (continued)
- [Commit-gnuradio] [gnuradio] 10/13: Merge remote-tracking branch 'bolin/master', git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 08/13: Merge remote-tracking branch 'gnuradio-wg-grc/grc_hide_disabled_blocks', git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 04/13: Fix inconsistent naming and docstring, git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 12/13: Merge remote-tracking branch 'mmueller/gr_uhd_time_spec_t_fix', git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 13/13: Merge remote-tracking branch 'tkuester/documentation', git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 09/13: Merge remote-tracking branch 'gnuradio-wg-grc/grc_block_and_prefs_path', git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 05/13: socket_pdu: fixed resolver issue by applying same resolver as in udp_sink., git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 11/13: Merge remote-tracking branch 'mmueller/socket_pdu_fix_resolver_issue', git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 03/13: grc: nicer output of blocks paths and prefs file, git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 06/13: added subtraction and addition to time_spec_t, git, 2014/04/15
- [Commit-gnuradio] [gnuradio] 02/13: grc: honour order of block paths, print them out on startup, override hier block and pref file path with GRC_HIER_PATH & GRC_PREFS_PATH,
git <=
- [Commit-gnuradio] [gnuradio] 07/13: documentation: Bit handling gotchas explained, git, 2014/04/15