summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
Diffstat (limited to 'grc')
-rw-r--r--grc/base/Platform.py1
-rw-r--r--grc/grc_gnuradio/blks2/packet.py2
-rw-r--r--grc/gui/ActionHandler.py4
-rw-r--r--grc/gui/Actions.py6
-rw-r--r--grc/gui/Bars.py1
-rw-r--r--grc/gui/FlowGraph.py11
-rw-r--r--grc/gui/Messages.py11
-rw-r--r--grc/gui/Platform.py7
-rw-r--r--grc/gui/Preferences.py5
-rw-r--r--grc/python/Constants.py5
-rw-r--r--grc/python/Platform.py15
11 files changed, 55 insertions, 13 deletions
diff --git a/grc/base/Platform.py b/grc/base/Platform.py
index 3ff80e8a03..187a50c01c 100644
--- a/grc/base/Platform.py
+++ b/grc/base/Platform.py
@@ -196,6 +196,7 @@ class Platform(_Element):
def get_license(self): return self._license
def get_website(self): return self._website
def get_colors(self): return self._colors
+ def get_block_paths(self): return self._block_paths
##############################################
# Constructors
diff --git a/grc/grc_gnuradio/blks2/packet.py b/grc/grc_gnuradio/blks2/packet.py
index 872f08ca2e..dde3ec722f 100644
--- a/grc/grc_gnuradio/blks2/packet.py
+++ b/grc/grc_gnuradio/blks2/packet.py
@@ -75,9 +75,9 @@ class packet_encoder(gr.hier_block2):
Args:
samples_per_symbol: number of samples per symbol
bits_per_symbol: number of bits per symbol
+ preamble: string of ascii 0's and 1's
access_code: AKA sync vector
pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
- payload_length: number of bytes in a data-stream slice
"""
#setup parameters
self._samples_per_symbol = samples_per_symbol
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 0d8998753d..aa692f5ca3 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -115,7 +115,7 @@ class ActionHandler:
Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY,
Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY,
Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW,
- Actions.TOGGLE_REPORTS_WINDOW,
+ Actions.TOGGLE_REPORTS_WINDOW, Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
): action.set_sensitive(True)
if ParseXML.xml_failures:
Messages.send_xml_errors_if_any(ParseXML.xml_failures)
@@ -371,6 +371,8 @@ class ActionHandler:
else:
self.main_window.btwin.hide()
Preferences.blocks_window_visibility(visible)
+ elif action == Actions.TOGGLE_HIDE_DISABLED_BLOCKS:
+ Actions.NOTHING_SELECT()
##################################################
# Param Modifications
##################################################
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index 284c78f8fc..afbeb97612 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -236,6 +236,12 @@ BLOCK_DISABLE = Action(
stock_id=gtk.STOCK_DISCONNECT,
keypresses=(gtk.keysyms.d, NO_MODS_MASK),
)
+TOGGLE_HIDE_DISABLED_BLOCKS = ToggleAction(
+ label='Hide _disabled blocks',
+ tooltip='Toggle visibility of disabled blocks and connections',
+ stock_id=gtk.STOCK_MISSING_IMAGE,
+ keypresses=(gtk.keysyms.d, gtk.gdk.CONTROL_MASK),
+)
BLOCK_CREATE_HIER = Action(
label='C_reate Hier',
tooltip='Create hier block from selected blocks',
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index f016209383..ef8feb0a0b 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -49,6 +49,7 @@ TOOLBAR_LIST = (
None,
Actions.BLOCK_ENABLE,
Actions.BLOCK_DISABLE,
+ Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
None,
Actions.FIND_BLOCKS,
Actions.RELOAD_BLOCKS,
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index c194dfb113..1103aa1639 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -37,7 +37,7 @@ class FlowGraph(Element):
def __init__(self):
"""
- FlowGraph contructor.
+ FlowGraph constructor.
Create a list for signal blocks and connections. Connect mouse handlers.
"""
Element.__init__(self)
@@ -309,6 +309,8 @@ class FlowGraph(Element):
window.draw_rectangle(gc, False, x, y, w, h)
#draw blocks on top of connections
for element in self.get_connections() + self.get_blocks():
+ if Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active() and not element.get_enabled():
+ continue # skip hidden disabled blocks and connections
element.draw(gc, window)
#draw selected blocks on top of selected connections
for selected_element in self.get_selected_connections() + self.get_selected_blocks():
@@ -374,6 +376,13 @@ class FlowGraph(Element):
for element in reversed(self.get_elements()):
selected_element = element.what_is_selected(coor, coor_m)
if not selected_element: continue
+ # hidden disabled connections, blocks and their ports can not be selected
+ if Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active() and (
+ selected_element.is_block() and not selected_element.get_enabled() or
+ selected_element.is_connection() and not selected_element.get_enabled() or
+ selected_element.is_port() and not selected_element.get_parent().get_enabled()
+ ):
+ continue
#update the selected port information
if selected_element.is_port():
if not coor_m: selected_port = selected_element
diff --git a/grc/gui/Messages.py b/grc/gui/Messages.py
index c4706459af..2bf488bb58 100644
--- a/grc/gui/Messages.py
+++ b/grc/gui/Messages.py
@@ -48,7 +48,16 @@ register_messenger(sys.stdout.write)
# Special functions for specific program functionalities
###########################################################################
def send_init(platform):
- send("""<<< Welcome to %s %s >>>\n"""%(platform.get_name(), platform.get_version()))
+ p = platform
+ send('\n'.join([
+ "<<< Welcome to %s %s >>>" % (p.get_name(), p.get_version()),
+ "",
+ "Preferences file: " + p.get_prefs_file(),
+ "Block paths:"
+ ] + [
+ "\t%s" % path + (" (%s)" % opath if opath != path else "")
+ for path, opath in p.get_block_paths().iteritems()
+ ]) + "\n")
def send_page_switch(file_path):
send('\nShowing: "%s"\n'%file_path)
diff --git a/grc/gui/Platform.py b/grc/gui/Platform.py
index 6a8175b9fa..db77ff2112 100644
--- a/grc/gui/Platform.py
+++ b/grc/gui/Platform.py
@@ -20,4 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
from Element import Element
class Platform(Element):
- def __init__(self): Element.__init__(self)
+ def __init__(self, prefs_file):
+ Element.__init__(self)
+
+ self._prefs_file = prefs_file
+
+ def get_prefs_file(self): return self._prefs_file \ No newline at end of file
diff --git a/grc/gui/Preferences.py b/grc/gui/Preferences.py
index c315436cae..b15fb9738b 100644
--- a/grc/gui/Preferences.py
+++ b/grc/gui/Preferences.py
@@ -24,7 +24,6 @@ _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 load(platform):
global _platform
@@ -32,10 +31,10 @@ def load(platform):
#create sections
_config_parser.add_section('main')
_config_parser.add_section('files_open')
- try: _config_parser.read(_prefs_file())
+ try: _config_parser.read(_platform.get_prefs_file())
except: pass
def save():
- try: _config_parser.write(open(_prefs_file(), 'w'))
+ try: _config_parser.write(open(_platform.get_prefs_file(), 'w'))
except: pass
###########################################################################
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