Merge branch 'usrp2-real-fix' of http://gnuradio.org/git/balister into master
authorJohnathan Corgan <jcorgan@corganenterprises.com>
Sat, 19 Sep 2009 05:30:47 +0000 (22:30 -0700)
committerJohnathan Corgan <jcorgan@corganenterprises.com>
Sat, 19 Sep 2009 05:30:47 +0000 (22:30 -0700)
config/grc_grc.m4
grc/base/Element.py
grc/gui/ActionHandler.py
grc/gui/Actions.py
grc/gui/Bars.py
grc/gui/Dialogs.py
grc/python/Param.py
vrt/include/vrt/quadradio.h
vrt/lib/quadradio.cc

index ce23e3c25aee7b175eba890c1074df18a372a02c..7ee009faee171785f7ef76e57fbafbeec99f083e 100644 (file)
@@ -31,7 +31,7 @@ AC_DEFUN([GRC_GRC],[
     if test $passed = yes; then
         PYTHON_CHECK_MODULE([sys],[Python >= 2.5],[],[passed=no],[sys.version.split()[[0]] >= "2.5"])
         PYTHON_CHECK_MODULE([Cheetah],[Python Cheetah templates >= 2.0.0],[],[passed=no],[Cheetah.Version >= "2.0.0"])
-        PYTHON_CHECK_MODULE([lxml.etree],[Python lxml wrappers >= 2.0.0],[],[passed=no],[lxml.etree.LXML_VERSION >= (2, 0, 0, 0)])
+        PYTHON_CHECK_MODULE([lxml.etree],[Python lxml wrappers >= 1.3.6],[],[passed=no],[lxml.etree.LXML_VERSION >= (1, 3, 6, 0)])
         PYTHON_CHECK_MODULE([gtk],[Python gtk wrappers >= 2.10.0],[],[passed=no],[gtk.pygtk_version >= (2, 10, 0)])
     fi
 
index e77e7ce0891447c4d3ee53d2fe16b1f6755242b0..a57090f3b24a2f5928d3f7c6facb1bfee48b7969 100644 (file)
@@ -50,11 +50,12 @@ class Element(object):
        def get_error_messages(self):
                """
                Get the list of error messages from this element and all of its children.
+               Do not include the error messages from disabled children.
                Cleverly indent the children error messages for printing purposes.
                @return a list of error message strings
                """
                error_messages = list(self._error_messages) #make a copy
-               for child in self.get_children():
+               for child in filter(lambda c: c.get_enabled(), self.get_children()):
                        for msg in child.get_error_messages():
                                error_messages.append("%s:\n\t%s"%(child, msg.replace("\n", "\n\t")))
                return error_messages
index 361be1cf8f095dba401f85649e624b01cdc0e5d0..ee3e19a6c6628db3d4e79ab1a4facd3e85bc8a8d 100644 (file)
@@ -210,6 +210,8 @@ class ActionHandler:
                        Dialogs.HelpDialog()
                elif action == Actions.TYPES_WINDOW_DISPLAY:
                        Dialogs.TypesDialog(self.get_flow_graph().get_parent())
+               elif action == Actions.ERRORS_WINDOW_DISPLAY:
+                       Dialogs.ErrorsDialog(self.get_flow_graph())
                ##################################################
                # Param Modifications
                ##################################################
@@ -307,6 +309,7 @@ class ActionHandler:
                # Global Actions for all States
                ##################################################
                #update general buttons
+               Actions.ERRORS_WINDOW_DISPLAY.set_sensitive(not self.get_flow_graph().is_valid())
                Actions.ELEMENT_DELETE.set_sensitive(bool(self.get_flow_graph().get_selected_elements()))
                Actions.BLOCK_PARAM_MODIFY.set_sensitive(bool(self.get_flow_graph().get_selected_block()))
                Actions.BLOCK_ROTATE_CCW.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
index b22279c1da12892649562571a23a16007eb30db1..f374efde18d9e5d8d9ec6cbd2e814322e583ce96 100644 (file)
@@ -215,6 +215,11 @@ BLOCK_PASTE = Action(
        stock_id=gtk.STOCK_PASTE,
        keypresses=(gtk.keysyms.v, gtk.gdk.CONTROL_MASK),
 )
+ERRORS_WINDOW_DISPLAY = Action(
+       label='_Errors',
+       tooltip='View flow graph errors',
+       stock_id=gtk.STOCK_DIALOG_ERROR,
+)
 ABOUT_WINDOW_DISPLAY = Action(
        label='_About',
        tooltip='About this program',
@@ -222,13 +227,13 @@ ABOUT_WINDOW_DISPLAY = Action(
 )
 HELP_WINDOW_DISPLAY = Action(
        label='_Help',
-       tooltip='Usage Tips',
+       tooltip='Usage tips',
        stock_id=gtk.STOCK_HELP,
        keypresses=(gtk.keysyms.F1, NO_MODS_MASK),
 )
 TYPES_WINDOW_DISPLAY = Action(
        label='_Types',
-       tooltip='Types Color Mapping',
+       tooltip='Types color mapping',
        stock_id=gtk.STOCK_DIALOG_INFO,
 )
 FLOW_GRAPH_GEN = Action(
index fff5ebc08d1b51f55ed2beab5c55b4cc609da328..8fd167869828f163d619b271441b6a60bd9c5d93 100644 (file)
@@ -39,6 +39,7 @@ TOOLBAR_LIST = (
        Actions.FLOW_GRAPH_UNDO,
        Actions.FLOW_GRAPH_REDO,
        None,
+       Actions.ERRORS_WINDOW_DISPLAY,
        Actions.FLOW_GRAPH_GEN,
        Actions.FLOW_GRAPH_EXEC,
        Actions.FLOW_GRAPH_KILL,
@@ -81,6 +82,9 @@ MENU_BAR_LIST = (
                None,
                Actions.BLOCK_PARAM_MODIFY,
        ]),
+       (gtk.Action('View', '_View', None, None), [
+               Actions.ERRORS_WINDOW_DISPLAY,
+       ]),
        (gtk.Action('Build', '_Build', None, None), [
                Actions.FLOW_GRAPH_GEN,
                Actions.FLOW_GRAPH_EXEC,
index 3cf617b92c8e03b1a06fdd6d6e457dd8a450f613..af40f47c088a38d57baebc2dc20477a25fcb9b35 100644 (file)
@@ -57,6 +57,20 @@ def MessageDialogHelper(type, buttons, title=None, markup=None):
        message_dialog.destroy()
        return response
 
+
+ERRORS_MARKUP_TMPL="""\
+#for $i, $err_msg in enumerate($errors)
+<b>Error $i:</b>
+$encode($err_msg.replace('\t', '  '))
+
+#end for"""
+def ErrorsDialog(flowgraph): MessageDialogHelper(
+       type=gtk.MESSAGE_ERROR,
+       buttons=gtk.BUTTONS_CLOSE,
+       title='Flow Graph Errors',
+       markup=Utils.parse_template(ERRORS_MARKUP_TMPL, errors=flowgraph.get_error_messages()),
+)
+
 class AboutDialog(gtk.AboutDialog):
        """A cute little about dialog."""
 
index 387fab5481af81c27692cd20169023a7deba58c9..34d5ab116b07e629f16ecf0d70c29361a16579da 100644 (file)
@@ -254,7 +254,7 @@ class Param(_Param, _GUIParam):
                elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', 'hex', 'bool'):
                        #raise exception if python cannot evaluate this value
                        try: e = self.get_parent().get_parent().evaluate(v)
-                       except Exception, e: raise Exception, 'Value "%s" cannot be evaluated: %s'%(v, e)
+                       except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e)
                        #raise an exception if the data is invalid
                        if t == 'raw': return e
                        elif t == 'complex':
@@ -385,7 +385,7 @@ class Param(_Param, _GUIParam):
                        try: notebook_block = filter(lambda b: b.get_id() == notebook_id, notebook_blocks)[0]
                        except: raise Exception, 'Notebook id "%s" is not an existing notebook id.'%notebook_id
                        #check that page index exists
-                       try: assert int(page_index) in range(len(notebook_block.get_param('labels').get_evaluated()))
+                       try: assert int(page_index) in range(len(notebook_block.get_param('labels').evaluate()))
                        except: raise Exception, 'Page index "%s" is not a valid index number.'%page_index
                        return notebook_id, page_index
                #########################
index 83323f09358b23ef97e940b972a30ab727c57b81..d30ee14f128ed2ebce92e2b89d7857ab185942b6 100644 (file)
@@ -72,12 +72,14 @@ namespace vrt {
                 int *ctrl_fd_ptr, struct in_addr *ctrl_port_inaddr,
                 int *data_fd_ptr, int *data_port_ptr);
 
+    // dsprxno selects the Rx DSP pipe (0 or 1) to configure
     static bool
-    send_rx_command(int ctrl_fd, bool start,
-                   struct in_addr addr, int data_port, int samples_per_pkt, int siggen_param);
+    send_rx_command(int ctrl_fd, int rxdspno, bool start,
+                   struct in_addr addr, int data_port, int samples_per_pkt);
 
+    // dsprxno selects the Rx DSP pipe (0 or 1) to stop
     static bool
-    send_stop_rx_command(int ctrl_fd);
+    send_stop_rx_command(int ctrl_fd, int rxdspno);
     
     static int control_port() { return 790; }
     int data_socket_fd() const { return d_data_fd; }
@@ -94,9 +96,11 @@ namespace vrt {
 
     vrt::rx::sptr vrt_rx() const { return d_rx; }
 
+    // FIXME add rxdspno as the first parameter
     bool start_streaming(int samples_per_pkt = 0);
-    bool stop_streaming();
 
+    // FIXME add rxdspno as the first parameter
+    bool stop_streaming();
 
     /* convenience methods that ultimately write the dboard pins */
     bool set_center_freq(double target_freq);
index 8cf542e0f3b5889f953b718d8a091cb3350769f0..a8bc3e525bdb5eea535c128d29b74c5b7b0d30ad 100644 (file)
@@ -76,14 +76,18 @@ vrt::quadradio::open(const char *ip)
 bool
 vrt::quadradio::start_streaming(int samples_per_pkt)
 {
-  return send_rx_command(d_ctrl_fd, true, d_ctrl_port_inaddr,
-                        d_data_port, samples_per_pkt, 0);
+  int rxdspno = 0;     // FIXME make it the first param
+
+  return send_rx_command(d_ctrl_fd, rxdspno, true, d_ctrl_port_inaddr,
+                        d_data_port, samples_per_pkt);
 }
 
 bool
 vrt::quadradio::stop_streaming()
 {
-  return send_stop_rx_command(d_ctrl_fd);
+  int rxdspno = 0;     // FIXME make it the first param
+
+  return send_stop_rx_command(d_ctrl_fd, rxdspno);
 }
 
 bool
@@ -288,9 +292,9 @@ vrt::quadradio::open_sockets(const char *quad_radio_ip, int quad_radio_ctrl_port
 // ------------------------------------------------------------------------
 
 bool
-vrt::quadradio::send_rx_command(int ctrl_fd, bool start,
+vrt::quadradio::send_rx_command(int ctrl_fd, int rxdspno, bool start,
                                struct in_addr addr, int data_port,
-                               int samples_per_pkt, int siggen_param)
+                               int samples_per_pkt)
 {
   uint32_t cmd[7];
   cmd[0] = htonl(0);              // verb: set
@@ -299,17 +303,17 @@ vrt::quadradio::send_rx_command(int ctrl_fd, bool start,
   cmd[3] = addr.s_addr;                   // ip address to send data to (already network endian)
   cmd[4] = htonl(data_port);      // port to send data to
   cmd[5] = htonl(samples_per_pkt);
-  cmd[6] = htonl(siggen_param);
+  cmd[6] = htonl(rxdspno);        // the DSP pipeline to configure
 
   return send_and_check(ctrl_fd, cmd, sizeof(cmd));
 }
 
 bool
-vrt::quadradio::send_stop_rx_command(int ctrl_fd)
+vrt::quadradio::send_stop_rx_command(int ctrl_fd, int rxdspno)
 {
   struct in_addr in_addr;
   in_addr.s_addr = 0;
-  return send_rx_command(ctrl_fd, false, in_addr, 0, 0, 0);
+  return send_rx_command(ctrl_fd, rxdspno, false, in_addr, 0, 0);
 }
 
 bool