summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
Diffstat (limited to 'grc')
-rw-r--r--grc/base/Block.py58
-rw-r--r--grc/base/Connection.py12
-rw-r--r--grc/base/Element.py6
-rw-r--r--grc/base/FlowGraph.py54
-rw-r--r--grc/base/Param.py6
-rw-r--r--grc/base/ParseXML.py16
-rw-r--r--grc/base/Platform.py10
-rw-r--r--grc/base/Port.py10
-rw-r--r--grc/base/odict.py12
-rw-r--r--grc/blocks/bus_sink.xml6
-rw-r--r--grc/blocks/bus_source.xml6
-rw-r--r--grc/blocks/bus_structure_sink.xml4
-rw-r--r--grc/blocks/bus_structure_source.xml4
-rw-r--r--grc/blocks/pad_source.xml2
-rw-r--r--grc/grc_gnuradio/blks2/error_rate.py2
-rw-r--r--grc/grc_gnuradio/blks2/packet.py6
-rw-r--r--grc/grc_gnuradio/blks2/selector.py12
-rw-r--r--grc/grc_gnuradio/blks2/tcp.py4
-rw-r--r--grc/gui/ActionHandler.py30
-rw-r--r--grc/gui/Actions.py4
-rw-r--r--grc/gui/Block.py16
-rw-r--r--grc/gui/Connection.py6
-rw-r--r--grc/gui/Dialogs.py8
-rw-r--r--grc/gui/DrawingArea.py2
-rw-r--r--grc/gui/Element.py36
-rw-r--r--grc/gui/FileDialogs.py10
-rw-r--r--grc/gui/FlowGraph.py40
-rw-r--r--grc/gui/MainWindow.py26
-rw-r--r--grc/gui/Messages.py4
-rw-r--r--grc/gui/NotebookPage.py28
-rw-r--r--grc/gui/Param.py4
-rw-r--r--grc/gui/Port.py22
-rw-r--r--grc/gui/PropsDialog.py12
-rw-r--r--grc/gui/StateCache.py10
-rw-r--r--grc/gui/Utils.py14
-rw-r--r--grc/python/Block.py18
-rw-r--r--grc/python/FlowGraph.py50
-rw-r--r--grc/python/Generator.py6
-rw-r--r--grc/python/Param.py14
-rw-r--r--grc/python/Port.py8
-rw-r--r--grc/python/expr_utils.py24
-rw-r--r--grc/python/extract_docs.py8
42 files changed, 315 insertions, 315 deletions
diff --git a/grc/base/Block.py b/grc/base/Block.py
index 5a91810b7d..c440f00b6b 100644
--- a/grc/base/Block.py
+++ b/grc/base/Block.py
@@ -56,11 +56,11 @@ class Block(Element):
def __init__(self, flow_graph, n):
"""
Make a new block from nested data.
-
+
Args:
flow: graph the parent element
n: the nested odict
-
+
Returns:
block a new block
"""
@@ -177,7 +177,7 @@ class Block(Element):
def back_ofthe_bus(self, portlist):
portlist.sort(key=lambda a: a.get_type() == 'bus');
- def filter_bus_port(self, ports):
+ def filter_bus_port(self, ports):
buslist = [i for i in ports if i.get_type() == 'bus'];
if len(buslist) == 0:
return ports;
@@ -187,7 +187,7 @@ class Block(Element):
def get_enabled(self):
"""
Get the enabled state of the block.
-
+
Returns:
true for enabled
"""
@@ -197,7 +197,7 @@ class Block(Element):
def set_enabled(self, enabled):
"""
Set the enabled state of the block.
-
+
Args:
enabled: true for enabled
"""
@@ -225,11 +225,11 @@ class Block(Element):
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
- def has_param(self, key):
- try:
- _get_elem(self._params, key);
- return True;
- except:
+ def has_param(self, key):
+ try:
+ _get_elem(self._params, key);
+ return True;
+ except:
return False;
##############################################
@@ -246,7 +246,7 @@ class Block(Element):
def get_source_keys(self): return _get_keys(self._sources)
def get_source(self, key): return _get_elem(self._sources, key)
def get_sources(self): return self._sources
- def get_sources_gui(self): return self.filter_bus_port(self.get_sources());
+ def get_sources_gui(self): return self.filter_bus_port(self.get_sources());
def get_connections(self):
return sum([port.get_connections() for port in self.get_ports()], [])
@@ -254,10 +254,10 @@ class Block(Element):
def resolve_dependencies(self, tmpl):
"""
Resolve a paramater dependency with cheetah templates.
-
+
Args:
tmpl: the string with dependencies
-
+
Returns:
the resolved value
"""
@@ -273,10 +273,10 @@ class Block(Element):
def type_controller_modify(self, direction):
"""
Change the type controller.
-
+
Args:
direction: +1 or -1
-
+
Returns:
true for change
"""
@@ -302,10 +302,10 @@ class Block(Element):
def port_controller_modify(self, direction):
"""
Change the port controller.
-
+
Args:
direction: +1 or -1
-
+
Returns:
true for change
"""
@@ -323,7 +323,7 @@ class Block(Element):
struct = [range(len(get_p()))];
if True in map(lambda a: isinstance(a.get_nports(), int), get_p()):
-
+
structlet = [];
last = 0;
@@ -332,7 +332,7 @@ class Block(Element):
last = structlet[-1] + 1;
struct = [structlet];
if bus_structure:
-
+
struct = bus_structure
self.current_bus_structure[direc] = struct;
@@ -353,10 +353,10 @@ class Block(Element):
for connect in elt.get_connections():
self.get_parent().remove_element(connect);
-
-
-
-
+
+
+
+
if (not 'bus' in map(lambda a: a.get_type(), get_p())) and len(get_p()) > 0:
@@ -364,16 +364,16 @@ class Block(Element):
self.current_bus_structure[direc] = struct;
if get_p()[0].get_nports():
n['nports'] = str(1);
-
+
for i in range(len(struct)):
n['key'] = str(len(get_p()));
n = odict(n);
port = self.get_parent().get_parent().Port(block=self, n=n, dir=direc);
get_p().append(port);
-
-
-
+
+
+
elif 'bus' in map(lambda a: a.get_type(), get_p()):
for elt in get_p_gui():
get_p().remove(elt);
@@ -384,7 +384,7 @@ class Block(Element):
def export_data(self):
"""
Export this block's params to nested data.
-
+
Returns:
a nested data odict
"""
@@ -405,7 +405,7 @@ class Block(Element):
call rewrite, and repeat the load until the params stick.
This call to rewrite will also create any dynamic ports
that are needed for the connections creation phase.
-
+
Args:
n: the nested data odict
"""
diff --git a/grc/base/Connection.py b/grc/base/Connection.py
index 252b7deac1..b35ca91050 100644
--- a/grc/base/Connection.py
+++ b/grc/base/Connection.py
@@ -25,13 +25,13 @@ class Connection(Element):
def __init__(self, flow_graph, porta, portb):
"""
Make a new connection given the parent and 2 ports.
-
+
Args:
flow_graph: the parent of this element
porta: a port (any direction)
portb: a port (any direction)
@throws Error cannot make connection
-
+
Returns:
a new connection
"""
@@ -55,10 +55,10 @@ class Connection(Element):
self._source = source
self._sink = sink
if source.get_type() == 'bus':
-
+
sources = source.get_associated_ports();
sinks = sink.get_associated_ports();
-
+
for i in range(len(sources)):
try:
flow_graph.connect(sources[i], sinks[i]);
@@ -89,7 +89,7 @@ class Connection(Element):
def get_enabled(self):
"""
Get the enabled state of this connection.
-
+
Returns:
true if source and sink blocks are enabled
"""
@@ -108,7 +108,7 @@ class Connection(Element):
def export_data(self):
"""
Export this connection's info.
-
+
Returns:
a nested data odict
"""
diff --git a/grc/base/Element.py b/grc/base/Element.py
index be73ab264f..9c697b6393 100644
--- a/grc/base/Element.py
+++ b/grc/base/Element.py
@@ -36,7 +36,7 @@ class Element(object):
def is_valid(self):
"""
Is this element valid?
-
+
Returns:
true when the element is enabled and has no error messages
"""
@@ -45,7 +45,7 @@ class Element(object):
def add_error_message(self, msg):
"""
Add an error message to the list of errors.
-
+
Args:
msg: the error message string
"""
@@ -56,7 +56,7 @@ class Element(object):
Get the list of error messages from this element and all of its children.
Do not include the error messages from disabled children.
Cleverly indent the children error messages for printing purposes.
-
+
Returns:
a list of error message strings
"""
diff --git a/grc/base/FlowGraph.py b/grc/base/FlowGraph.py
index 3c249ff71b..519d399aa8 100644
--- a/grc/base/FlowGraph.py
+++ b/grc/base/FlowGraph.py
@@ -26,10 +26,10 @@ class FlowGraph(Element):
def __init__(self, platform):
"""
Make a flow graph from the arguments.
-
+
Args:
platform: a platforms with blocks and contrcutors
-
+
Returns:
the flow graph object
"""
@@ -41,10 +41,10 @@ class FlowGraph(Element):
def _get_unique_id(self, base_id=''):
"""
Get a unique id starting with the base id.
-
+
Args:
base_id: the id starts with this and appends a count
-
+
Returns:
a unique id
"""
@@ -58,7 +58,7 @@ class FlowGraph(Element):
def __str__(self): return 'FlowGraph - %s(%s)'%(self.get_option('title'), self.get_option('id'))
def rewrite(self):
def refactor_bus_structure():
-
+
for block in self.get_blocks():
for direc in ['source', 'sink']:
if direc == 'source':
@@ -69,11 +69,11 @@ class FlowGraph(Element):
get_p = block.get_sinks;
get_p_gui = block.get_sinks_gui
bus_structure = block.form_bus_structure('sink');
-
+
if 'bus' in map(lambda a: a.get_type(), get_p_gui()):
-
-
-
+
+
+
if len(get_p_gui()) > len(bus_structure):
times = range(len(bus_structure), len(get_p_gui()));
for i in times:
@@ -84,17 +84,17 @@ class FlowGraph(Element):
n = {'name':'bus','type':'bus'};
if True in map(lambda a: isinstance(a.get_nports(), int), get_p()):
n['nports'] = str(1);
-
- times = range(len(get_p_gui()), len(bus_structure));
-
+
+ times = range(len(get_p_gui()), len(bus_structure));
+
for i in times:
n['key'] = str(len(get_p()));
n = odict(n);
port = block.get_parent().get_parent().Port(block=block, n=n, dir=direc);
get_p().append(port);
-
-
-
+
+
+
for child in self.get_children(): child.rewrite()
refactor_bus_structure();
@@ -102,10 +102,10 @@ class FlowGraph(Element):
"""
Get the option for a given key.
The option comes from the special options block.
-
+
Args:
key: the param key for the options block
-
+
Returns:
the value held by that param
"""
@@ -132,7 +132,7 @@ class FlowGraph(Element):
"""
Get a list of all the elements.
Always ensure that the options block is in the list (only once).
-
+
Returns:
the element list
"""
@@ -146,7 +146,7 @@ class FlowGraph(Element):
def get_enabled_blocks(self):
"""
Get a list of all blocks that are enabled.
-
+
Returns:
a list of blocks
"""
@@ -155,7 +155,7 @@ class FlowGraph(Element):
def get_enabled_connections(self):
"""
Get a list of all connections that are enabled.
-
+
Returns:
a list of connections
"""
@@ -165,10 +165,10 @@ class FlowGraph(Element):
"""
Get a new block of the specified key.
Add the block to the list of elements.
-
+
Args:
key: the block key
-
+
Returns:
the new block or None if not found
"""
@@ -184,12 +184,12 @@ class FlowGraph(Element):
def connect(self, porta, portb):
"""
Create a connection between porta and portb.
-
+
Args:
porta: a port
portb: another port
@throw Exception bad connection
-
+
Returns:
the new connection
"""
@@ -223,7 +223,7 @@ class FlowGraph(Element):
def evaluate(self, expr):
"""
Evaluate the expression.
-
+
Args:
expr: the string expression
@throw NotImplementedError
@@ -237,7 +237,7 @@ class FlowGraph(Element):
"""
Export this flow graph to nested data.
Export all block and connection data.
-
+
Returns:
a nested data odict
"""
@@ -253,7 +253,7 @@ class FlowGraph(Element):
Import blocks and connections into this flow graph.
Clear this flowgraph of all previous blocks and connections.
Any blocks or connections in error will be ignored.
-
+
Args:
n: the nested data odict
"""
diff --git a/grc/base/Param.py b/grc/base/Param.py
index 33ba7c3dbb..94be8b0fe0 100644
--- a/grc/base/Param.py
+++ b/grc/base/Param.py
@@ -63,7 +63,7 @@ class Param(Element):
def __init__(self, block, n):
"""
Make a new param from nested data.
-
+
Args:
block: the parent element
n: the nested odict
@@ -162,7 +162,7 @@ class Param(Element):
Get the repr (nice string format) for this param.
Just return the value (special case enum).
Derived classes can handle complex formatting.
-
+
Returns:
the string representation
"""
@@ -189,7 +189,7 @@ class Param(Element):
def export_data(self):
"""
Export this param's key/value.
-
+
Returns:
a nested data odict
"""
diff --git a/grc/base/ParseXML.py b/grc/base/ParseXML.py
index abb6576ac2..70af65192d 100644
--- a/grc/base/ParseXML.py
+++ b/grc/base/ParseXML.py
@@ -35,7 +35,7 @@ class XMLSyntaxError(Exception):
def validate_dtd(xml_file, dtd_file=None):
"""
Validate an xml file against its dtd.
-
+
Args:
xml_file: the xml file
dtd_file: the optional dtd file
@@ -63,10 +63,10 @@ def validate_dtd(xml_file, dtd_file=None):
def from_file(xml_file):
"""
Create nested data from an xml file using the from xml helper.
-
+
Args:
xml_file: the xml file path
-
+
Returns:
the nested data
"""
@@ -77,10 +77,10 @@ def from_file(xml_file):
def _from_file(xml):
"""
Recursivly parse the xml tree into nested data format.
-
+
Args:
xml: the xml tree
-
+
Returns:
the nested data
"""
@@ -102,7 +102,7 @@ def _from_file(xml):
def to_file(nested_data, xml_file):
"""
Write an xml file and use the to xml helper method to load it.
-
+
Args:
nested_data: the nested data
xml_file: the xml file path
@@ -114,10 +114,10 @@ def to_file(nested_data, xml_file):
def _to_file(nested_data):
"""
Recursivly parse the nested data into xml tree format.
-
+
Args:
nested_data: the nested data
-
+
Returns:
the xml tree filled with child nodes
"""
diff --git a/grc/base/Platform.py b/grc/base/Platform.py
index 187a50c01c..d322a16e83 100644
--- a/grc/base/Platform.py
+++ b/grc/base/Platform.py
@@ -35,7 +35,7 @@ class Platform(_Element):
license='', website=None, colors=None):
"""
Make a platform from the arguments.
-
+
Args:
name: the platform name
version: the version string
@@ -47,7 +47,7 @@ class Platform(_Element):
colors: a list of title, color_spec tuples
license: a multi-line license (first line is copyright)
website: the website url for this platform
-
+
Returns:
a platform object
"""
@@ -125,10 +125,10 @@ class Platform(_Element):
"""
Parse a saved flow graph file.
Ensure that the file exists, and passes the dtd check.
-
+
Args:
flow_graph_file: the flow graph file
-
+
Returns:
nested data
@throws exception if the validation fails
@@ -143,7 +143,7 @@ class Platform(_Element):
Load a block tree with categories and blocks.
Step 1: Load all blocks from the xml specification.
Step 2: Load blocks with builtin category specifications.
-
+
Args:
block_tree: the block tree object
"""
diff --git a/grc/base/Port.py b/grc/base/Port.py
index b7de5301f1..edc309bf05 100644
--- a/grc/base/Port.py
+++ b/grc/base/Port.py
@@ -24,7 +24,7 @@ class Port(Element):
def __init__(self, block, n, dir):
"""
Make a new port from nested data.
-
+
Args:
block: the parent element
n: the nested odict
@@ -66,7 +66,7 @@ class Port(Element):
number = ''
if self.get_type() == 'bus':
busses = filter(lambda a: a._dir == self._dir, self.get_parent().get_ports_gui());
-
+
number = str(busses.index(self)) + '#' + str(len(self.get_associated_ports()));
return self._name + number
@@ -78,7 +78,7 @@ class Port(Element):
def get_connections(self):
"""
Get all connections that use this port.
-
+
Returns:
a list of connection objects
"""
@@ -89,7 +89,7 @@ class Port(Element):
def get_enabled_connections(self):
"""
Get all enabled connections that use this port.
-
+
Returns:
a list of connection objects
"""
@@ -107,7 +107,7 @@ class Port(Element):
get_p = self.get_parent().get_sinks;
bus_structure = self.get_parent().current_bus_structure['sink'];
direc = 'sink'
-
+
ports = [i for i in get_p() if not i.get_type() == 'bus'];
if bus_structure:
busses = [i for i in get_p() if i.get_type() == 'bus'];
diff --git a/grc/base/odict.py b/grc/base/odict.py
index 0c03d753f6..70ab67d053 100644
--- a/grc/base/odict.py
+++ b/grc/base/odict.py
@@ -50,7 +50,7 @@ class odict(DictMixin):
"""
Insert the new key, value entry after the entry given by the position key.
If the positional key is None, insert at the end.
-
+
Args:
pos_key: the positional key
key: the key for the new entry
@@ -65,7 +65,7 @@ class odict(DictMixin):
"""
Insert the new key, value entry before the entry given by the position key.
If the positional key is None, insert at the begining.
-
+
Args:
pos_key: the positional key
key: the key for the new entry
@@ -79,10 +79,10 @@ class odict(DictMixin):
def find(self, key):
"""
Get the value for this key if exists.
-
+
Args:
key: the key to search for
-
+
Returns:
the value or None
"""
@@ -92,10 +92,10 @@ class odict(DictMixin):
def findall(self, key):
"""
Get a list of values for this key.
-
+
Args:
key: the key to search for
-
+
Returns:
a list of values or empty list
"""
diff --git a/grc/blocks/bus_sink.xml b/grc/blocks/bus_sink.xml
index 273b4c517a..029820dc2c 100644
--- a/grc/blocks/bus_sink.xml
+++ b/grc/blocks/bus_sink.xml
@@ -8,13 +8,13 @@
<name>Bus Sink</name>
<key>bus_sink</key>
<make>$yesno.yesno</make>
-
+
<param>
<name>On/Off</name>
<key>yesno</key>
<type>enum</type>
<option>
- <name>On</name>
+ <name>On</name>
<key>on</key>
<opt>yesno:True</opt>
</option>
@@ -23,5 +23,5 @@
<key>off</key>
<opt>yesno:False</opt>
</option>
- </param>
+ </param>
</block>
diff --git a/grc/blocks/bus_source.xml b/grc/blocks/bus_source.xml
index 15e4a9f31b..e5b5c2b9bf 100644
--- a/grc/blocks/bus_source.xml
+++ b/grc/blocks/bus_source.xml
@@ -8,13 +8,13 @@
<name>Bus Source</name>
<key>bus_source</key>
<make>$yesno.yesno</make>
-
+
<param>
<name>On/Off</name>
<key>yesno</key>
<type>enum</type>
<option>
- <name>On</name>
+ <name>On</name>
<key>on</key>
<opt>yesno:True</opt>
</option>
@@ -23,5 +23,5 @@
<key>off</key>
<opt>yesno:False</opt>
</option>
- </param>
+ </param>
</block>
diff --git a/grc/blocks/bus_structure_sink.xml b/grc/blocks/bus_structure_sink.xml
index df16657282..3adac92810 100644
--- a/grc/blocks/bus_structure_sink.xml
+++ b/grc/blocks/bus_structure_sink.xml
@@ -8,11 +8,11 @@
<name>Bus Sink Structure</name>
<key>bus_structure_sink</key>
<make>None</make>
-
+
<param>
<name>Structure</name>
<key>struct</key>
<value></value>
<type>raw</type>
- </param>
+ </param>
</block>
diff --git a/grc/blocks/bus_structure_source.xml b/grc/blocks/bus_structure_source.xml
index 27652ca3b3..34e7c049a2 100644
--- a/grc/blocks/bus_structure_source.xml
+++ b/grc/blocks/bus_structure_source.xml
@@ -8,11 +8,11 @@
<name>Bus Source Structure</name>
<key>bus_structure_source</key>
<make>None</make>
-
+
<param>
<name>Structure</name>
<key>struct</key>
<value></value>
<type>raw</type>
- </param>
+ </param>
</block>
diff --git a/grc/blocks/pad_source.xml b/grc/blocks/pad_source.xml
index b6faebfc68..745e48c080 100644
--- a/grc/blocks/pad_source.xml
+++ b/grc/blocks/pad_source.xml
@@ -62,7 +62,7 @@ None;self.message_port_register_hier_out($label)
<value>1</value>
<type>int</type>
</param>
-
+
<param>
<name>Num Streams</name>
<key>num_streams</key>
diff --git a/grc/grc_gnuradio/blks2/error_rate.py b/grc/grc_gnuradio/blks2/error_rate.py
index 77347ef9e3..9bf387030a 100644
--- a/grc/grc_gnuradio/blks2/error_rate.py
+++ b/grc/grc_gnuradio/blks2/error_rate.py
@@ -63,7 +63,7 @@ class error_rate(gr.hier_block2):
def __init__(self, type='BER', win_size=default_win_size, bits_per_symbol=2):
"""
Error rate constructor.
-
+
Args:
type: a string 'BER' or 'SER'
win_size: the number of samples to calculate over
diff --git a/grc/grc_gnuradio/blks2/packet.py b/grc/grc_gnuradio/blks2/packet.py
index dde3ec722f..25ed3e4dce 100644
--- a/grc/grc_gnuradio/blks2/packet.py
+++ b/grc/grc_gnuradio/blks2/packet.py
@@ -71,7 +71,7 @@ class packet_encoder(gr.hier_block2):
def __init__(self, samples_per_symbol, bits_per_symbol, preamble='', access_code='', pad_for_usrp=True):
"""
packet_mod constructor.
-
+
Args:
samples_per_symbol: number of samples per symbol
bits_per_symbol: number of bits per symbol
@@ -110,7 +110,7 @@ class packet_encoder(gr.hier_block2):
def send_pkt(self, payload):
"""
Wrap the payload in a packet and push onto the message queue.
-
+
Args:
payload: string, data to send
"""
@@ -153,7 +153,7 @@ class packet_decoder(gr.hier_block2):
def __init__(self, access_code='', threshold=-1, callback=None):
"""
packet_demod constructor.
-
+
Args:
access_code: AKA sync vector
threshold: detect access_code with up to threshold bits wrong (0 -> use default)
diff --git a/grc/grc_gnuradio/blks2/selector.py b/grc/grc_gnuradio/blks2/selector.py
index 7ae664823b..24e3844658 100644
--- a/grc/grc_gnuradio/blks2/selector.py
+++ b/grc/grc_gnuradio/blks2/selector.py
@@ -27,7 +27,7 @@ class selector(gr.hier_block2):
def __init__(self, item_size, num_inputs, num_outputs, input_index, output_index):
"""
Selector constructor.
-
+
Args:
item_size: the size of the gr data stream in bytes
num_inputs: the number of inputs (integer)
@@ -58,7 +58,7 @@ class selector(gr.hier_block2):
def _indexes_valid(self):
"""
Are the input and output indexes within range of the number of inputs and outputs?
-
+
Returns:
true if input index and output index are in range
"""
@@ -90,7 +90,7 @@ class selector(gr.hier_block2):
def set_input_index(self, input_index):
"""
Change the block to the new input index if the index changed.
-
+
Args:
input_index: the new input index
"""
@@ -104,7 +104,7 @@ class selector(gr.hier_block2):
def set_output_index(self, output_index):
"""
Change the block to the new output index if the index changed.
-
+
Args:
output_index: the new output index
"""
@@ -121,7 +121,7 @@ class valve(selector):
def __init__(self, item_size, open):
"""
Constructor for valve.
-
+
Args:
item_size: the size of the gr data stream in bytes
open: true if initial valve state is open
@@ -133,7 +133,7 @@ class valve(selector):
def set_open(self, open):
"""
Callback to set open state.
-
+
Args:
open: true to set valve state to open
"""
diff --git a/grc/grc_gnuradio/blks2/tcp.py b/grc/grc_gnuradio/blks2/tcp.py
index 8613c02a17..aee90fad2c 100644
--- a/grc/grc_gnuradio/blks2/tcp.py
+++ b/grc/grc_gnuradio/blks2/tcp.py
@@ -28,12 +28,12 @@ def _get_sock_fd(addr, port, server):
Get the file descriptor for the socket.
As a client, block on connect, dup the socket descriptor.
As a server, block on accept, dup the client descriptor.
-
+
Args:
addr: the ip address string
port: the tcp port number
server: true for server mode, false for client mode
-
+
Returns:
the file descriptor number
"""
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 65969e0d6f..1db333fc5a 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -49,7 +49,7 @@ class ActionHandler:
ActionHandler constructor.
Create the main window, setup the message handler, import the preferences,
and connect all of the action handlers. Finally, enter the gtk main loop and block.
-
+
Args:
file_paths: a list of flow graph file passed from command line
platform: platform module
@@ -81,7 +81,7 @@ class ActionHandler:
* some keys are ignored by the accelerators like the direction keys,
* some keys are not registered to any accelerators but are still used.
When not in focus, gtk and the accelerators handle the the key press.
-
+
Returns:
false to let gtk handle the key action
"""
@@ -95,7 +95,7 @@ class ActionHandler:
Handle the delete event from the main window.
Generated by pressing X to close, alt+f4, or right click+close.
This method in turns calls the state handler to quit.
-
+
Returns:
true
"""
@@ -174,14 +174,14 @@ class ActionHandler:
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
##################################################
- # Create heir block
+ # Create heir block
##################################################
elif action == Actions.BLOCK_CREATE_HIER:
# keeping track of coordinates for pasting later
coords = self.get_flow_graph().get_selected_blocks()[0].get_coordinate()
x,y = coords
- x_min = x
+ x_min = x
y_min = y
pads = [];
@@ -200,9 +200,9 @@ class ActionHandler:
# If a block parameter exists that is a parameter, create a parameter for it
if param.get_value() == flow_param.get_id():
params.append(param.get_value())
-
-
- # keep track of x,y mins for pasting later
+
+
+ # keep track of x,y mins for pasting later
(x,y) = block.get_coordinate()
if x < x_min:
x_min = x
@@ -214,8 +214,8 @@ class ActionHandler:
# Get id of connected blocks
source_id = connection.get_source().get_parent().get_id()
sink_id = connection.get_sink().get_parent().get_id()
-
- # If connected block is not in the list of selected blocks create a pad for it
+
+ # If connected block is not in the list of selected blocks create a pad for it
if self.get_flow_graph().get_block(source_id) not in self.get_flow_graph().get_selected_blocks():
pads.append({'key': connection.get_sink().get_key(), 'coord': connection.get_source().get_coordinate(), 'block_id' : block.get_id(), 'direction': 'source'})
@@ -241,7 +241,7 @@ class ActionHandler:
# Remove the default samp_rate variable block that is created
remove_me = self.get_flow_graph().get_block("samp_rate")
- self.get_flow_graph().remove_element(remove_me)
+ self.get_flow_graph().remove_element(remove_me)
# Add the param blocks along the top of the window
@@ -297,9 +297,9 @@ class ActionHandler:
# Connect the pad to the proper sinks
new_connection = self.get_flow_graph().connect(pad_source,sink)
- # update the new heir block flow graph
+ # update the new heir block flow graph
self.get_flow_graph().update()
-
+
##################################################
# Move/Rotate/Delete/Create
@@ -495,7 +495,7 @@ class ActionHandler:
self.get_flow_graph()._old_selected_port = None
self.get_flow_graph()._new_selected_port = None
Actions.ELEMENT_CREATE()
-
+
elif action == Actions.BUSSIFY_SINKS:
n = {'name':'bus', 'type':'bus'}
for b in self.get_flow_graph().get_selected_blocks():
@@ -563,7 +563,7 @@ class ExecFlowGraphThread(Thread):
def __init__ (self, action_handler):
"""
ExecFlowGraphThread constructor.
-
+
Args:
action_handler: an instance of an ActionHandler
"""
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index f633e7ced0..af07121f3a 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -33,10 +33,10 @@ def handle_key_press(event):
"""
Call the action associated with the key press event.
Both the key value and the mask must have a match.
-
+
Args:
event: a gtk key press event
-
+
Returns:
true if handled
"""
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index b2b391246e..49c0361eb9 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -69,7 +69,7 @@ class Block(Element):
def get_coordinate(self):
"""
Get the coordinate from the position param.
-
+
Returns:
the coordinate tuple (x, y) or (0, 0) if failure
"""
@@ -93,7 +93,7 @@ class Block(Element):
def set_coordinate(self, coor):
"""
Set the coordinate into the position param.
-
+
Args:
coor: the coordinate tuple (x, y)
"""
@@ -102,7 +102,7 @@ class Block(Element):
def get_rotation(self):
"""
Get the rotation from the position param.
-
+
Returns:
the rotation in degrees or 0 if failure
"""
@@ -116,7 +116,7 @@ class Block(Element):
def set_rotation(self, rot):
"""
Set the rotation into the position param.
-
+
Args:
rot: the rotation in degrees
"""
@@ -177,7 +177,7 @@ class Block(Element):
self.H = max(*(
[self.label_height+2*BLOCK_LABEL_PADDING] + [2*PORT_BORDER_SEPARATION + \
sum([port.H + PORT_SEPARATION for port in ports]) - PORT_SEPARATION
- for ports in (self.get_sources_gui(), self.get_sinks_gui())] +
+ for ports in (self.get_sources_gui(), self.get_sinks_gui())] +
[4*PORT_BORDER_SEPARATION + \
sum([(port.H) + PORT_SEPARATION for port in ports]) - PORT_SEPARATION
for ports in ([i for i in self.get_sources_gui() if i.get_type() == 'bus'], [i for i in self.get_sinks_gui() if i.get_type() == 'bus'])]
@@ -186,7 +186,7 @@ class Block(Element):
def draw(self, gc, window):
"""
Draw the signal block with label and inputs/outputs.
-
+
Args:
gc: the graphics context
window: the gtk window to draw on
@@ -210,11 +210,11 @@ class Block(Element):
def what_is_selected(self, coor, coor_m=None):
"""
Get the element that is selected.
-
+
Args:
coor: the (x,y) tuple
coor_m: the (x_m, y_m) tuple
-
+
Returns:
this block, a port, or None
"""
diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py
index 3410e3a93b..5f95c99a0b 100644
--- a/grc/gui/Connection.py
+++ b/grc/gui/Connection.py
@@ -39,7 +39,7 @@ class Connection(Element):
"""
Get the 0,0 coordinate.
Coordinates are irrelevant in connection.
-
+
Returns:
0, 0
"""
@@ -49,7 +49,7 @@ class Connection(Element):
"""
Get the 0 degree rotation.
Rotations are irrelevant in connection.
-
+
Returns:
0
"""
@@ -128,7 +128,7 @@ class Connection(Element):
def draw(self, gc, window):
"""
Draw the connection.
-
+
Args:
gc: the graphics context
window: the gtk window to draw on
diff --git a/grc/gui/Dialogs.py b/grc/gui/Dialogs.py
index 04e4f0a862..873bac9783 100644
--- a/grc/gui/Dialogs.py
+++ b/grc/gui/Dialogs.py
@@ -28,7 +28,7 @@ class TextDisplay(gtk.TextView):
def __init__(self, text=''):
"""
TextDisplay constructor.
-
+
Args:
text: the text to display (string)
"""
@@ -64,16 +64,16 @@ class TextDisplay(gtk.TextView):
def MessageDialogHelper(type, buttons, title=None, markup=None):
"""
Create a modal message dialog and run it.
-
+
Args:
type: the type of message: gtk.MESSAGE_INFO, gtk.MESSAGE_WARNING, gtk.MESSAGE_QUESTION or gtk.MESSAGE_ERROR
buttons: the predefined set of buttons to use:
gtk.BUTTONS_NONE, gtk.BUTTONS_OK, gtk.BUTTONS_CLOSE, gtk.BUTTONS_CANCEL, gtk.BUTTONS_YES_NO, gtk.BUTTONS_OK_CANCEL
-
+
Args:
tittle: the title of the window (string)
markup: the message text with pango markup
-
+
Returns:
the gtk response from run()
"""
diff --git a/grc/gui/DrawingArea.py b/grc/gui/DrawingArea.py
index 05e69e7bc6..448948e7f4 100644
--- a/grc/gui/DrawingArea.py
+++ b/grc/gui/DrawingArea.py
@@ -32,7 +32,7 @@ class DrawingArea(gtk.DrawingArea):
"""
DrawingArea contructor.
Connect event handlers.
-
+
Args:
main_window: the main_window containing all flow graphs
"""
diff --git a/grc/gui/Element.py b/grc/gui/Element.py
index 915bdfb915..c43f0eb35c 100644
--- a/grc/gui/Element.py
+++ b/grc/gui/Element.py
@@ -40,10 +40,10 @@ class Element(object):
"""
Is this element horizontal?
If rotation is None, use this element's rotation.
-
+
Args:
rotation: the optional rotation
-
+
Returns:
true if rotation is horizontal
"""
@@ -54,10 +54,10 @@ class Element(object):
"""
Is this element vertical?
If rotation is None, use this element's rotation.
-
+
Args:
rotation: the optional rotation
-
+
Returns:
true if rotation is vertical
"""
@@ -82,7 +82,7 @@ class Element(object):
def draw(self, gc, window, border_color, bg_color):
"""
Draw in the given window.
-
+
Args:
gc: the graphics context
window: the gtk window to draw on
@@ -104,7 +104,7 @@ class Element(object):
def rotate(self, rotation):
"""
Rotate all of the areas by 90 degrees.
-
+
Args:
rotation: multiple of 90 degrees
"""
@@ -118,7 +118,7 @@ class Element(object):
def set_coordinate(self, coor):
"""
Set the reference coordinate.
-
+
Args:
coor: the coordinate tuple (x,y)
"""
@@ -127,7 +127,7 @@ class Element(object):
def get_parent(self):
"""
Get the parent of this element.
-
+
Returns:
the parent
"""
@@ -136,7 +136,7 @@ class Element(object):
def set_highlighted(self, highlighted):
"""
Set the highlight status.
-
+
Args:
highlighted: true to enable highlighting
"""
@@ -145,7 +145,7 @@ class Element(object):
def is_highlighted(self):
"""
Get the highlight status.
-
+
Returns:
true if highlighted
"""
@@ -153,7 +153,7 @@ class Element(object):
def get_coordinate(self):
"""Get the coordinate.
-
+
Returns:
the coordinate tuple (x,y)
"""
@@ -162,7 +162,7 @@ class Element(object):
def move(self, delta_coor):
"""
Move the element by adding the delta_coor to the current coordinate.
-
+
Args:
delta_coor: (delta_x,delta_y) tuple
"""
@@ -178,7 +178,7 @@ class Element(object):
A positive width is to the right of the coordinate.
A positive height is above the coordinate.
The area is associated with a rotation.
-
+
Args:
rel_coor: (x,y) offset from this element's coordinate
area: (width,height) tuple
@@ -191,7 +191,7 @@ class Element(object):
A line is defined by 2 relative coordinates.
Lines must be horizontal or vertical.
The line is associated with a rotation.
-
+
Args:
rel_coor1: relative (x1,y1) tuple
rel_coor2: relative (x2,y2) tuple
@@ -206,11 +206,11 @@ class Element(object):
Both coordinates specified:
Is this element within the rectangular region defined by both coordinates?
ie: do any area corners or line endpoints fall within the region?
-
+
Args:
coor: the selection coordinate, tuple x, y
coor_m: an additional selection coordinate.
-
+
Returns:
self if one of the areas/lines encompasses coor, else None.
"""
@@ -247,7 +247,7 @@ class Element(object):
def get_rotation(self):
"""
Get the rotation in degrees.
-
+
Returns:
the rotation
"""
@@ -256,7 +256,7 @@ class Element(object):
def set_rotation(self, rotation):
"""
Set the rotation in degrees.
-
+
Args:
rotation: the rotation"""
if rotation not in POSSIBLE_ROTATIONS:
diff --git a/grc/gui/FileDialogs.py b/grc/gui/FileDialogs.py
index e8e859dc60..daea7e450f 100644
--- a/grc/gui/FileDialogs.py
+++ b/grc/gui/FileDialogs.py
@@ -79,7 +79,7 @@ class FileDialogHelper(gtk.FileChooserDialog):
FileDialogHelper contructor.
Create a save or open dialog with cancel and ok buttons.
Use standard settings: no multiple selection, local files only, and the * filter.
-
+
Args:
action: gtk.FILE_CHOOSER_ACTION_OPEN or gtk.FILE_CHOOSER_ACTION_SAVE
title: the title of the dialog (string)
@@ -96,7 +96,7 @@ class FileDialog(FileDialogHelper):
def __init__(self, current_file_path=''):
"""
FileDialog constructor.
-
+
Args:
current_file_path: the current directory or path to the open flow graph
"""
@@ -119,7 +119,7 @@ class FileDialog(FileDialogHelper):
def add_and_set_filter(self, filter):
"""
Add the gtk file filter to the list of filters and set it as the default file filter.
-
+
Args:
filter: a gtk file filter.
"""
@@ -132,7 +132,7 @@ class FileDialog(FileDialogHelper):
If this is a save dialog and the file name is missing the extension, append the file extension.
If the file name with the extension already exists, show a overwrite dialog.
If this is an open dialog, return a list of filenames.
-
+
Returns:
the complete file path
"""
@@ -172,7 +172,7 @@ class FileDialog(FileDialogHelper):
def run(self):
"""
Get the filename and destroy the dialog.
-
+
Returns:
the filename or None if a close/cancel occured.
"""
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index 1103aa1639..2b3d08628a 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -87,7 +87,7 @@ class FlowGraph(Element):
def add_new_block(self, key, coor=None):
"""
Add a block of the given key to this flow graph.
-
+
Args:
key: the block key
coor: an optional coordinate or None for random
@@ -114,7 +114,7 @@ class FlowGraph(Element):
def copy_to_clipboard(self):
"""
Copy the selected blocks and connections into the clipboard.
-
+
Returns:
the clipboard
"""
@@ -142,7 +142,7 @@ class FlowGraph(Element):
def paste_from_clipboard(self, clipboard):
"""
Paste the blocks and connections from the clipboard.
-
+
Args:
clipboard: the nested data of blocks, connections
"""
@@ -192,10 +192,10 @@ class FlowGraph(Element):
def type_controller_modify_selected(self, direction):
"""
Change the registered type controller for the selected signal blocks.
-
+
Args:
direction: +1 or -1
-
+
Returns:
true for change
"""
@@ -204,10 +204,10 @@ class FlowGraph(Element):
def port_controller_modify_selected(self, direction):
"""
Change port controller for the selected signal blocks.
-
+
Args:
direction: +1 or -1
-
+
Returns:
true for changed
"""
@@ -216,10 +216,10 @@ class FlowGraph(Element):
def enable_selected(self, enable):
"""
Enable/disable the selected blocks.
-
+
Args:
enable: true to enable
-
+
Returns:
true if changed
"""
@@ -233,7 +233,7 @@ class FlowGraph(Element):
def move_selected(self, delta_coordinate):
"""
Move the element and by the change in coordinates.
-
+
Args:
delta_coordinate: the change in coordinates
"""
@@ -244,10 +244,10 @@ class FlowGraph(Element):
def rotate_selected(self, rotation):
"""
Rotate the selected blocks by multiples of 90 degrees.
-
+
Args:
rotation: the rotation in degrees
-
+
Returns:
true if changed, otherwise false.
"""
@@ -274,7 +274,7 @@ class FlowGraph(Element):
def remove_selected(self):
"""
Remove selected elements
-
+
Returns:
true if changed.
"""
@@ -362,11 +362,11 @@ class FlowGraph(Element):
Iterate though the elements backwards since top elements are at the end of the list.
If an element is selected, place it at the end of the list so that is is drawn last,
and hence on top. Update the selected port information.
-
+
Args:
coor: the coordinate of the mouse click
coor_m: the coordinate for multi select
-
+
Returns:
the selected blocks and connections or an empty list
"""
@@ -401,7 +401,7 @@ class FlowGraph(Element):
def get_selected_connections(self):
"""
Get a group of selected connections.
-
+
Returns:
sub set of connections in this flow graph
"""
@@ -413,7 +413,7 @@ class FlowGraph(Element):
def get_selected_blocks(self):
"""
Get a group of selected blocks.
-
+
Returns:
sub set of blocks in this flow graph
"""
@@ -425,7 +425,7 @@ class FlowGraph(Element):
def get_selected_block(self):
"""
Get the selected block when a block or port is selected.
-
+
Returns:
a block or None
"""
@@ -434,7 +434,7 @@ class FlowGraph(Element):
def get_selected_elements(self):
"""
Get the group of selected elements.
-
+
Returns:
sub set of elements in this flow graph
"""
@@ -443,7 +443,7 @@ class FlowGraph(Element):
def get_selected_element(self):
"""
Get the selected element.
-
+
Returns:
a block, port, or connection or None
"""
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py
index 12f3b203b0..067131ec96 100644
--- a/grc/gui/MainWindow.py
+++ b/grc/gui/MainWindow.py
@@ -121,7 +121,7 @@ class MainWindow(gtk.Window):
Handle the delete event from the main window.
Generated by pressing X to close, alt+f4, or right click+close.
This method in turns calls the state handler to quit.
-
+
Returns:
true
"""
@@ -133,7 +133,7 @@ class MainWindow(gtk.Window):
Handle a page change. When the user clicks on a new tab,
reload the flow graph to update the vars window and
call handle states (select nothing) to update the buttons.
-
+
Args:
notebook: the notebook
page: new page
@@ -150,7 +150,7 @@ class MainWindow(gtk.Window):
def add_report_line(self, line):
"""
Place line at the end of the text buffer, then scroll its window all the way down.
-
+
Args:
line: the new text
"""
@@ -165,7 +165,7 @@ class MainWindow(gtk.Window):
"""
Create a new notebook page.
Set the tab to be selected.
-
+
Args:
file_path: optional file to load into the flow graph
show: true if the page should be shown after loading
@@ -203,7 +203,7 @@ class MainWindow(gtk.Window):
def close_pages(self):
"""
Close all the pages in this notebook.
-
+
Returns:
true if all closed
"""
@@ -228,7 +228,7 @@ class MainWindow(gtk.Window):
Close the current page.
If the notebook becomes empty, and ensure is true,
call new page upon exit to ensure that at least one page exists.
-
+
Args:
ensure: boolean
"""
@@ -258,7 +258,7 @@ class MainWindow(gtk.Window):
Set the title of the main window.
Set the titles on the page tabs.
Show/hide the reports window.
-
+
Args:
title: the window title
"""
@@ -286,7 +286,7 @@ class MainWindow(gtk.Window):
def get_page(self):
"""
Get the selected page.
-
+
Returns:
the selected page
"""
@@ -295,7 +295,7 @@ class MainWindow(gtk.Window):
def get_flow_graph(self):
"""
Get the selected flow graph.
-
+
Returns:
the selected flow graph
"""
@@ -317,7 +317,7 @@ class MainWindow(gtk.Window):
def _set_page(self, page):
"""
Set the current page.
-
+
Args:
page: the page widget
"""
@@ -327,7 +327,7 @@ class MainWindow(gtk.Window):
def _save_changes(self):
"""
Save changes to flow graph?
-
+
Returns:
true if yes
"""
@@ -339,7 +339,7 @@ class MainWindow(gtk.Window):
def _get_files(self):
"""
Get the file names for all the pages, in order.
-
+
Returns:
list of file paths
"""
@@ -348,7 +348,7 @@ class MainWindow(gtk.Window):
def _get_pages(self):
"""
Get a list of all pages in the notebook.
-
+
Returns:
list of pages
"""
diff --git a/grc/gui/Messages.py b/grc/gui/Messages.py
index 2bf488bb58..3fa78f85d4 100644
--- a/grc/gui/Messages.py
+++ b/grc/gui/Messages.py
@@ -26,7 +26,7 @@ MESSENGERS_LIST = list()
def register_messenger(messenger):
"""
Append the given messenger to the list of messengers.
-
+
Args:
messenger: a method thats takes a string
"""
@@ -35,7 +35,7 @@ def register_messenger(messenger):
def send(message):
"""
Give the message to each of the messengers.
-
+
Args:
message: a message string
"""
diff --git a/grc/gui/NotebookPage.py b/grc/gui/NotebookPage.py
index 10c5dde00d..481aca4eea 100644
--- a/grc/gui/NotebookPage.py
+++ b/grc/gui/NotebookPage.py
@@ -36,7 +36,7 @@ class NotebookPage(gtk.HBox):
def __init__(self, main_window, flow_graph, file_path=''):
"""
Page constructor.
-
+
Args:
main_window: main window
file_path: path to a flow graph file
@@ -91,7 +91,7 @@ class NotebookPage(gtk.HBox):
def get_generator(self):
"""
Get the generator object for this flow graph.
-
+
Returns:
generator
"""
@@ -104,7 +104,7 @@ class NotebookPage(gtk.HBox):
"""
The button was clicked.
Make the current page selected, then close.
-
+
Args:
the: button
"""
@@ -114,7 +114,7 @@ class NotebookPage(gtk.HBox):
def set_markup(self, markup):
"""
Set the markup in this label.
-
+
Args:
markup: the new markup text
"""
@@ -123,7 +123,7 @@ class NotebookPage(gtk.HBox):
def get_tab(self):
"""
Get the gtk widget for this page's tab.
-
+
Returns:
gtk widget
"""
@@ -132,7 +132,7 @@ class NotebookPage(gtk.HBox):
def get_proc(self):
"""
Get the subprocess for the flow graph.
-
+
Returns:
the subprocess object
"""
@@ -141,7 +141,7 @@ class NotebookPage(gtk.HBox):
def set_proc(self, process):
"""
Set the subprocess object.
-
+
Args:
process: the new subprocess
"""
@@ -150,7 +150,7 @@ class NotebookPage(gtk.HBox):
def get_flow_graph(self):
"""
Get the flow graph.
-
+
Returns:
the flow graph
"""
@@ -160,7 +160,7 @@ class NotebookPage(gtk.HBox):
"""
Get the read-only state of the file.
Always false for empty path.
-
+
Returns:
true for read-only
"""
@@ -171,7 +171,7 @@ class NotebookPage(gtk.HBox):
def get_file_path(self):
"""
Get the file path for the flow graph.
-
+
Returns:
the file path or ''
"""
@@ -180,7 +180,7 @@ class NotebookPage(gtk.HBox):
def set_file_path(self, file_path=''):
"""
Set the file path, '' for no file path.
-
+
Args:
file_path: file path string
"""
@@ -190,7 +190,7 @@ class NotebookPage(gtk.HBox):
def get_saved(self):
"""
Get the saved status for the flow graph.
-
+
Returns:
true if saved
"""
@@ -199,7 +199,7 @@ class NotebookPage(gtk.HBox):
def set_saved(self, saved=True):
"""
Set the saved status.
-
+
Args:
saved: boolean status
"""
@@ -208,7 +208,7 @@ class NotebookPage(gtk.HBox):
def get_state_cache(self):
"""
Get the state cache for the flow graph.
-
+
Returns:
the state cache
"""
diff --git a/grc/gui/Param.py b/grc/gui/Param.py
index 2ca20fab2a..499af2e2ed 100644
--- a/grc/gui/Param.py
+++ b/grc/gui/Param.py
@@ -227,7 +227,7 @@ class Param(Element):
An enum requires and combo parameter.
A non-enum with options gets a combined entry/combo parameter.
All others get a standard entry parameter.
-
+
Returns:
gtk input class
"""
@@ -245,7 +245,7 @@ class Param(Element):
def get_markup(self):
"""
Get the markup for this param.
-
+
Returns:
a pango markup string
"""
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
index e542797ea6..8b4edfa430 100644
--- a/grc/gui/Port.py
+++ b/grc/gui/Port.py
@@ -88,7 +88,7 @@ class Port(Element):
self._connector_length = CONNECTOR_EXTENSION_MINIMAL + CONNECTOR_EXTENSION_INCREMENT*index
def modify_height(self, start_height):
type_dict = {'bus':(lambda a: a * 3)};
-
+
if self.get_type() in type_dict:
return type_dict[self.get_type()](start_height);
else:
@@ -119,7 +119,7 @@ class Port(Element):
def draw(self, gc, window):
"""
Draw the socket with a label.
-
+
Args:
gc: the graphics context
window: the gtk window to draw on
@@ -139,7 +139,7 @@ class Port(Element):
def get_connector_coordinate(self):
"""
Get the coordinate where connections may attach to.
-
+
Returns:
the connector coordinate (x, y) tuple
"""
@@ -152,7 +152,7 @@ class Port(Element):
Get the direction that the socket points: 0,90,180,270.
This is the rotation degree if the socket is an output or
the rotation degree + 180 if the socket is an input.
-
+
Returns:
the direction in degrees
"""
@@ -163,7 +163,7 @@ class Port(Element):
"""
Get the length of the connector.
The connector length increases as the port index changes.
-
+
Returns:
the length in pixels
"""
@@ -172,7 +172,7 @@ class Port(Element):
def get_rotation(self):
"""
Get the parent's rotation rather than self.
-
+
Returns:
the parent's rotation
"""
@@ -181,7 +181,7 @@ class Port(Element):
def move(self, delta_coor):
"""
Move the parent rather than self.
-
+
Args:
delta_corr: the (delta_x, delta_y) tuple
"""
@@ -190,7 +190,7 @@ class Port(Element):
def rotate(self, direction):
"""
Rotate the parent rather than self.
-
+
Args:
direction: degrees to rotate
"""
@@ -199,7 +199,7 @@ class Port(Element):
def get_coordinate(self):
"""
Get the parent's coordinate rather than self.
-
+
Returns:
the parents coordinate
"""
@@ -208,7 +208,7 @@ class Port(Element):
def set_highlighted(self, highlight):
"""
Set the parent highlight rather than self.
-
+
Args:
highlight: true to enable highlighting
"""
@@ -217,7 +217,7 @@ class Port(Element):
def is_highlighted(self):
"""
Get the parent's is highlight rather than self.
-
+
Returns:
the parent's highlighting status
"""
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
index 05e997b3e3..d7ba8c51c9 100644
--- a/grc/gui/PropsDialog.py
+++ b/grc/gui/PropsDialog.py
@@ -34,10 +34,10 @@ def get_title_label(title):
"""
Get a title label for the params window.
The title will be bold, underlined, and left justified.
-
+
Args:
title: the text of the title
-
+
Returns:
a gtk object
"""
@@ -56,7 +56,7 @@ class PropsDialog(gtk.Dialog):
def __init__(self, block):
"""
Properties dialog constructor.
-
+
Args:
block: a block instance
"""
@@ -118,7 +118,7 @@ class PropsDialog(gtk.Dialog):
To the props dialog, the hide setting of 'none' and 'part' are identical.
Therefore, the props dialog only cares if the hide setting is/not 'all'.
Make a hash that uniquely represents the params' state.
-
+
Returns:
true if changed
"""
@@ -179,7 +179,7 @@ class PropsDialog(gtk.Dialog):
"""
Handle key presses from the keyboard.
Call the ok response when enter is pressed.
-
+
Returns:
false to forward the keypress
"""
@@ -191,7 +191,7 @@ class PropsDialog(gtk.Dialog):
def run(self):
"""
Run the dialog and get its response.
-
+
Returns:
true if the response was accept
"""
diff --git a/grc/gui/StateCache.py b/grc/gui/StateCache.py
index 558f507716..3cdb5f30ce 100644
--- a/grc/gui/StateCache.py
+++ b/grc/gui/StateCache.py
@@ -30,7 +30,7 @@ class StateCache(object):
def __init__(self, initial_state):
"""
StateCache constructor.
-
+
Args:
initial_state: the intial state (nested data)
"""
@@ -45,7 +45,7 @@ class StateCache(object):
"""
Save a new state.
Place the new state at the next index and add one to the number of previous states.
-
+
Args:
state: the new state
"""
@@ -59,7 +59,7 @@ class StateCache(object):
def get_current_state(self):
"""
Get the state at the current index.
-
+
Returns:
the current state (nested data)
"""
@@ -69,7 +69,7 @@ class StateCache(object):
def get_prev_state(self):
"""
Get the previous state and decrement the current index.
-
+
Returns:
the previous state or None
"""
@@ -83,7 +83,7 @@ class StateCache(object):
def get_next_state(self):
"""
Get the nest state and increment the current index.
-
+
Returns:
the next state or None
"""
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index cc1f8ceb12..ebd5aefca7 100644
--- a/grc/gui/Utils.py
+++ b/grc/gui/Utils.py
@@ -29,7 +29,7 @@ def rotate_pixmap(gc, src_pixmap, dst_pixmap, angle=gtk.gdk.PIXBUF_ROTATE_COUNTE
Load the destination pixmap with a rotated version of the source pixmap.
The source pixmap will be loaded into a pixbuf, rotated, and drawn to the destination pixmap.
The pixbuf is a client-side drawable, where a pixmap is a server-side drawable.
-
+
Args:
gc: the graphics context
src_pixmap: the source pixmap
@@ -49,11 +49,11 @@ def rotate_pixmap(gc, src_pixmap, dst_pixmap, angle=gtk.gdk.PIXBUF_ROTATE_COUNTE
def get_rotated_coordinate(coor, rotation):
"""
Rotate the coordinate by the given rotation.
-
+
Args:
coor: the coordinate x, y tuple
rotation: the angle in degrees
-
+
Returns:
the rotated coordinates
"""
@@ -74,11 +74,11 @@ def get_rotated_coordinate(coor, rotation):
def get_angle_from_coordinates((x1,y1), (x2,y2)):
"""
Given two points, calculate the vector direction from point1 to point2, directions are multiples of 90 degrees.
-
+
Args:
(x1,y1): the coordinate of point 1
(x2,y2): the coordinate of point 2
-
+
Returns:
the direction in degrees
"""
@@ -93,10 +93,10 @@ def parse_template(tmpl_str, **kwargs):
"""
Parse the template string with the given args.
Pass in the xml encode method for pango escape chars.
-
+
Args:
tmpl_str: the template as a string
-
+
Returns:
a string of the parsed template
"""
diff --git a/grc/python/Block.py b/grc/python/Block.py
index 5dffcb3124..7a1c3a254f 100644
--- a/grc/python/Block.py
+++ b/grc/python/Block.py
@@ -34,11 +34,11 @@ class Block(_Block, _GUIBlock):
def __init__(self, flow_graph, n):
"""
Make a new block from nested data.
-
+
Args:
flow: graph the parent element
n: the nested odict
-
+
Returns:
block a new block
"""
@@ -65,14 +65,14 @@ class Block(_Block, _GUIBlock):
bus_structure = self._bus_structure_source;
else:
bus_structure = self._bus_structure_sink;
-
+
bus_structure = self.resolve_dependencies(bus_structure);
-
+
if not bus_structure: return ''
try:
clean_bus_structure = self.get_parent().evaluate(bus_structure)
return clean_bus_structure
-
+
except: return ''
def throttle(self): return bool(self._throttle)
@@ -124,10 +124,10 @@ class Block(_Block, _GUIBlock):
def port_controller_modify(self, direction):
"""
Change the port controller.
-
+
Args:
direction: +1 or -1
-
+
Returns:
true for change
"""
@@ -161,7 +161,7 @@ class Block(_Block, _GUIBlock):
Split each import statement at newlines.
Combine all import statments into a list.
Filter empty imports.
-
+
Returns:
a list of import statements
"""
@@ -173,7 +173,7 @@ class Block(_Block, _GUIBlock):
def get_callbacks(self):
"""
Get a list of function callbacks for this block.
-
+
Returns:
a list of strings
"""
diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py
index 8573f33fc4..114f708cb2 100644
--- a/grc/python/FlowGraph.py
+++ b/grc/python/FlowGraph.py
@@ -41,12 +41,12 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def _eval(self, code, namespace, namespace_hash):
"""
Evaluate the code with the given namespace.
-
+
Args:
code: a string with python code
namespace: a dict representing the namespace
namespace_hash: a unique hash for the namespace
-
+
Returns:
the resultant object
"""
@@ -61,10 +61,10 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_io_signaturev(self, direction):
"""
Get a list of io signatures for this flow graph.
-
+
Args:
direction: a string of 'in' or 'out'
-
+
Returns:
a list of dicts with: type, label, vlen, size
"""
@@ -90,7 +90,7 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_pad_sources(self):
"""
Get a list of pad source blocks sorted by id order.
-
+
Returns:
a list of pad source blocks in this flow graph
"""
@@ -100,7 +100,7 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_pad_sinks(self):
"""
Get a list of pad sink blocks sorted by id order.
-
+
Returns:
a list of pad sink blocks in this flow graph
"""
@@ -135,7 +135,7 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_imports(self):
"""
Get a set of all import statments in this flow graph namespace.
-
+
Returns:
a set of import statements
"""
@@ -147,7 +147,7 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
"""
Get a list of all variables in this flow graph namespace.
Exclude paramterized variables.
-
+
Returns:
a sorted list of variable blocks in order of dependency (indep -> dep)
"""
@@ -157,7 +157,7 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_parameters(self):
"""
Get a list of all paramterized variables in this flow graph namespace.
-
+
Returns:
a list of paramterized variables
"""
@@ -174,15 +174,15 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_bussink(self):
bussink = filter(lambda b: _bussink_searcher.search(b.get_key()), self.get_enabled_blocks())
-
+
for i in bussink:
for j in i.get_params():
if j.get_name() == 'On/Off' and j.get_value() == 'on':
return True;
-
+
return False
-
-
+
+
def get_bussrc(self):
bussrc = filter(lambda b: _bussrc_searcher.search(b.get_key()), self.get_enabled_blocks())
@@ -191,19 +191,19 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
for j in i.get_params():
if j.get_name() == 'On/Off' and j.get_value() == 'on':
return True;
-
+
return False
def get_bus_structure_sink(self):
bussink = filter(lambda b: _bus_struct_sink_searcher.search(b.get_key()), self.get_enabled_blocks())
-
+
return bussink
def get_bus_structure_src(self):
bussrc = filter(lambda b: _bus_struct_src_searcher.search(b.get_key()), self.get_enabled_blocks())
-
+
return bussrc
-
+
def rewrite(self):
"""
@@ -211,19 +211,19 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
"""
def reconnect_bus_blocks():
for block in self.get_blocks():
-
+
if 'bus' in map(lambda a: a.get_type(), block.get_sources_gui()):
-
-
+
+
for i in range(len(block.get_sources_gui())):
if len(block.get_sources_gui()[i].get_connections()) > 0:
source = block.get_sources_gui()[i]
sink = []
-
+
for j in range(len(source.get_connections())):
sink.append(source.get_connections()[j].get_sink());
-
-
+
+
for elt in source.get_connections():
self.remove_element(elt);
for j in sink:
@@ -235,11 +235,11 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def evaluate(self, expr):
"""
Evaluate the expression.
-
+
Args:
expr: the string expression
@throw Exception bad expression
-
+
Returns:
the evaluated data
"""
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index 9bafeb0683..eb24b75732 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -35,7 +35,7 @@ class Generator(object):
"""
Initialize the generator object.
Determine the file to generate.
-
+
Args:
flow_graph: the flow graph object
file_path: the path to write the file to
@@ -74,7 +74,7 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
def get_popen(self):
"""
Execute this python flow graph.
-
+
Returns:
a popen object
"""
@@ -99,7 +99,7 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
def __str__(self):
"""
Convert the flow graph to python code.
-
+
Returns:
a string of python code
"""
diff --git a/grc/python/Param.py b/grc/python/Param.py
index 3d9e52e25f..827355d8d6 100644
--- a/grc/python/Param.py
+++ b/grc/python/Param.py
@@ -66,7 +66,7 @@ class Param(_Param, _GUIParam):
def __repr__(self):
"""
Get the repr (nice string format) for this param.
-
+
Returns:
the string representation
"""
@@ -125,7 +125,7 @@ class Param(_Param, _GUIParam):
def get_color(self):
"""
Get the color that represents this param's type.
-
+
Returns:
a hex color code.
"""
@@ -160,7 +160,7 @@ class Param(_Param, _GUIParam):
If the parameter controls a port type, vlen, or nports, return part.
If the parameter is an empty grid position, return part.
These parameters are redundant to display in the flow graph view.
-
+
Returns:
hide the hide property string
"""
@@ -198,7 +198,7 @@ class Param(_Param, _GUIParam):
def evaluate(self):
"""
Evaluate the value.
-
+
Returns:
evaluated type
"""
@@ -407,7 +407,7 @@ class Param(_Param, _GUIParam):
Convert the value to code.
For string and list types, check the init flag, call evaluate().
This ensures that evaluate() was called to set the xxxify_flags.
-
+
Returns:
a string representing the code
"""
@@ -426,10 +426,10 @@ class Param(_Param, _GUIParam):
def get_all_params(self, type):
"""
Get all the params from the flowgraph that have the given type.
-
+
Args:
type: the specified type
-
+
Returns:
a list of params
"""
diff --git a/grc/python/Port.py b/grc/python/Port.py
index b82995cf6f..68e851f8c9 100644
--- a/grc/python/Port.py
+++ b/grc/python/Port.py
@@ -84,7 +84,7 @@ class Port(_Port, _GUIPort):
def __init__(self, block, n, dir):
"""
Make a new port from nested data.
-
+
Args:
block: the parent element
n: the nested odict
@@ -167,7 +167,7 @@ class Port(_Port, _GUIPort):
"""
Get the vector length.
If the evaluation of vlen cannot be cast to an integer, return 1.
-
+
Returns:
the vector length or 1
"""
@@ -180,7 +180,7 @@ class Port(_Port, _GUIPort):
Get the number of ports.
If already blank, return a blank
If the evaluation of nports cannot be cast to a positive integer, return 1.
-
+
Returns:
the number of ports or 1
"""
@@ -198,7 +198,7 @@ class Port(_Port, _GUIPort):
"""
Get the color that represents this port's type.
Codes differ for ports where the vec length is 1 or greater than 1.
-
+
Returns:
a hex color code.
"""
diff --git a/grc/python/expr_utils.py b/grc/python/expr_utils.py
index 85f420f04c..9e0b2a4a0a 100644
--- a/grc/python/expr_utils.py
+++ b/grc/python/expr_utils.py
@@ -54,10 +54,10 @@ def expr_split(expr):
Split up an expression by non alphanumeric characters, including underscore.
Leave strings in-tact.
#TODO ignore escaped quotes, use raw strings.
-
+
Args:
expr: an expression string
-
+
Returns:
a list of string tokens that form expr
"""
@@ -82,11 +82,11 @@ def expr_split(expr):
def expr_replace(expr, replace_dict):
"""
Search for vars in the expression and add the prepend.
-
+
Args:
expr: an expression string
replace_dict: a dict of find:replace
-
+
Returns:
a new expression with the prepend
"""
@@ -99,11 +99,11 @@ def expr_replace(expr, replace_dict):
def get_variable_dependencies(expr, vars):
"""
Return a set of variables used in this expression.
-
+
Args:
expr: an expression string
vars: a list of variable names
-
+
Returns:
a subset of vars used in the expression
"""
@@ -113,10 +113,10 @@ def get_variable_dependencies(expr, vars):
def get_graph(exprs):
"""
Get a graph representing the variable dependencies
-
+
Args:
exprs: a mapping of variable name to expression
-
+
Returns:
a graph of variable deps
"""
@@ -132,10 +132,10 @@ def get_graph(exprs):
def sort_variables(exprs):
"""
Get a list of variables in order of dependencies.
-
+
Args:
exprs: a mapping of variable name to expression
-
+
Returns:
a list of variable names
@throws Exception circular dependencies
@@ -156,12 +156,12 @@ def sort_variables(exprs):
def sort_objects(objects, get_id, get_expr):
"""
Sort a list of objects according to their expressions.
-
+
Args:
objects: the list of objects to sort
get_id: the function to extract an id from the object
get_expr: the function to extract an expression from the object
-
+
Returns:
a list of sorted objects
"""
diff --git a/grc/python/extract_docs.py b/grc/python/extract_docs.py
index b3b87e64ca..47b2820a1f 100644
--- a/grc/python/extract_docs.py
+++ b/grc/python/extract_docs.py
@@ -23,10 +23,10 @@ def _extract(key):
"""
Extract the documentation from the python __doc__ strings.
If multiple modules match, combine the docs.
-
+
Args:
key: the block key
-
+
Returns:
a string with documentation
"""
@@ -58,10 +58,10 @@ _docs_cache = dict()
def extract(key):
"""
Call the private extract and cache the result.
-
+
Args:
key: the block key
-
+
Returns:
a string with documentation
"""