commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r7722 - in grc/branches/grc_reloaded: notes src/grc/el


From: jblum
Subject: [Commit-gnuradio] r7722 - in grc/branches/grc_reloaded: notes src/grc/elements src/grc/gui src/grc/gui/elements src/grc/platforms/gnuradio_python src/grc/platforms/gnuradio_python/blocks/variables
Date: Sun, 17 Feb 2008 00:01:10 -0700 (MST)

Author: jblum
Date: 2008-02-17 00:01:09 -0700 (Sun, 17 Feb 2008)
New Revision: 7722

Modified:
   grc/branches/grc_reloaded/notes/todo.txt
   grc/branches/grc_reloaded/src/grc/elements/Block.py
   grc/branches/grc_reloaded/src/grc/elements/Connection.py
   grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py
   grc/branches/grc_reloaded/src/grc/gui/FileDialogs.py
   grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py
   grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Block.py
   
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable.xml
   
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_button.xml
   
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_drop_down.xml
   
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_slider.xml
Log:
connections working

Modified: grc/branches/grc_reloaded/notes/todo.txt
===================================================================
--- grc/branches/grc_reloaded/notes/todo.txt    2008-02-17 00:37:00 UTC (rev 
7721)
+++ grc/branches/grc_reloaded/notes/todo.txt    2008-02-17 07:01:09 UTC (rev 
7722)
@@ -4,6 +4,7 @@
 reload(usrp) in usrp diagnostics
 generate code
 setup.py for grc
+update dtds
 
 ############   Blocks to Add:  ####################
 -ofdm (blks2)
@@ -23,7 +24,6 @@
 -save working directory after close
 -create sub-flow graphs to be used in larger flow graphs
 -include dtd in saved flow graphs
--press enter to close params
 -copy and paste blocks
 
 ############   wxPython Features:      ####################

Modified: grc/branches/grc_reloaded/src/grc/elements/Block.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Block.py 2008-02-17 00:37:00 UTC 
(rev 7721)
+++ grc/branches/grc_reloaded/src/grc/elements/Block.py 2008-02-17 07:01:09 UTC 
(rev 7722)
@@ -194,3 +194,4 @@
                        key = param_n['key']
                        value = param_n['value']
                        self.get_param(key).set_value(value)
+               self.validate()

Modified: grc/branches/grc_reloaded/src/grc/elements/Connection.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Connection.py    2008-02-17 
00:37:00 UTC (rev 7721)
+++ grc/branches/grc_reloaded/src/grc/elements/Connection.py    2008-02-17 
07:01:09 UTC (rev 7722)
@@ -45,7 +45,8 @@
                        if port.is_sink(): sink = port
                #verify the source and sink
                assert(source and sink)
-               #TODO how many connections allowed?
+               assert(not source.is_full())
+               assert(not sink.is_full())
                self._source = source
                self._sink = sink               
        

Modified: grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py     2008-02-17 
00:37:00 UTC (rev 7721)
+++ grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py     2008-02-17 
07:01:09 UTC (rev 7722)
@@ -54,7 +54,8 @@
        
        ##############################################
        ## Access Elements
-       ##############################################  
+       ##############################################
+       def get_block(self, id): return filter(lambda b: b.get_id() == id, 
self.get_blocks())[0]
        def get_blocks(self): return filter(lambda e: e.is_block(), 
self.get_elements())
        def get_connections(self): return filter(lambda e: e.is_connection(), 
self.get_elements())
        def get_elements(self):
@@ -188,11 +189,12 @@
                                sink_key = connection_n['sink_key']
                                #verify the ports
                                assert(source_key in 
source_block.get_source_keys())
-                               assert(sink_key in source_block.get_sink_keys())
+                               assert(sink_key in sink_block.get_sink_keys())
                                #get the ports
                                source = source_block.get_source(source_key)
                                sink = sink_block.get_sink(sink_key)
                                #build the connection
                                self.connect(source, sink)
-                       except AssertionError: pass #TODO messages print 
problem                
+                       except AssertionError: pass #TODO messages print problem
+               self.validate()
                

Modified: grc/branches/grc_reloaded/src/grc/gui/FileDialogs.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/FileDialogs.py        2008-02-17 
00:37:00 UTC (rev 7721)
+++ grc/branches/grc_reloaded/src/grc/gui/FileDialogs.py        2008-02-17 
07:01:09 UTC (rev 7722)
@@ -68,7 +68,7 @@
                self.connect('key_press_event', self._handle_key_press)
 
        def _handle_key_press(self, widget, event):
-               """
+               """!
                Handle key presses from the keyboard.
                Call the ok response when enter is pressed.     
                @return false to forward the keypress

Modified: grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py    
2008-02-17 00:37:00 UTC (rev 7721)
+++ grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py    
2008-02-17 07:01:09 UTC (rev 7722)
@@ -73,7 +73,18 @@
                        vbox.pack_start(get_title_label('Documentation'), False)
                        #Create the text box to display notes about the block
                        
vbox.pack_start(TextDisplay(self.block.get_doc().strip('\n')), False)
+               self.connect('key_press_event', self._handle_key_press)
                self.show_all()
+               
+       def _handle_key_press(self, widget, event):
+               """!
+               Handle key presses from the keyboard.
+               Call the ok response when enter is pressed.     
+               @return false to forward the keypress
+               """
+               keyname = gtk.gdk.keyval_name(event.keyval)
+               if keyname == 'Return': self.response(gtk.RESPONSE_OK)          
        
+               return False #forward the keypress
                        
        def _handle_changed(self, param):
                """!

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-17 
00:37:00 UTC (rev 7721)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-17 
07:01:09 UTC (rev 7722)
@@ -262,8 +262,10 @@
        
##########################################################################      
                
        def handle_mouse_button_press(self, left_click, double_click, 
coordinate):
-               """ A mouse button is pressed. Record the state of the mouse, 
find the selected element,
-               set the Element highlighted, handle the state change, and 
redraw the FlowGraph."""              
+               """!
+               A mouse button is pressed. Record the state of the mouse, find 
the selected element,
+               set the Element highlighted, handle the state change, and 
redraw the FlowGraph.
+               """             
                self.set_coordinate(coordinate)
                if left_click:
                        if self.selected_element: 
self.selected_element.set_highlighted(False)
@@ -297,7 +299,9 @@
                        self.draw()
                
        def handle_mouse_button_release(self, left_click, coordinate):
-               """A mouse button is released, record the state."""
+               """!
+               A mouse button is released, record the state.
+               """
                self.set_coordinate(coordinate)
                if left_click:
                        self.mouse_pressed = False
@@ -317,25 +321,25 @@
                                self.has_moved = False
                
        def handle_mouse_motion(self, coordinate):              
-               """
+               """!
                The mouse has moved. If mouse_pressed is true, react to the 
motions:    
                If an Element is highlighted, this will move the Element by 
redrawing it at the new position.
                """
-               fgW,fgH = self.get_size()
                self.count = (1 + 
self.count)%MOTION_DETECT_REDRAWING_SENSITIVITY
                #to perform a movement, the mouse must be pressed, an element 
selected, count of zero.
                if self.mouse_pressed and\
                        self.count == 0 and\
                        self.selected_element:
-                       #The event coordinates must be within 10 pixels away 
from the bounds of the flow graph.
+                       #The event coordinates must be within BPS pixels away 
from the bounds of the flow graph.
+                       fgW,fgH = self.get_size()
                        x,y = coordinate
                        if x <= BORDER_PROXIMITY_SENSITIVITY:
                                x = BORDER_PROXIMITY_SENSITIVITY
-                       if      x >= fgW - BORDER_PROXIMITY_SENSITIVITY:
+                       elif    x >= fgW - BORDER_PROXIMITY_SENSITIVITY:
                                x = fgW - BORDER_PROXIMITY_SENSITIVITY          
                        
                        if y <= BORDER_PROXIMITY_SENSITIVITY:
                                y = BORDER_PROXIMITY_SENSITIVITY
-                       if      y >= fgH - BORDER_PROXIMITY_SENSITIVITY:        
+                       elif    y >= fgH - BORDER_PROXIMITY_SENSITIVITY:        
                                y = fgH - BORDER_PROXIMITY_SENSITIVITY  
                        #get the change in coordinates  
                        X,Y = self.get_coordinate()

Modified: grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Block.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Block.py        
2008-02-17 00:37:00 UTC (rev 7721)
+++ grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Block.py        
2008-02-17 07:01:09 UTC (rev 7722)
@@ -76,7 +76,7 @@
                                for key in map(str, range(nports, num_ports)):
                                        port = ports[key]
                                        for connection in 
port.get_connections():
-                                               self.remove_element(connection)
+                                               
self.get_parent().remove_element(connection)
                                #remove the ports
                                for key in map(str, range(nports, num_ports)): 
ports.pop(key)
                                continue

Modified: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable.xml
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable.xml
   2008-02-17 00:37:00 UTC (rev 7721)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable.xml
   2008-02-17 07:01:09 UTC (rev 7722)
@@ -16,8 +16,7 @@
                <type>raw</type>
        </param>
        <doc>
-This block maps a value to a variable key. 
-The variable key must be unique and the value must evaluate to a python value.
+This block maps a value to a unique variable.
 This variable block has no graphical representation.
 Use the variable slider, enum, or button for graphical options.
        </doc>  

Modified: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_button.xml
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_button.xml
    2008-02-17 00:37:00 UTC (rev 7721)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_button.xml
    2008-02-17 07:01:09 UTC (rev 7722)
@@ -8,10 +8,10 @@
 <block>
        <name>Variable Button</name>
        <key>variable_button</key>
-       <fcn>($off_value, $on_value)[$default_value]</fcn>
+       <fcn>($off_value, $on_value)[$value_index:i]</fcn>
        <param>
                <name>Default Value</name>      
-               <key>default_value</key>
+               <key>value_index</key>
                <value>on</value>
                <type>enum</type>
                <option>
@@ -39,6 +39,6 @@
        </param>
        <doc>
 This block creates a variable with a button. 
-The variable key must be unique.
+The button has 2 states, on and off.
        </doc>
 </block>

Modified: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_drop_down.xml
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_drop_down.xml
 2008-02-17 00:37:00 UTC (rev 7721)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_drop_down.xml
 2008-02-17 07:01:09 UTC (rev 7722)
@@ -8,24 +8,23 @@
 <block>
        <name>Variable Drop Down</name>
        <key>variable_drop_down</key>
-       <fcn>$choices[$default_value]</fcn>
+       <fcn>$choices[$value_index]</fcn>
        <param>
-               <name>Default Value</name>
-               <key>default_value</key>
+               <name>Value Index</name>
+               <key>value_index</key>
                <value>0</value>
                <type>int</type>
        </param>
        <param>
                <name>Choices</name>
                <key>choices</key>
-               <value>[val0, val1, val2...]</value>
+               <value>[1, 2, 3]</value>
                <type>raw</type>
        </param>
-       <check>$choices[$default_value]</check>
+       <check>$choices[$value_index]</check>
        <doc>
 This block creates a variable with a drop down. 
-The variable key must be unique.
-The default value is the index of a particular choice.
+The value index is the index of a particular choice.
 The choices must be a list of possible values.
        </doc>
 </block>

Modified: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_slider.xml
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_slider.xml
    2008-02-17 00:37:00 UTC (rev 7721)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_slider.xml
    2008-02-17 07:01:09 UTC (rev 7722)
@@ -10,31 +10,36 @@
        <key>variable_slider</key>
        <fcn>$value</fcn>
        <param>
-               <name>Value</name>
+               <name>Default Value</name>
                <key>value</key>
+               <value>50</value>
                <type>real</type>
        </param>
        <param>
                <name>Minimum</name>
                <key>min</key>
+               <value>0</value>
                <type>real</type>
        </param>
        <param>
                <name>Maximum</name>
                <key>max</key>
+               <value>100</value>
                <type>real</type>
        </param>
        <param>
-               <name>Step Size</name>
+               <name>Num Steps</name>
                <key>step</key>
-               <type>real</type>
+               <value>100</value>
+               <type>int</type>
        </param>
        <check>$min &lt;= $value &lt;= $max</check>
+       <check>$min &lt; $max</check>
+       <check>0 &lt; $step &lt;= 1000</check>
        <doc>
 This block creates a variable with a slider. 
-The variable key must be unique.
 The value must be a real number.
 The value must be between the minimum and the maximum.
-The step size must be TODO.
+The number of steps must be between 0 and 1000.
        </doc>
 </block>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]