commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7663 - in grc/branches/grc_reloaded/src/grc: . elemen


From: jblum
Subject: [Commit-gnuradio] r7663 - in grc/branches/grc_reloaded/src/grc: . elements gui gui/elements platforms/gnuradio_python platforms/gnuradio_python/blocks platforms/gnuradio_python/blocks/variables
Date: Wed, 13 Feb 2008 12:48:36 -0700 (MST)

Author: jblum
Date: 2008-02-13 12:48:36 -0700 (Wed, 13 Feb 2008)
New Revision: 7663

Modified:
   grc/branches/grc_reloaded/src/grc/ActionHandler.py
   grc/branches/grc_reloaded/src/grc/Actions.py
   grc/branches/grc_reloaded/src/grc/Constants.py
   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/elements/Param.py
   grc/branches/grc_reloaded/src/grc/elements/Port.py
   grc/branches/grc_reloaded/src/grc/gui/MainWindow.py
   grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py
   grc/branches/grc_reloaded/src/grc/gui/SignalBlockSelectionWindow.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Block.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Connection.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Element.py
   grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Param.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Port.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Utils.py
   grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Port.py
   
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/options.xml
   
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:
ports and connections up

Modified: grc/branches/grc_reloaded/src/grc/ActionHandler.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/ActionHandler.py  2008-02-13 19:35:40 UTC 
(rev 7662)
+++ grc/branches/grc_reloaded/src/grc/ActionHandler.py  2008-02-13 19:48:36 UTC 
(rev 7663)
@@ -54,6 +54,7 @@
                self.main_window.connect('key_press_event', 
self._handle_key_press)
                self.get_page = self.main_window.get_page
                self.get_flow_graph = self.main_window.get_flow_graph
+               self.get_focus_flag = 
self.main_window.drawing_area.get_focus_flag
                #setup the messages
                Messages.register_messenger(self.main_window.add_report_line)
                Messages.register_messenger(sys.stdout.write)
@@ -93,22 +94,22 @@
                elif event.state & gtk.gdk.CONTROL_MASK and keyname == 'n':
                        self.handle_states(FLOW_GRAPH_NEW)
                ####################    Delete  ###############################
-               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Delete':    #mouse focus
+               elif self.get_focus_flag() and keyname == 'Delete':     #mouse 
focus
                        self.handle_states(ELEMENT_REMOVE)
                ####################    Rotate  ###############################
-               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Right': #mouse focus
+               elif self.get_focus_flag() and keyname == 'Right': #mouse focus
                        self.handle_states(BLOCK_ROTATE_RIGHT)
-               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Left': #mouse focus
+               elif self.get_focus_flag() and keyname == 'Left': #mouse focus
                        self.handle_states(BLOCK_ROTATE_LEFT)
                ####################    Data Type       
###############################
-               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Down': #mouse focus
+               elif self.get_focus_flag() and keyname == 'Down': #mouse focus
                        self.handle_states(BLOCK_INC_TYPE)
-               elif self.get_flow_graph().get_focus_flag() and keyname == 
'Up': #mouse focus
+               elif self.get_focus_flag() and keyname == 'Up': #mouse focus
                        self.handle_states(BLOCK_DEC_TYPE)
-               ####################    Socket Controllers      
###############################         
-               elif self.get_flow_graph().get_focus_flag() and keyname in 
('equal','plus', 'KP_Add'): #mouse focus
+               ####################    Port Controllers        
###############################         
+               elif self.get_focus_flag() and keyname in ('equal','plus', 
'KP_Add'): #mouse focus
                        self.handle_states(PORT_CONTROLLER_INC)
-               elif self.get_flow_graph().get_focus_flag() and keyname in 
('minus', 'KP_Subtract'): #mouse focus
+               elif self.get_focus_flag() and keyname in ('minus', 
'KP_Subtract'): #mouse focus
                        self.handle_states(PORT_CONTROLLER_DEC)         
                ####################    Exec/Stop/Print 
###############################
                elif keyname == 'F5':
@@ -118,7 +119,7 @@
                elif keyname == 'Print':
                        self.handle_states(FLOW_GRAPH_SCREEN_CAPTURE)
                #propagate this if the fg is not in focus or nothing is selected
-               return self.get_flow_graph().get_focus_flag() and 
self.get_flow_graph().is_selected()
+               return self.get_focus_flag() and 
self.get_flow_graph().is_selected()
         
        def _quit(self, window, event):
                """!
@@ -148,6 +149,7 @@
                contructors of many of the classes used in this application 
enabling them to report any state change.
                @param state a string describing the state change
                """
+               print state
                
##############################################################################################
                #       Initalize/Quit
                
##############################################################################################
@@ -166,7 +168,7 @@
                        if not self.get_page(): self.main_window.new_page() 
#ensure that at least a blank page exists
                elif state == APPLICATION_QUIT:
                        if self.main_window.close_pages():
-                               Preferences.save(self.main_window)
+                               #TODO Preferences.save(self.main_window)
                                gtk.main_quit()
                                exit(0)
                
##############################################################################################

Modified: grc/branches/grc_reloaded/src/grc/Actions.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Actions.py        2008-02-13 19:35:40 UTC 
(rev 7662)
+++ grc/branches/grc_reloaded/src/grc/Actions.py        2008-02-13 19:48:36 UTC 
(rev 7663)
@@ -37,14 +37,14 @@
 
 PARAM_MODIFY = 'param modify'
 
-BLOCK_SELECT = 'signal block select'
-BLOCK_MOVE = 'signal block move'
-BLOCK_ROTATE_LEFT = 'signal block rotate left'
-BLOCK_ROTATE_RIGHT = 'signal block rotate right'
-BLOCK_CREATE = 'signal block create'
-BLOCK_PARAM_MODIFY = 'signal block param modify'
-BLOCK_INC_TYPE = 'signal block increment type'
-BLOCK_DEC_TYPE = 'signal block decrement type'
+BLOCK_SELECT = 'block select'
+BLOCK_MOVE = 'block move'
+BLOCK_ROTATE_LEFT = 'block rotate left'
+BLOCK_ROTATE_RIGHT = 'block rotate right'
+BLOCK_CREATE = 'block create'
+BLOCK_PARAM_MODIFY = 'block param modify'
+BLOCK_INC_TYPE = 'block increment type'
+BLOCK_DEC_TYPE = 'block decrement type'
 
 PORT_CONTROLLER_INC = 'port controller increment'
 PORT_CONTROLLER_DEC = 'port controller decrement'
@@ -88,10 +88,10 @@
        gtk.Action(APPLICATION_QUIT, '_Quit', 'Quit program', 'gtk-quit'),
        gtk.Action(FLOW_GRAPH_UNDO, '_Undo', 'Undo a change to the flow graph', 
'gtk-undo'),
        gtk.Action(FLOW_GRAPH_REDO, '_Redo', 'Redo a change to the flow graph', 
'gtk-redo'),
-       gtk.Action(ELEMENT_REMOVE, '_Delete', 'Delete the selected signal 
block', 'gtk-delete'),
-       gtk.Action(BLOCK_ROTATE_LEFT, 'Rotate _Left', 'Rotate the signal block 
90 degrees', 'gtk-go-back'),
-       gtk.Action(BLOCK_ROTATE_RIGHT, 'Rotate _Right', 'Rotate the signal 
block -90 degrees', 'gtk-go-forward'),
-       gtk.Action(BLOCK_PARAM_MODIFY, '_Properties', 'Modify params for the 
selected signal block', 'gtk-properties'),
+       gtk.Action(ELEMENT_REMOVE, '_Delete', 'Delete the selected block', 
'gtk-delete'),
+       gtk.Action(BLOCK_ROTATE_LEFT, 'Rotate _Left', 'Rotate the block 90 
degrees', 'gtk-go-back'),
+       gtk.Action(BLOCK_ROTATE_RIGHT, 'Rotate _Right', 'Rotate the block -90 
degrees', 'gtk-go-forward'),
+       gtk.Action(BLOCK_PARAM_MODIFY, '_Properties', 'Modify params for the 
selected block', 'gtk-properties'),
        gtk.Action(FLOW_GRAPH_WINDOW_RESIZE, '_Window Size', 'Set the window 
size', 'gtk-edit'),
        gtk.Action(USRP_DIAGNOSTICS_DISPLAY, '_USRP Diagnostics', 'Analyze the 
USRP', 'gtk-dialog-info'),
        gtk.Action(PREFS_WINDOW_DISPLAY, '_Preferences', 'Configure 
Preferences', 'gtk-preferences'),

Modified: grc/branches/grc_reloaded/src/grc/Constants.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Constants.py      2008-02-13 19:35:40 UTC 
(rev 7662)
+++ grc/branches/grc_reloaded/src/grc/Constants.py      2008-02-13 19:48:36 UTC 
(rev 7663)
@@ -47,10 +47,10 @@
 ## Signal block connector lengths
 
######################################################################################################
 
-##The length that a connection must extend from the socket until the length 
depends on the index of the socket.
+##The length that a connection must extend from the port until the length 
depends on the index of the port.
 CONNECTOR_EXTENSION_INITIAL_LENGTH = 11
 
-##The length that a connection must extend from the initial length times the 
index of the socket, after this length, the connection may have a bend.
+##The length that a connection must extend from the initial length times the 
index of the port, after this length, the connection may have a bend.
 CONNECTOR_EXTENSION_LENGTH = 11
 
 
######################################################################################################
@@ -92,8 +92,8 @@
 ##misc window constraints      @{
 REPORTS_WINDOW_HEIGHT = 80
 
-SIGNAL_BLOCK_SELECTION_WINDOW_WIDTH = 250
-SIGNAL_BLOCK_SELECTION_WINDOW_HEIGHT = 250
+BLOCK_SELECTION_WINDOW_WIDTH = 250
+BLOCK_SELECTION_WINDOW_HEIGHT = 250
 
 VARIABLE_MODIFICATION_WINDOW_WIDTH = 250
 VARIABLE_MODIFICATION_WINDOW_HEIGHT = 150
@@ -121,21 +121,21 @@
 address@hidden
 
 
######################################################################################################
-## Constraints on displayable labels and sockets @{
+## Constraints on displayable labels and ports @{
 
######################################################################################################
 
 LABEL_SEPARATION = 4
 LABEL_PADDING_WIDTH=20
 LABEL_PADDING_HEIGHT=10
 
-SOCKET_SEPARATION = 20
-SOCKET_HEIGHT = 17
-SOCKET_WIDTH = 27
-SOCKET_BORDER_SEPARATION = 10
+PORT_SEPARATION = 20
+PORT_HEIGHT = 17
+PORT_WIDTH = 27
+PORT_BORDER_SEPARATION = 10
 
 PARAM_FONT = 'Sans 8'
-SIGNAL_BLOCK_FONT = 'Sans 9 Bold'
-SOCKET_FONT = 'Sans 8'
+BLOCK_FONT = 'Sans 9 Bold'
+PORT_FONT = 'Sans 8'
 address@hidden
 
 
######################################################################################################

Modified: grc/branches/grc_reloaded/src/grc/elements/Block.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Block.py 2008-02-13 19:35:40 UTC 
(rev 7662)
+++ grc/branches/grc_reloaded/src/grc/elements/Block.py 2008-02-13 19:48:36 UTC 
(rev 7663)
@@ -55,7 +55,7 @@
                        {
                                'name': 'ID', 
                                'key': 'id', 
-                               'type': 'block_id_key',
+                               'type': 'var_key',
                        }
                )
                for param in map(lambda n: 
self.get_parent().get_parent().Param(self, n), params):
@@ -102,16 +102,16 @@
                """
                for c in self.get_params() + self.get_sinks() + 
self.get_sources():
                        try: assert(c.is_valid())
-                       except AssertionError: self._add_error_message('Element 
"%s" is not valid.'%c)
+                       except AssertionError: self._add_error_message('%s is 
not valid.'%c)
                for check in self._checks:
                        check_res = self.resolve_dependencies(check)
                        try: 
                                check_eval = 
self.get_parent().evaluate(check_res)
                                try: assert(check_eval)
-                               except AssertionError: 
self._add_error_message('Check "%s" evaluated to false.'%check)
-                       except: self._add_error_message('Check "%s" did not 
evaluate.'%check)
+                               except AssertionError: 
self._add_error_message('Check "%s" evaluated to false.'%check_res)
+                       except: self._add_error_message('Check "%s" did not 
evaluate.'%check_res)
                                
-       def __str__(self): return 'Block: %s(%s)'%(self.get_name(), 
self.get_key())
+       def __str__(self): return 'Block: %s - %s(%s)'%(self.get_id(), 
self.get_name(), self.get_key())
        
        def get_id(self): return self.get_param('id').get_value() 
        

Modified: grc/branches/grc_reloaded/src/grc/elements/Connection.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Connection.py    2008-02-13 
19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/elements/Connection.py    2008-02-13 
19:48:36 UTC (rev 7663)
@@ -24,6 +24,7 @@
 address@hidden Josh Blum
 
 from grc.elements.Element import Element
+from grc.Utils import odict
 
 class Connection(Element):
        
@@ -40,8 +41,8 @@
                source = sink = None
                #separate the source and sink
                for port in (porta, portb):
-                       if hasattr(port, 'is_source') and port.is_source(): 
source = port
-                       if hasattr(port, 'is_sink') and port.is_sink(): sink = 
port
+                       if port.is_source(): source = port
+                       if port.is_sink(): sink = port
                #verify the source and sink
                assert(source and sink)
                #TODO how many connections allowed?
@@ -77,8 +78,8 @@
                @return a nested data odict
                """
                n = odict()
-               n['source_block_id'] = 
self.get_source().get_param('id').get_value()
-               n['sink_block_id'] = self.get_sink().get_param('id').get_value()
+               n['source_block_id'] = 
self.get_source().get_parent().get_param('id').get_value()
+               n['sink_block_id'] = 
self.get_sink().get_parent().get_param('id').get_value()
                n['source_key'] = self.get_source().get_key()
                n['sink_key'] = self.get_sink().get_key()
                return n                

Modified: grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py     2008-02-13 
19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py     2008-02-13 
19:48:36 UTC (rev 7663)
@@ -51,16 +51,25 @@
                @param key the param key for the options block
                @return the value held by that param
                """
-               return self._options_block.get_param(key).get_value()
+               return self._options_block.get_param(key).evaluate()
        
        def is_flow_graph(self): return True
        
        ##############################################
        ## Access Elements
        ##############################################  
-       def get_elements(self): return self._elements + [self._options_block]
        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):
+               """!
+               Get a list of all the elements.
+               Always ensure that the options block is in the list.
+               @return the element list
+               """ 
+               if self._options_block not in self._elements: 
self._elements.append(self._options_block)
+               #TODO stupidity
+               self._elements = list(set(self._elements))
+               return self._elements
        
        def get_new_block(self, key):
                """!
@@ -79,15 +88,12 @@
                Create a connection between porta and portb.
                @param porta a port
                @param portb another port
-               @return the new connection or None for bad connection
+               @throw Exception bad connection
+               @return the new connection
                """
-               try:
-                       connection = self.get_parent.Connection(self, porta, 
portb)
-                       self.get_elements().append(connection)
-                       return connection
-               except AssertionError:
-                       #TODO messages print bad connection
-                       return None
+               connection = self.get_parent().Connection(self, porta, portb)
+               self.get_elements().append(connection)
+               return connection
                
        def remove_element(self, element):
                """!
@@ -148,7 +154,7 @@
                """
                #remove previous elements
                self._elements = list()
-               #TODO error checking, also ignore options block
+               #TODO error checking
                fg_n = n['flow_graph']
                blocks_n = Utils.listify(fg_n, 'block')
                connections_n = Utils.listify(fg_n, 'connection')

Modified: grc/branches/grc_reloaded/src/grc/elements/Param.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Param.py 2008-02-13 19:35:40 UTC 
(rev 7662)
+++ grc/branches/grc_reloaded/src/grc/elements/Param.py 2008-02-13 19:48:36 UTC 
(rev 7663)
@@ -145,7 +145,10 @@
                try: 
                        assert(self.get_type() in self.TYPES)
                        try: self.evaluate()
-                       except: self._add_error_message('Value "%s" cannot be 
evaluated.'%self.get_value())             
+                       except: 
+                               #if the evaluate failed but added no error 
messages, add the generic one below
+                               if not self.get_error_messages():
+                                       self._add_error_message('Value "%s" 
cannot be evaluated.'%self.get_value())             
                except AssertionError: self._add_error_message('Type "%s" is 
not a possible type.'%type)        
                
        def evaluate(self):

Modified: grc/branches/grc_reloaded/src/grc/elements/Port.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/Port.py  2008-02-13 19:35:40 UTC 
(rev 7662)
+++ grc/branches/grc_reloaded/src/grc/elements/Port.py  2008-02-13 19:48:36 UTC 
(rev 7663)
@@ -80,6 +80,13 @@
                connections = filter(lambda c: c.get_source() is self or 
c.get_sink() is self, connections)
                return connections
                
+       def is_connected(self):
+               """!
+               Is this port connected?
+               @return true if at least one connection
+               """
+               return bool(self.get_connections())
+               
        def is_full(self):
                """!
                Is this port full of connections?

Modified: grc/branches/grc_reloaded/src/grc/gui/MainWindow.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/MainWindow.py 2008-02-13 19:35:40 UTC 
(rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/MainWindow.py 2008-02-13 19:48:36 UTC 
(rev 7663)
@@ -323,7 +323,7 @@
                        self.page_to_be_closed = page
                        self.close_page(False)
                if self.notebook.get_n_pages(): return False
-               Preferences.save_files_open(files)
+               #TODO Preferences.save_files_open(files)
                return True
                        
        def close_page(self, ensure=True):

Modified: grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py    
2008-02-13 19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/SignalBlockParamsDialog.py    
2008-02-13 19:48:36 UTC (rev 7663)
@@ -60,7 +60,7 @@
                        label.set_markup('\n\n<b>Documentation: 
%s</b>\n'%self.block.get_name())
                        vbox.pack_start(label, False)   
                        #Create the text box to display notes about the block
-                       vbox.pack_start(TextDisplay(self.block.get_docs()), 
False)
+                       
vbox.pack_start(TextDisplay(self.block.get_doc().strip('\n')), False)
                self.show_all()
                        
        def _handle_changed(self, param):

Modified: grc/branches/grc_reloaded/src/grc/gui/SignalBlockSelectionWindow.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/SignalBlockSelectionWindow.py 
2008-02-13 19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/SignalBlockSelectionWindow.py 
2008-02-13 19:48:36 UTC (rev 7663)
@@ -57,8 +57,8 @@
                scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
                scrolled_window.add_with_viewport(self.treeview)
                scrolled_window.set_size_request(
-                       SIGNAL_BLOCK_SELECTION_WINDOW_WIDTH,
-                       SIGNAL_BLOCK_SELECTION_WINDOW_HEIGHT,
+                       BLOCK_SELECTION_WINDOW_WIDTH,
+                       BLOCK_SELECTION_WINDOW_HEIGHT,
                )
                self.pack_start(scrolled_window)
                #add button

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/Block.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Block.py     2008-02-13 
19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Block.py     2008-02-13 
19:48:36 UTC (rev 7663)
@@ -93,17 +93,17 @@
                self._create_labels()                           
                self.W = self.label_width + 2*LABEL_PADDING_WIDTH
                max_ports = max(len(self.get_sinks()), len(self.get_sources()), 
1)
-               self.H = max(self.label_height+2*LABEL_PADDING_HEIGHT, 
2*SOCKET_BORDER_SEPARATION + max_ports*SOCKET_HEIGHT + 
(max_ports-1)*SOCKET_SEPARATION)          
-               if Utils.is_horizontal(self.get_rotation()): 
self.add_area((0,0),(self.W,self.H))
-               elif Utils.is_vertical(self.get_rotation()): 
self.add_area((0,0),(self.H,self.W))                                       
+               self.H = max(self.label_height+2*LABEL_PADDING_HEIGHT, 
2*PORT_BORDER_SEPARATION + max_ports*PORT_HEIGHT + 
(max_ports-1)*PORT_SEPARATION)                
+               if self.is_horizontal(): self.add_area((0,0),(self.W,self.H))
+               elif self.is_vertical(): self.add_area((0,0),(self.H,self.W))   
                                
                map(lambda p: p.update(), self.get_sinks() + self.get_sources())
        
        def _create_labels(self):
                """Create the labels for the signal block."""
                layouts = list()
                #       create the main layout  #
-               layout = gtk.DrawingArea().create_pango_layout(self.get_name())
-               desc = pango.FontDescription(SIGNAL_BLOCK_FONT)
+               layout = 
gtk.DrawingArea().create_pango_layout(Utils.xml_encode(self.get_name()))
+               desc = pango.FontDescription(BLOCK_FONT)
                layout.set_font_description(desc) 
                layouts.append(layout)
                if not self.is_valid(): layout.set_markup('<span 
foreground="red"><b>'+self.get_name()+'</b></span>')                   
@@ -133,7 +133,7 @@
                        h_off = h + h_off + LABEL_SEPARATION
                #create vertical and horizontal images                  
                self.horizontal_label = image = pixmap.get_image(0, 0, width, 
height)
-               if Utils.is_vertical(self.get_rotation()):
+               if self.is_vertical():
                        self.vertical_label = vimage = 
gtk.gdk.Image(gtk.gdk.IMAGE_NORMAL, pixmap.get_visual(), height, width)
                        for i in range(width):
                                for j in range(height): vimage.put_pixel(j, 
width-i-1, image.get_pixel(i, j))
@@ -147,9 +147,9 @@
                gc = self.get_gc()              
                gc.foreground = Colors.TXT_COLOR
                X,Y = self.get_coordinate()             
-               if Utils.is_horizontal(self.get_rotation()):
+               if self.is_horizontal():
                        window.draw_image(gc, self.horizontal_label, 0, 0, 
X+LABEL_PADDING_WIDTH, Y+(self.H-self.label_height)/2, -1, -1)
-               elif Utils.is_vertical(self.get_rotation()):
+               elif self.is_vertical():
                        window.draw_image(gc, self.vertical_label, 0, 0, 
X+(self.H-self.label_height)/2, Y+LABEL_PADDING_WIDTH, -1, -1)
                map(lambda p: p.draw(window), self.get_sources() + 
self.get_sinks())
                
@@ -187,4 +187,15 @@
                                return True
                        else: port_controller.set_data(old_data)        
#restore previous value
                return False
+               
+       def what_is_selected(self, coor):       
+               """!
+               Get the element that is selected.
+               @param coor the (x,y) tuple
+               @return this signal block, a port, or None
+               """
+               for port in self.get_sources() + self.get_sinks():      
+                       if port.what_is_selected(coor):
+                               return port.what_is_selected(coor)              
+               return Element.what_is_selected(self, coor)
 

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/Connection.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Connection.py        
2008-02-13 19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Connection.py        
2008-02-13 19:48:36 UTC (rev 7663)
@@ -17,50 +17,50 @@
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 """
 address@hidden Elements.GraphicalConnection
-#The graphical connection for input/output sockets.
+#The graphical connection for input/output ports.
 address@hidden Josh Blum
 
-import Element
+import Utils
 from Element import Element
 import Colors
 
 class Connection(Element):
-       """A graphical connection for sockets."""                       
+       """A graphical connection for ports."""                 
        
        def update(self):
                """Add the horizontal and vertical lines that will connect the 
two parameters."""
                self.clear()            
-               input_socket = self.get_input_socket()
-               output_socket = self.get_output_socket()
-               deltaAngle = abs(output_socket.get_connector_direction() - 
input_socket.get_connector_direction())
-               (x1, y1) = output_socket.get_connector_coordinates()[1]
-               self.add_line(*output_socket.get_connector_coordinates())
-               (x2, y2) = input_socket.get_connector_coordinates()[1]
-               self.add_line(*input_socket.get_connector_coordinates())
+               sink = self.get_sink()
+               source = self.get_source()
+               deltaAngle = abs(source.get_connector_direction() - 
sink.get_connector_direction())
+               (x1, y1) = source.get_connector_coordinates()[1]
+               self.add_line(*source.get_connector_coordinates())
+               (x2, y2) = sink.get_connector_coordinates()[1]
+               self.add_line(*sink.get_connector_coordinates())
                if deltaAngle == 180:
                        W = abs(x1 - x2)
                        H = abs(y1 - y2)
                        midX = (x1+x2)/2
                        midY = (y1+y2)/2
                        sW = x1 - x2
-                       if output_socket.get_connector_direction() == 0: sW = 
sW * -1
+                       if source.get_connector_direction() == 0: sW = sW * -1
                        sH = y1 - y2
-                       if output_socket.get_connector_direction() == 270: sH = 
sH * -1
-                       if ((W>H or sW<0) and 
Element.is_horizontal(output_socket.get_connector_direction())) or\
-                               (W>=H and sH>=0 and 
Element.is_vertical(output_socket.get_connector_direction())):
+                       if source.get_connector_direction() == 270: sH = sH * -1
+                       if ((W>H or sW<0) and 
self.is_horizontal(source.get_connector_direction())) or\
+                               (W>=H and sH>=0 and 
self.is_vertical(source.get_connector_direction())):
                                self.add_line((x1,y1),(x1,midY))
                                self.add_line((x1,midY),(x2,midY))
                                self.add_line((x2,y2),(x2,midY))
-                       elif (H>=W and sW>=0 and 
Element.is_horizontal(output_socket.get_connector_direction())) or\
-                               ((H>W or sH<0) and 
Element.is_vertical(output_socket.get_connector_direction())):
+                       elif (H>=W and sW>=0 and 
self.is_horizontal(source.get_connector_direction())) or\
+                               ((H>W or sH<0) and 
self.is_vertical(source.get_connector_direction())):
                                self.add_line((x1,y1),(midX,y1))
                                self.add_line((midX,y1),(midX,y2))
                                self.add_line((x2,y2),(midX,y2))
                else:
                        p1 = (x1, y2)
                        p2 = (x2, y1)
-                       if Element.get_angle_from_coordinates((x1,y1),p1) == 
(output_socket.get_connector_direction()+180)%360 or\
-                               Element.get_angle_from_coordinates((x2,y2),p1) 
== (input_socket.get_connector_direction()+180)%360: p = p2
+                       if Utils.get_angle_from_coordinates((x1,y1),p1) == 
(source.get_connector_direction()+180)%360 or\
+                               Utils.get_angle_from_coordinates((x2,y2),p1) == 
(sink.get_connector_direction()+180)%360: p = p2
                        else: p = p1
                        self.add_line((x1,y1),p)
                        self.add_line((x2,y2),p)        
@@ -71,9 +71,9 @@
                @param window the gtk window to draw on
                """
                self.update()   
-               GraphicalElement.GraphicalElement.draw(self, window)    
-               gc = self.gc                                    
-               '''     draw error lines around the existing lines when data 
types do not match '''
+               Element.draw(self, window)      
+               gc = self.get_gc()                                      
+               #draw error lines around the existing lines when data types do 
not match
                if not self.is_valid():
                        gc.foreground = Colors.ERROR_COLOR      
                        for (x1, y1),(x2, y2) in 
self.lines_dict[self.get_rotation()]:
@@ -83,14 +83,4 @@
                                elif y1 == y2 and y1 > 0 and y2 > 0: #horizontal
                                        window.draw_line(gc, x1, y1-1, x2, y2-1)
                                        window.draw_line(gc, x1, y1+1, x2, y2+1)
-               
-       def is_valid(self):
-               """!
-               Is this connection valid, ie: do the input and output data 
types match?
-               User preferences can override this validity check.
-               @return true if the data types match or if check connections is 
off
-               """
-               import Preferences      #preferences
-               return not Preferences.check_connections() or\
-                       DataTypes.can_connect(self.sockets[0].get_data_type(), 
self.sockets[1].get_data_type()) 
-                                                       
+                       

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/Element.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Element.py   2008-02-13 
19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Element.py   2008-02-13 
19:48:36 UTC (rev 7663)
@@ -43,7 +43,27 @@
                self.set_coordinate((0, 0))             
                self.clear()
                self.set_highlighted(False)
+               
+       def is_horizontal(self, rotation=None):
+               """!
+               Is this element horizontal?
+               If rotation is None, use this element's rotation.
+               @param rotation the optional rotation 
+               @return true if rotation is horizontal
+               """
+               rotation = rotation or self.get_rotation()
+               return rotation in (0, 180)
        
+       def is_vertical(self, rotation=None):
+               """!
+               Is this element vertical?
+               If rotation is None, use this element's rotation.
+               @param rotation the optional rotation 
+               @return true if rotation is vertical
+               """
+               rotation = rotation or self.get_rotation()
+               return rotation in (90, 270)
+               
        def get_gc(self): return self._gc       
 
        def draw(self, window, BG_color=Colors.BG_COLOR, 
FG_color=Colors.FG_COLOR):

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-13 
19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-13 
19:48:36 UTC (rev 7663)
@@ -51,7 +51,7 @@
                self.has_moved = False
                self.mouse_pressed = False
                self.selected_element = None
-               self.is_selected = lambda: self.selected_element != None
+               self.is_selected = lambda: bool(self.selected_element)
                self.count = 0
                
        def get_gc(self): return self.drawing_area.gc
@@ -180,7 +180,8 @@
                """              
                #check the elements     
                for element in reversed(self.get_elements()):
-                       if element.what_is_selected(coor) != None:
+                       if element.what_is_selected(coor):
+                               #TODO remove broken with option block?
                                self.get_elements().remove(element)
                                self.get_elements().append(element)
                                return element.what_is_selected(coor)           
@@ -212,14 +213,13 @@
                        self.drawing_area.draw()
                
        def update(self):
+               print 'fg update'
                """Call update on all elements."""
                map(lambda e: e.update(), self.get_elements())
                #set the size of the flow graph area
                old_x, old_y = self.get_size()
-               try: new_x = int(self.get_option('window_width'))
-               except: new_x = old_x
-               try: new_y = int(self.get_option('window_height'))
-               except: new_y = old_y
+               try: new_x, new_y = self.get_option('window_size')
+               except: new_x, new_y = old_x, old_y
                if new_x != old_x or new_y != old_y: 
self.drawing_area.set_size_request(new_x, new_y)
                #draw the flow graph
                self.draw()
@@ -247,11 +247,14 @@
                                self.handle_states(PORT_SELECT) 
                        elif self.selected_element.is_block(): 
                                self.handle_states(BLOCK_SELECT)                
                        
-                       #this selection and the last were Sockets, try to 
connect them
+                       #this selection and the last were ports, try to connect 
them
                        if old_selection and self.selected_element and 
old_selection is not self.selected_element and\
                                (self.selected_element.is_source() or 
self.selected_element.is_sink()) and\
                                (old_selection.is_source() or 
old_selection.is_sink()):
-                               try: self.connect(old_selection, 
self.selected_element)
+                               try: 
+                                       self.connect(old_selection, 
self.selected_element)
+                                       self.update()
+                                       self.handle_states(CONNECTION_CREATE)
                                except: Messages.send_fail_connection()         
                                
                        if self.selected_element: 
self.selected_element.set_highlighted(True)                                     
                              
                        #double click detected, bring up params dialog if 
possible

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/Param.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Param.py     2008-02-13 
19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Param.py     2008-02-13 
19:48:36 UTC (rev 7663)
@@ -20,6 +20,7 @@
 #GTK objects for handling input and the signal block parameter class.
 address@hidden Josh Blum
 
+import Utils
 from Element import Element
 import pygtk
 pygtk.require('2.0')
@@ -147,10 +148,14 @@
                name = self.get_name()
                #TODO needs a markup is there is a callback
                #if self.variable: name = '<span 
underline="low">%s</span>'%name #alter format if the param is variable
-               if not self.is_valid(): self.input.set_markup('<span 
foreground="red"><b>%s</b></span>'%name)
-               else: self.input.set_markup(name)
-               #set the tooltip                
-               if self.input.tp: self.input.tp.set_tip(self.input.entry, 
str(self))    
+               if not self.is_valid(): 
+                       self.input.set_markup('<span 
foreground="red"><b>%s</b></span>'%name)
+                       tip = '- ' + '\n- '.join(self.get_error_messages())
+               else: 
+                       self.input.set_markup(name)
+                       tip = self.evaluate()           
+               #set the tooltip                
+               if self.input.tp: self.input.tp.set_tip(self.input.entry, 
str(tip))
                #execute the external callback 
                if self.callback: self.callback(self)
 
@@ -181,7 +186,7 @@
                                else: return '%s+%sj'%(float_to_str(var.real), 
float_to_str(var.imag))
                        elif isinstance(var, float): return float_to_str(var)   
                        
                        elif isinstance(var, int): return '%d'%var
-                       else: return var        
+                       else: return str(var)   
                
###########################################################################
                if self.is_valid():
                        data = self.evaluate()
@@ -205,8 +210,8 @@
                                        elif i == X: dt_str = dt_str + ' ... '
                                dt_str = dt_str + ']'
                        else: dt_str = to_str(data)     #other types
-                       return '<b>%s:</b> %s'%(self.get_name(), dt_str)
-               else: return '<span foreground="red"><b>%s:</b> 
error</span>'%self.get_name()
+                       return '<b>%s:</b> 
%s'%(Utils.xml_encode(self.get_name()), Utils.xml_encode(dt_str))
+               else: return '<span foreground="red"><b>%s:</b> 
error</span>'%Utils.xml_encode(self.get_name())
                        
        def get_layout(self):
                """!

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/Port.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Port.py      2008-02-13 
19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Port.py      2008-02-13 
19:48:36 UTC (rev 7663)
@@ -20,7 +20,6 @@
 #The graphical input/output sockets of the signal block.
 address@hidden Josh Blum
 
-import Element as Utils
 from Element import Element
 from grc.Constants import *
 import Colors
@@ -32,59 +31,78 @@
 class Port(Element):
        """The graphical port."""       
                                
+       def __init__(self, *args, **kwargs):
+               """!
+               Port contructor.
+               Create list of connector coordinates.
+               """     
+               Element.__init__(self)
+               self.connector_coordinates = dict()
+                               
        def update(self):
                """Create new areas and labels for the port."""
                self.clear()
                self.BG_color = Colors.get_color(self.get_color())
                self._create_labels()           
-               #       add the input/output area for each rotation angle       
#       
+               #add the input/output area for each rotation angle      
                rotation = self.get_rotation()          
                conExtLen = CONNECTOR_EXTENSION_LENGTH
                conExtInitLen = CONNECTOR_EXTENSION_INITIAL_LENGTH
                conOff = PORT_HEIGHT/2
-               index = self.get_index()
-               if self.is_sink(): length = 
self.get_parent().get_num_input_sockets()
-               elif self.is_source(): length = 
self.get_parent().get_num_output_sockets()
-               offset = (self.get_parent().H - length*PORT_HEIGHT - 
(length-1)*PORT_SEPARATION)/2                      
-               if rotation == 180 or rotation == 270: index = length-index-1   
#reverse the order                              
+               #get a numeric index for this port relative to its sibling ports
+               if self.is_source():
+                       index = self.get_parent().get_sources().index(self)
+               elif self.is_sink():
+                       index = self.get_parent().get_sinks().index(self)       
                        
+               #get the number of sibling ports (including self)
+               if self.is_sink(): length = len(self.get_parent().get_sinks())
+               elif self.is_source(): length = 
len(self.get_parent().get_sources())
+               offset = (self.get_parent().H - length*PORT_HEIGHT - 
(length-1)*PORT_SEPARATION)/2      
+               #reverse the order of ports             
+               if rotation == 180 or rotation == 270: index = length-index-1   
+               #create areas and connector coordinates
                if (self.is_sink() and rotation == 0) or (self.is_source() and 
rotation == 180):                
                        x = -1*PORT_WIDTH
                        y = (PORT_SEPARATION+PORT_HEIGHT)*index+offset
                        self.add_area((x, y), (PORT_WIDTH, PORT_HEIGHT))
-                       if self.is_connected(): 
self.__set_connector_coordinates((x-1, 
y+conOff),(x-conExtInitLen-conExtLen*index, y+conOff))
+                       if self.is_connected(): 
+                               self.__set_connector_coordinates((x-1, 
y+conOff),(x-conExtInitLen-conExtLen*index, y+conOff))
                elif (self.is_source() and rotation == 0) or (self.is_sink() 
and rotation == 180):      
-                       x = self.parent.W
+                       x = self.get_parent().W
                        y = (PORT_SEPARATION+PORT_HEIGHT)*index+offset
                        self.add_area((x, y), (PORT_WIDTH, PORT_HEIGHT))
-                       if self.is_connected(): 
self.__set_connector_coordinates((x+1+PORT_WIDTH, 
y+conOff),(x+conExtInitLen+PORT_WIDTH+conExtLen*index, y+conOff))
+                       if self.is_connected(): 
+                               
self.__set_connector_coordinates((x+1+PORT_WIDTH, 
y+conOff),(x+conExtInitLen+PORT_WIDTH+conExtLen*index, y+conOff))
                elif (self.is_source() and rotation == 90) or (self.is_sink() 
and rotation == 270):             
                        y = -1*PORT_WIDTH
                        x = (PORT_SEPARATION+PORT_HEIGHT)*index+offset
                        self.add_area((x, y), (PORT_HEIGHT, PORT_WIDTH))
-                       if self.is_connected(): 
self.__set_connector_coordinates((x+conOff, y-1),(x+conOff, 
y-conExtInitLen-conExtLen*index))
+                       if self.is_connected(): 
+                               self.__set_connector_coordinates((x+conOff, 
y-1),(x+conOff, y-conExtInitLen-conExtLen*index))
                elif (self.is_sink() and rotation == 90) or (self.is_source() 
and rotation == 270):     
-                       y = self.parent.W
+                       y = self.get_parent().W
                        x = (PORT_SEPARATION+PORT_HEIGHT)*index+offset
                        self.add_area((x, y), (PORT_HEIGHT, PORT_WIDTH))
-                       if self.is_connected(): 
self.__set_connector_coordinates((x+conOff, y+1+PORT_WIDTH),(x+conOff, 
y+PORT_WIDTH+conExtInitLen+conExtLen*index))
+                       if self.is_connected(): 
+                               self.__set_connector_coordinates((x+conOff, 
y+1+PORT_WIDTH),(x+conOff, y+PORT_WIDTH+conExtInitLen+conExtLen*index))
                        
        def _create_labels(self):
                """Create the labels for the socket."""
-               #       create the layout       #
-               layout = gtk.DrawingArea().create_pango_layout(self.cname)
+               #create the layout
+               layout = gtk.DrawingArea().create_pango_layout(self.get_name())
                desc = pango.FontDescription(PORT_FONT)
                layout.set_font_description(desc) 
                w,h = self.w,self.h = layout.get_pixel_size()   
-               #       create the pixmap       #                       
-               pixmap = gtk.gdk.Pixmap(self.get_parent().get_parent().window, 
w, h, -1)
+               #create the pixmap      
+               pixmap = 
gtk.gdk.Pixmap(self.get_parent().get_parent().get_window(), w, h, -1)
                gc = pixmap.new_gc()
                gc.foreground = self.BG_color
                pixmap.draw_rectangle(gc, True, 0, 0, w, h)
                gc.foreground = Colors.TXT_COLOR
                pixmap.draw_layout(gc, 0, 0, layout)
-               #       create the images       #
+               #create the images
                self.horizontal_label = image = pixmap.get_image(0, 0, w, h)    
-               if Utils.is_vertical(self.get_rotation()):      
+               if self.is_vertical():  
                        self.vertical_label = vimage = 
gtk.gdk.Image(gtk.gdk.IMAGE_NORMAL, pixmap.get_visual(), h, w)
                        for i in range(w):
                                for j in range(h): vimage.put_pixel(j, w-i-1, 
image.get_pixel(i, j))
@@ -94,13 +112,15 @@
                Draw the socket with a label.
                @param window the gtk window to draw on
                """
-               GraphicalUtils.GraphicalUtils.draw(self, window, 
BG_color=self.BG_color)                                
-               gc = self.gc                            
+               Element.draw(self, window, BG_color=self.BG_color)              
                
+               gc = self.get_gc()                              
                gc.foreground = Colors.TXT_COLOR
                X,Y = self.get_coordinate()
                (x,y),(w,h) = self.areas_dict[self.get_rotation()][0] #use the 
first area's sizes to place the labels
-               if Utils.is_horizontal(self.get_rotation()): 
window.draw_image(gc, self.horizontal_label, 0, 0, x+X+(PORT_WIDTH-self.w)/2, 
y+Y+(PORT_HEIGHT-self.h)/2, -1, -1)
-               elif Utils.is_vertical(self.get_rotation()): 
window.draw_image(gc, self.vertical_label, 0, 0, x+X+(PORT_HEIGHT-self.h)/2, 
y+Y+(PORT_WIDTH-self.w)/2, -1, -1)
+               if self.is_horizontal(): 
+                       window.draw_image(gc, self.horizontal_label, 0, 0, 
x+X+(PORT_WIDTH-self.w)/2, y+Y+(PORT_HEIGHT-self.h)/2, -1, -1)
+               elif self.is_vertical(): 
+                       window.draw_image(gc, self.vertical_label, 0, 0, 
x+X+(PORT_HEIGHT-self.h)/2, y+Y+(PORT_WIDTH-self.w)/2, -1, -1)
        
        def __set_connector_coordinates(self, coor_inner, coor_outer, 
rotation=None):
                """!
@@ -110,7 +130,7 @@
                @param coor_outer the coordinate out of the socket
                @param rotation rotation in degrees
                """
-               if rotation == None: rotation = self.get_rotation()     
+               rotation = rotation or self.get_rotation()
                self.connector_coordinates[rotation] = coor_inner, coor_outer   
        
        def get_connector_coordinates(self, rotation=None):
@@ -132,7 +152,46 @@
                @return the direction in degrees
                """     
                if self.is_source(): return self.get_rotation()
-               elif self.is_sink(): return (self.get_rotation() + 180)%360     
                        
-       
-       
+               elif self.is_sink(): return (self.get_rotation() + 180)%360     
                
+       def get_rotation(self):
+               """!
+               Get the parent's rotation rather than self.
+               @return the parent's rotation
+               """
+               return self.get_parent().get_rotation()
+               
+       def move(self, delta_coor):
+               """!
+               Move the parent rather than self.
+               @param delta_corr the (delta_x, delta_y) tuple
+               """
+               self.get_parent().move(delta_coor)
+               
+       def rotate(self, direction):
+               """!
+               Rotate the parent rather than self.
+               @param direction degrees to rotate
+               """
+               self.get_parent().rotate(direction)
+               
+       def get_coordinate(self):
+               """!
+               Get the parent's coordinate rather than self.
+               @return the parents coordinate
+               """
+               return self.get_parent().get_coordinate()
+               
+       def set_highlighted(self, highlight):
+               """!
+               Set the parent highlight rather than self.
+               @param highlight true to enable highlighting
+               """
+               self.get_parent().set_highlighted(highlight)
+               
+       def is_highlighted(self):
+               """!
+               Get the parent's is highlight rather than self.
+               @return the parent's highlighting status
+               """
+               return self.get_parent().is_highlighted()               

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/Utils.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Utils.py     2008-02-13 
19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Utils.py     2008-02-13 
19:48:36 UTC (rev 7663)
@@ -20,12 +20,6 @@
 #Shared functions for flow graph elements.
 address@hidden Josh Blum
 
-##     True if the rotation is 90 or 270 degrees.
-is_vertical = lambda rot: rot in (90, 270)     
-
-##     True if the rotation is 0 or 180 degrees.
-is_horizontal = lambda rot: rot in (0, 180)
-
 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.
@@ -40,3 +34,19 @@
                if y2 > y1: return 270
                else: return 90
 
+def xml_encode(string):
+       """
+       Encode a string into an xml safe string by replacing special characters.
+       @param string the input string
+       @return output string with safe characters
+       """
+       string = str(string)
+       for char, safe in (
+                       ('&', '&amp;'),
+                       ('<', '&lt;'),
+                       ('>', '&gt;'),
+                       ('"', '&quot;'),
+                       ("'", '&apos;'),
+       ): string = string.replace(char, safe)
+       return string
+

Modified: grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Port.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Port.py 
2008-02-13 19:35:40 UTC (rev 7662)
+++ grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/Port.py 
2008-02-13 19:48:36 UTC (rev 7663)
@@ -81,7 +81,7 @@
                try: return int(self.get_parent().get_parent().evaluate(nports))
                except: return 1        
        
-       def get_optional(self): return 
self.get_parent().resolve_dependencies(self._optional)
+       def get_optional(self): return bool(self._optional)
        
        def get_color(self): 
                """

Modified: 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/options.xml
===================================================================
--- 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/options.xml  
    2008-02-13 19:35:40 UTC (rev 7662)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/options.xml  
    2008-02-13 19:48:36 UTC (rev 7663)
@@ -24,18 +24,12 @@
                <type>string</type>                     
        </param>
        <param>
-               <name>Window Width</name>
-               <key>window_width</key>
-               <value>800</value>
-               <type>int</type>                
+               <name>Window Size</name>
+               <key>window_size</key>
+               <value>800, 600</value>
+               <type>int_vector</type>
        </param>
        <param>
-               <name>Window Height</name>
-               <key>window_height</key>
-               <value>600</value>
-               <type>int</type>
-       </param>
-       <param>
                <name>Generate Options</name>
                <key>generate_options</key>
                <value>wx</value>
@@ -49,6 +43,7 @@
                        <key>no_gui</key>       
                </option>
        </param>        
-       <check>400 &lt;= $window_width &lt;= 1600</check>
-       <check>300 &lt;= $window_height &lt;= 1200</check>
+       <check>len(($window_size)) == 2</check>
+       <check>400 &lt;= ($window_size)[0] &lt;= 1600</check>
+       <check>300 &lt;= ($window_size)[1] &lt;= 1200</check>
 </block>

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-13 19:35:40 UTC (rev 7662)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable.xml
   2008-02-13 19:48:36 UTC (rev 7663)
@@ -12,11 +12,13 @@
        <param>
                <name>Key</name>
                <key>key</key>
+               <value>my_var</value>
                <type>var_key</type>
        </param>
        <param>
                <name>Value</name>
                <key>value</key>
+               <value>0</value>
                <type>raw</type>
        </param>
        <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-13 19:35:40 UTC (rev 7662)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_button.xml
    2008-02-13 19:48:36 UTC (rev 7663)
@@ -12,6 +12,7 @@
        <param>
                <name>Key</name>
                <key>key</key>
+               <value>my_var</value>
                <type>var_key</type>
        </param>
        <param>

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-13 19:35:40 UTC (rev 7662)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_drop_down.xml
 2008-02-13 19:48:36 UTC (rev 7663)
@@ -12,6 +12,7 @@
        <param>
                <name>Key</name>
                <key>key</key>
+               <value>my_var</value>
                <type>var_key</type>
        </param>
        <param>

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-13 19:35:40 UTC (rev 7662)
+++ 
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/variables/variable_slider.xml
    2008-02-13 19:48:36 UTC (rev 7663)
@@ -12,6 +12,7 @@
        <param>
                <name>Key</name>
                <key>key</key>
+               <value>my_var</value>
                <type>var_key</type>
        </param>
        <param>





reply via email to

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