[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5852 - in grc/branches/jblum_work/src: . Elements Sig
From: |
jblum |
Subject: |
[Commit-gnuradio] r5852 - in grc/branches/jblum_work/src: . Elements SignalBlockDefs |
Date: |
Wed, 27 Jun 2007 00:05:47 -0600 (MDT) |
Author: jblum
Date: 2007-06-27 00:05:46 -0600 (Wed, 27 Jun 2007)
New Revision: 5852
Modified:
grc/branches/jblum_work/src/ActionHandler.py
grc/branches/jblum_work/src/Elements/GraphicalParam.py
grc/branches/jblum_work/src/ExecFlowGraph.py
grc/branches/jblum_work/src/SignalBlockDefs/Misc.py
grc/branches/jblum_work/src/SignalBlockDefs/SignalBlockConstants.py
Log:
switched to _hb.lock/unlock
Modified: grc/branches/jblum_work/src/ActionHandler.py
===================================================================
--- grc/branches/jblum_work/src/ActionHandler.py 2007-06-27 04:35:56 UTC
(rev 5851)
+++ grc/branches/jblum_work/src/ActionHandler.py 2007-06-27 06:05:46 UTC
(rev 5852)
@@ -77,9 +77,9 @@
"""
keyname = gtk.gdk.keyval_name(event.keyval)
#print 'Key "%s" (%d) was pressed' % (keyname, event.keyval)
- if event.state & gtk.gdk.CONTROL_MASK: print "Control was being
held down"
- if event.state & gtk.gdk.MOD1_MASK: print "Alt was being held
down"
- if event.state & gtk.gdk.SHIFT_MASK: print "Shift was being
held down"
+ #if event.state & gtk.gdk.CONTROL_MASK: print "Control was
being held down"
+ #if event.state & gtk.gdk.MOD1_MASK: print "Alt was being held
down"
+ #if event.state & gtk.gdk.SHIFT_MASK: print "Shift was being
held down"
#################### save/open/new/undo/redo
###############################
if event.state & gtk.gdk.CONTROL_MASK and keyname == 's':
self.handle_states(FLOW_GRAPH_SAVE)
Modified: grc/branches/jblum_work/src/Elements/GraphicalParam.py
===================================================================
--- grc/branches/jblum_work/src/Elements/GraphicalParam.py 2007-06-27
04:35:56 UTC (rev 5851)
+++ grc/branches/jblum_work/src/Elements/GraphicalParam.py 2007-06-27
06:05:46 UTC (rev 5852)
@@ -40,7 +40,7 @@
gtk.HBox.__init__(self)
self.data_type = data_type
self._handle_changed = _handle_changed
- self.label = gtk.Label('') #no label, markup is added by
set_markup
+ self.label = gtk.Label() #no label, markup is added by
set_markup
self.label.set_size_request(140,-1)
self.pack_start(self.label, False)
self.set_markup = lambda m: self.label.set_markup(m)
Modified: grc/branches/jblum_work/src/ExecFlowGraph.py
===================================================================
--- grc/branches/jblum_work/src/ExecFlowGraph.py 2007-06-27 04:35:56 UTC
(rev 5851)
+++ grc/branches/jblum_work/src/ExecFlowGraph.py 2007-06-27 06:05:46 UTC
(rev 5852)
@@ -43,30 +43,29 @@
#access methods to runtime
runtime = gr.runtime(self)
self.start = lambda: runtime.start()
- self.stop = lambda: runtime.stop()
- self.restart = lambda: runtime.restart()
+ self.stop = lambda: runtime.stop()
#build the flow graph
self._parse_nested_data(ParseXML.from_xml(ParseXML.from_file(file_path)))
def add_window(self, window, type='', title=''):
- ''' Empty method for adding a window in the GUI flow graph.
'''
+ """Empty method for adding a window in the GUI flow graph."""
pass
def get_panel(self):
- ''' Empty method for getting the wx panel in the GUI flow
graph. '''
- print '''
+ """Empty method for getting the wx panel in the GUI flow
graph."""
+ print """
Graphical Sinks are not supported in ExecFlowGraph.py:
use ExecFlowGraphGUI.py [-d] or remove the Graphical Sink.
-Exiting!'''
+Exiting!"""
exit(-1)
def add_callback(self, function, data_type_params):
- """ Register a callback function with its associated data.
"""
+ """Register a callback function with its associated data."""
self.callbacks.append((function, data_type_params))
def parse_callbacks(self):
- """ For each call back, parse all of the data and
- call the registered callback function on that data. """
+ """For each call back, parse all of the data and
+ call the registered callback function on that data."""
for function, data_type_params in self.callbacks:
try:
if type(data_type_params) in (type(list()),
type(tuple())):
@@ -75,8 +74,8 @@
except: print "error parsing a callback -> ignoring..."
def _parse_nested_data(self, nested_data):
- """ Parse nested data from a flow graph file and build the
graphics.
- This code is partially copied from FlowGraph.py, with
unnecessary code removed. """
+ """Parse nested data from a flow graph file and build the
graphics.
+ This code is partially copied from FlowGraph.py, with
unnecessary code removed."""
find_data = ParseXML.find_data
flow_graph = find_data([nested_data], 'flow_graph')
vars = find_data(flow_graph, 'vars')
@@ -107,17 +106,17 @@
# Option Parser for running a flow graph
##############################################################################################
class FlowGraphOptionParser(OptionParser):
- """ This flow graph option parser provides a basic help,
- and ensures that a flow graph is passed on the command line.
"""
+ """This flow graph option parser provides a basic help,
+ and ensures that a flow graph is passed on the command line."""
def __init__(self):
- """ Create the base option parser and add usage and basic
options. """
+ """Create the base option parser and add usage and basic
options."""
usage = "usage: %prog [options]
flow_graph"+DEFAULT_FILE_EXTENSION
OptionParser.__init__(self, usage=usage)
self.add_option("-p", "--pid_file", action="store",
type="string", dest="pid_file", help="record process id")
def parse_args(self):
- """ Call the base parse_args, handle the basic options,
- and ensure a flow graph was passed in args. Return the
(options, args). """
+ """Call the base parse_args, handle the basic options,
+ and ensure a flow graph was passed in args. Return the
(options, args)."""
(options, args) = OptionParser.parse_args(self)
if options.pid_file:
try: open(options.pid_file, 'w').write('%d\n' %
os.getpid())
Modified: grc/branches/jblum_work/src/SignalBlockDefs/Misc.py
===================================================================
--- grc/branches/jblum_work/src/SignalBlockDefs/Misc.py 2007-06-27 04:35:56 UTC
(rev 5851)
+++ grc/branches/jblum_work/src/SignalBlockDefs/Misc.py 2007-06-27 06:05:46 UTC
(rev 5852)
@@ -91,10 +91,9 @@
class SelectorHelper(gr.hier_block2):
"""A hier2 block with N inputs and M outputs, where data is only
forwarded through input n to output m."""
- def __init__(self, fg, item_size, num_inputs, num_outputs, input_index,
output_index):
+ def __init__(self, item_size, num_inputs, num_outputs, input_index,
output_index):
"""!
SelectorHelper constructor.
- @param fg the gr flow graph
@param item_size the size of the gr data stream in bytes
@param num_inputs the number of inputs (integer)
@param num_outputs the number of outputs (integer)
@@ -110,6 +109,9 @@
self.input_terminators = [gr.null_sink(item_size) for i in
range(num_inputs)]
self.output_terminators = [gr.head(item_size, 0) for i in
range(num_outputs)]
self.copy = gr.skiphead(item_size, 0)
+ self.term_copy_in = gr.head(item_size, 0)
+ self.term_copy_out = gr.null_sink(item_size)
+ self.connect(gr.null_source(item_size), self.term_copy_in,
self.copy, self.term_copy_out)
#connections
for i in range(num_inputs): self.connect((self, i),
self.input_terminators[i])
for i in range(num_outputs):
self.connect(gr.null_source(item_size), self.output_terminators[i], (self, i))
@@ -117,7 +119,6 @@
self.output_index = output_index
self.num_inputs = num_inputs
self.num_outputs = num_outputs
- self.fg = fg
self._connect_current()
def _indexes_valid(self):
@@ -134,9 +135,12 @@
if self._indexes_valid():
self.disconnect((self, self.input_index),
self.input_terminators[self.input_index])
self.disconnect(self.output_terminators[self.output_index], (self,
self.output_index))
+ self.disconnect(self.term_copy_in, self.copy)
+ self.disconnect(self.copy, self.term_copy_out)
self.connect((self, self.input_index), self.copy)
self.connect(self.copy, (self, self.output_index))
-
self.connect(self.output_terminators[self.output_index],
self.input_terminators[self.input_index])
+
self.connect(self.output_terminators[self.output_index],
self.input_terminators[self.input_index])
+ self.connect(self.term_copy_in, self.term_copy_out)
def _disconnect_current(self):
"""If the input and output indexes are valid:
@@ -147,8 +151,11 @@
self.disconnect((self, self.input_index), self.copy)
self.disconnect(self.copy, (self, self.output_index))
self.disconnect(self.output_terminators[self.output_index],
self.input_terminators[self.input_index])
+ self.disconnect(self.term_copy_in, self.term_copy_out)
self.connect((self, self.input_index),
self.input_terminators[self.input_index])
self.connect(self.output_terminators[self.output_index], (self,
self.output_index))
+ self.connect(self.term_copy_in, self.copy)
+ self.connect(self.copy, self.term_copy_out)
def set_input_index(self, input_index):
"""!
@@ -156,23 +163,23 @@
@param input_index the new input index
"""
if self.input_index != input_index:
+ self._hb.lock()
self._disconnect_current()
self.input_index = input_index
self._connect_current()
- print "***\n\nabout to call restart in set input\n\n***"
- self.fg.restart()
+ self._hb.unlock()
def set_output_index(self, output_index):
"""!
Change the block to the new output index if the index changed.
@param output_index the new output index
- """
- if self.output_index != output_index:
+ """
+ if self.output_index != output_index:
+ self._hb.lock()
self._disconnect_current()
self.output_index = output_index
- self._connect_current()
- print "***\n\nabout to call restart in set
output\n\n***"
- self.fg.restart()
+ self._connect_current()
+ self._hb.unlock()
def Selector(sb):
type = Enum(all_choices, 1)
@@ -191,7 +198,6 @@
def make(fg, type, input_index, output_index, num_inputs, num_outputs,
vlen):
item_size = type.parse().get_num_bytes()*vlen.parse()
block = SelectorHelper(
- fg,
item_size,
num_inputs.parse(),
num_outputs.parse(),
Modified: grc/branches/jblum_work/src/SignalBlockDefs/SignalBlockConstants.py
===================================================================
--- grc/branches/jblum_work/src/SignalBlockDefs/SignalBlockConstants.py
2007-06-27 04:35:56 UTC (rev 5851)
+++ grc/branches/jblum_work/src/SignalBlockDefs/SignalBlockConstants.py
2007-06-27 06:05:46 UTC (rev 5852)
@@ -38,14 +38,9 @@
gr.io_signature(1, 1, item_size),
gr.io_signature(1, 1, item_size)
)
- input = output = block
throttle = gr.throttle(item_size, samp_rate)
- if position:
- input = throttle
- self.connect(self, throttle, block, self)
- else:
- output = throttle
- self.connect(self, block, throttle, self)
+ if position: self.connect(self, throttle, block, self)
+ else: self.connect(self, block, throttle, self)
class HierHelper(gr.hier_block2):
"""Wrap a hier2 block around a hier block."""
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5852 - in grc/branches/jblum_work/src: . Elements SignalBlockDefs,
jblum <=