commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9012 - grc/trunk/src/grc_gnuradio


From: jblum
Subject: [Commit-gnuradio] r9012 - grc/trunk/src/grc_gnuradio
Date: Thu, 24 Jul 2008 18:24:25 -0600 (MDT)

Author: jblum
Date: 2008-07-24 18:24:25 -0600 (Thu, 24 Jul 2008)
New Revision: 9012

Modified:
   grc/trunk/src/grc_gnuradio/Block.py
   grc/trunk/src/grc_gnuradio/Port.py
Log:
nports fix

Modified: grc/trunk/src/grc_gnuradio/Block.py
===================================================================
--- grc/trunk/src/grc_gnuradio/Block.py 2008-07-25 00:13:12 UTC (rev 9011)
+++ grc/trunk/src/grc_gnuradio/Block.py 2008-07-25 00:24:25 UTC (rev 9012)
@@ -97,7 +97,7 @@
                                                
self.get_parent().remove_element(connection)
                                #remove the ports
                                for key in map(str, range(nports, num_ports)): 
ports.pop(key)
-                               self.update()
+                               self.get_parent().is_valid() #FIXME: 
inappropriate solution
                                continue
                        #add more ports
                        if nports > num_ports:
@@ -106,7 +106,7 @@
                                        n['key'] = key
                                        port = Port(self, n)
                                        ports[key] = port
-                               self.update()
+                               self.get_parent().is_valid() #FIXME: 
inappropriate solution
                                continue
 
        def get_doc(self):

Modified: grc/trunk/src/grc_gnuradio/Port.py
===================================================================
--- grc/trunk/src/grc_gnuradio/Port.py  2008-07-25 00:13:12 UTC (rev 9011)
+++ grc/trunk/src/grc_gnuradio/Port.py  2008-07-25 00:24:25 UTC (rev 9012)
@@ -29,7 +29,7 @@
        ##possible port types
        TYPES = ['complex', 'float', 'int', 'short', 'byte']
 
-       def __init__(self, block, n):   
+       def __init__(self, block, n):
                """
                Make a new port from nested data.
                @param block the parent element
@@ -42,14 +42,14 @@
                #build the port
                _Port.__init__(
                        self,
-                       block=block, 
+                       block=block,
                        n=n,
                )
                self._nports = nports
                self._vlen = vlen
                self._optional = bool(optional)
-       
-       def get_vlen(self): 
+
+       def get_vlen(self):
                """
                Get the vector length.
                If the evaluation of vlen cannot be cast to an integer, return 
1.
@@ -57,9 +57,9 @@
                """
                vlen = self.get_parent().resolve_dependencies(self._vlen)
                try: return int(self.get_parent().get_parent().evaluate(vlen))
-               except: return 1                 
-       
-       def get_nports(self): 
+               except: return 1
+
+       def get_nports(self):
                """
                Get the number of ports.
                If already blank, return a blank
@@ -69,15 +69,15 @@
                nports = self.get_parent().resolve_dependencies(self._nports)
                #return blank if nports is blank
                if not nports: return ''
-               try: 
+               try:
                        nports = 
int(self.get_parent().get_parent().evaluate(nports))
                        assert(0 < nports <= MAX_NUM_PORTS)
                        return nports
-               except: return 1        
-       
+               except: return 1
+
        def get_optional(self): return bool(self._optional)
-       
-       def get_color(self): 
+
+       def get_color(self):
                """
                Get the color that represents this port's type.
                Codes differ for ports where the vec length is 1 or greater 
than 1.
@@ -88,19 +88,19 @@
                                return {#vlen is 1
                                        'complex': '#3399FF',
                                        'float': '#FF8C69',
-                                       'int': '#00FF99', 
-                                       'short': '#FFFF66', 
+                                       'int': '#00FF99',
+                                       'short': '#FFFF66',
                                        'byte': '#FF66FF',
-                               }[self.get_type()]      
+                               }[self.get_type()]
                        return {#vlen is non 1
                                'complex': '#3399AA',
                                'float': '#CC8C69',
-                               'int': '#00CC99', 
-                               'short': '#CCCC33', 
+                               'int': '#00CC99',
+                               'short': '#CCCC33',
                                'byte': '#CC66CC',
                        }[self.get_type()]
                except: return _Port.get_color(self)
-               
+
        def is_empty(self):
                """!
                Is this port empty?
@@ -109,27 +109,27 @@
                @return true if empty
                """
                return not self.get_optional() and not self.get_connections()
-       
+
 class Source(Port):
-       
+
        def __init__(self, block, n):
                self._n = n #save n
                #key is port index
                n['key'] = str(block._source_count)
                block._source_count = block._source_count + 1
                Port.__init__(self, block, n)
-               
+
        def __del__(self):
                self.get_parent()._source_count = 
self.get_parent()._source_count - 1
-       
+
 class Sink(Port):
-       
+
        def __init__(self, block, n):
                self._n = n #save n
                #key is port index
                n['key'] = str(block._sink_count)
                block._sink_count = block._sink_count + 1
                Port.__init__(self, block, n)
-               
+
        def __del__(self):
                self.get_parent()._sink_count = self.get_parent()._sink_count - 
1





reply via email to

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