make maintainer-clean removes these, and we want a clean orig.tar.gz
[debian/gnuradio] / grc / scripts / usrp2_probe
index deb2e538df2463f6a357b47ac1e49d136431a1b4..38c8f655ce854b350e4f0d3b693b91e325061f85 100755 (executable)
@@ -29,11 +29,8 @@ import gobject
 
 from gnuradio.grc.gui.Dialogs import TextDisplay
 
-from gnuradio.grc.platforms.python.Platform import Platform
-platform = Platform(block_paths_internal_only=['usrp2_probe.xml'])
-
-from gnuradio.grc.platforms.gui.Platform import Platform
-platform = Platform(platform)
+from gnuradio.grc.python.Platform import Platform
+platform = Platform()
 
 flow_graph = platform.get_new_flow_graph()
 block = flow_graph.get_new_block('usrp2_probe')
@@ -42,6 +39,11 @@ block = flow_graph.get_new_block('usrp2_probe')
 usrp_interface_param = block.get_param('interface')
 usrp_type_param = block.get_param('type')
 
+def get_input(param):
+       param.validate()
+       input = param.get_input()
+       return input
+
 class USRP2ProbeWindow(gtk.Window):
        """
        The main window for USRP Dignostics.
@@ -69,8 +71,8 @@ class USRP2ProbeWindow(gtk.Window):
                #create vbox for storage
                vbox = gtk.VBox()
                frame.add(vbox)
-               vbox.pack_start(usrp_interface_param.get_input_object(), False)
-               vbox.pack_start(usrp_type_param.get_input_object(), False)
+               vbox.pack_start(get_input(usrp_interface_param), False)
+               vbox.pack_start(get_input(usrp_type_param), False)
                #make the tree model for holding mac addrs
                self.treestore = gtk.TreeStore(gobject.TYPE_STRING)
                self.treeview = gtk.TreeView(self.treestore)
@@ -104,11 +106,10 @@ class USRP2ProbeWindow(gtk.Window):
                p = subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True)
                msg = p.stdout.read()
                #extract mac addrs
-               self.usrp2_macs = map(lambda l: l.split()[0], filter(lambda l: l.count(':') >= 5, msg.strip().splitlines()))
+               self.usrp2_macs = sorted(map(lambda l: l.split()[0], filter(lambda l: l.count(':') >= 5, msg.strip().splitlines())))
                #set the tree store with the mac addrs
                self.treestore.clear()
-               for usrp2_mac in self.usrp2_macs:
-                       self.treestore.append(None, (usrp2_mac,))
+               for usrp2_mac in self.usrp2_macs: self.treestore.append(None, (usrp2_mac,))
                #set the text with the error message for 0 found, hide the list
                #when only 1 usrp2, auto handle selection, hide the list
                #for multiple usrp2, show the list
@@ -136,8 +137,11 @@ class USRP2ProbeWindow(gtk.Window):
                        'rx': (usrp2.source_32fc, 'adc_rate'),
                        'tx': (usrp2.sink_32fc, 'dac_rate'),
                }[usrp_type_param.evaluate()]
+               interface = usrp_interface_param.evaluate()
                try:
-                       u = make(usrp_interface_param.evaluate(), mac_addr)
+                       if not interface and not mac_addr: u = make()
+                       elif not mac_addr: u = make(interface)
+                       else: u = make(interface, mac_addr)
                        msg = ">>> USRP2 Probe\n"
                        msg = "%s\nMAC Addr:\n\t%s\n"%(msg, u.mac_addr())
                        msg = "%s\nName (ID):\n\t%s\n"%(msg, u.daughterboard_id())