summaryrefslogtreecommitdiff
path: root/grc/base
diff options
context:
space:
mode:
Diffstat (limited to 'grc/base')
-rw-r--r--grc/base/Block.py17
-rw-r--r--grc/base/Constants.py4
-rw-r--r--grc/base/Param.py4
3 files changed, 21 insertions, 4 deletions
diff --git a/grc/base/Block.py b/grc/base/Block.py
index 668675c685..faa48d99b4 100644
--- a/grc/base/Block.py
+++ b/grc/base/Block.py
@@ -18,11 +18,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
from . import odict
+from . Constants import ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB
from Element import Element
from Cheetah.Template import Template
from UserDict import UserDict
-from .. gui import Actions
+
class TemplateArg(UserDict):
"""
@@ -76,6 +77,11 @@ class Block(Element):
self._block_wrapper_path = n.find('block_wrapper_path')
self._bussify_sink = n.find('bus_sink')
self._bussify_source = n.find('bus_source')
+
+ # get list of param tabs
+ n_tabs = n.find('param_tab_order') or None
+ self._param_tab_labels = n_tabs.findall('tab') if n_tabs is not None else [DEFAULT_PARAM_TAB]
+
#create the param objects
self._params = list()
#add the id param
@@ -142,6 +148,7 @@ class Block(Element):
'key': 'affinity',
'type': 'int_vector',
'hide': 'part',
+ 'tab': ADVANCED_PARAM_TAB
})
))
if len(sources) and is_not_virtual_or_pad:
@@ -151,7 +158,8 @@ class Block(Element):
'key': 'minoutbuf',
'type': 'int',
'hide': 'part',
- 'value': '0'
+ 'value': '0',
+ 'tab': ADVANCED_PARAM_TAB
})
))
self.get_params().append(self.get_parent().get_parent().Param(
@@ -160,14 +168,14 @@ class Block(Element):
'key': 'maxoutbuf',
'type': 'int',
'hide': 'part',
- 'value': '0'
+ 'value': '0',
+ 'tab': ADVANCED_PARAM_TAB
})
))
def back_ofthe_bus(self, portlist):
portlist.sort(key=lambda a: a.get_type() == 'bus');
-
def filter_bus_port(self, ports):
buslist = [i for i in ports if i.get_type() == 'bus'];
@@ -213,6 +221,7 @@ class Block(Element):
##############################################
# Access Params
##############################################
+ def get_param_tab_labels(self): return self._param_tab_labels
def get_param_keys(self): return _get_keys(self._params)
def get_param(self, key): return _get_elem(self._params, key)
def get_params(self): return self._params
diff --git a/grc/base/Constants.py b/grc/base/Constants.py
index ef45be8dfe..e5026d9da7 100644
--- a/grc/base/Constants.py
+++ b/grc/base/Constants.py
@@ -23,3 +23,7 @@ import os
DATA_DIR = os.path.dirname(__file__)
FLOW_GRAPH_DTD = os.path.join(DATA_DIR, 'flow_graph.dtd')
BLOCK_TREE_DTD = os.path.join(DATA_DIR, 'block_tree.dtd')
+
+# Param tabs
+DEFAULT_PARAM_TAB = "General"
+ADVANCED_PARAM_TAB = "Advanced"
diff --git a/grc/base/Param.py b/grc/base/Param.py
index 8b8362ac1a..f8bfe0d256 100644
--- a/grc/base/Param.py
+++ b/grc/base/Param.py
@@ -74,6 +74,9 @@ class Param(Element):
value = n.find('value') or ''
self._type = n.find('type')
self._hide = n.find('hide') or ''
+ self._tab_label = n.find('tab') or block.get_param_tab_labels()[0]
+ if not self._tab_label in block.get_param_tab_labels():
+ block.get_param_tab_labels().append(self._tab_label)
#build the param
Element.__init__(self, block)
#create the Option objects from the n data
@@ -143,6 +146,7 @@ class Param(Element):
def set_value(self, value): self._value = str(value) #must be a string
def get_type(self): return self.get_parent().resolve_dependencies(self._type)
+ def get_tab_label(self): return self._tab_label
def is_enum(self): return self._type == 'enum'
def __repr__(self):