commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8985 - in grc/trunk: notes scripts src/grc src/grc/gu


From: jblum
Subject: [Commit-gnuradio] r8985 - in grc/trunk: notes scripts src/grc src/grc/gui src/grc/gui/elements src/grc_gnuradio src/grc_gnuradio/blocks/filters src/grc_gnuradio/blocks/graphical_sinks src/grc_gnuradio/blocks/synchronizers src/grc_gnuradio/data
Date: Wed, 23 Jul 2008 14:33:40 -0600 (MDT)

Author: jblum
Date: 2008-07-23 14:33:40 -0600 (Wed, 23 Jul 2008)
New Revision: 8985

Added:
   grc/trunk/src/grc_gnuradio/blocks/filters/gr_moving_average_xx.xml
Modified:
   grc/trunk/notes/todo.txt
   grc/trunk/scripts/grc
   grc/trunk/scripts/usrp_diagnostics
   grc/trunk/src/grc/Constants.py
   grc/trunk/src/grc/gui/FileDialogs.py
   grc/trunk/src/grc/gui/elements/FlowGraph.py
   grc/trunk/src/grc/gui/elements/Param.py
   grc/trunk/src/grc_gnuradio/Param.py
   grc/trunk/src/grc_gnuradio/blocks/graphical_sinks/wxgui_fftsink2.xml
   grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_costas_loop_cc.xml
   grc/trunk/src/grc_gnuradio/data/block_tree.xml
Log:
some gui tweaks, todo list, blocks

Modified: grc/trunk/notes/todo.txt
===================================================================
--- grc/trunk/notes/todo.txt    2008-07-23 19:04:52 UTC (rev 8984)
+++ grc/trunk/notes/todo.txt    2008-07-23 20:33:40 UTC (rev 8985)
@@ -2,12 +2,10 @@
 -hier block
 -optparse block
 -ofdm wrappers
--gr_costas callbacks
--gr_moving_average_XX
+-controlled step block
 
 ############ Features to Add: ####################
 -save working directory after close
--create sub-flow graphs to be used in larger flow graphs
 -param editor, expand entry boxes in focus
 -change param dialog to panel within main window
 -default platform for preferences block
@@ -16,11 +14,13 @@
 -log slider gui control
 -variable resolution graph structure
 -recursive/nested categories
+-icons for certain blocks, + for add
+-zoom in/out
+-hide io types
 
 ############ Problems: ####################
 -catch error on open non-existant files
 -variables dependent on variables that change
--flow graph, update autoscroll with emit('changed')
 -flow graph, try mouse DRAG_MOTION?
 
 ############ Suggestions: ####################

Modified: grc/trunk/scripts/grc
===================================================================
--- grc/trunk/scripts/grc       2008-07-23 19:04:52 UTC (rev 8984)
+++ grc/trunk/scripts/grc       2008-07-23 20:33:40 UTC (rev 8985)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 """
 Copyright 2008 Free Software Foundation, Inc.
 This file is part of GNU Radio
@@ -21,6 +21,7 @@
 #Execute the flow graph editor GUI. This file must be called by the python 
interpreter.
 address@hidden Josh Blum
 
+import grc
 from grc.Constants import VERSION,FLOW_GRAPH_FILE_EXTENSION
 from optparse import OptionParser
 

Modified: grc/trunk/scripts/usrp_diagnostics
===================================================================
--- grc/trunk/scripts/usrp_diagnostics  2008-07-23 19:04:52 UTC (rev 8984)
+++ grc/trunk/scripts/usrp_diagnostics  2008-07-23 20:33:40 UTC (rev 8985)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 """
 Copyright 2008 Free Software Foundation, Inc.
 This file is part of GNU Radio

Modified: grc/trunk/src/grc/Constants.py
===================================================================
--- grc/trunk/src/grc/Constants.py      2008-07-23 19:04:52 UTC (rev 8984)
+++ grc/trunk/src/grc/Constants.py      2008-07-23 20:33:40 UTC (rev 8985)
@@ -23,7 +23,7 @@
 import os
 
 
######################################################################################################
-## Global Titles @{
+## Global Titles
 
######################################################################################################
 
 ##The current version of this code
@@ -34,7 +34,6 @@
 
 ##The prefix title on the main window.
 MAIN_WINDOW_PREFIX = "GRC"
address@hidden
 
 
######################################################################################################
 ## Signal block connector lengths
@@ -69,15 +68,13 @@
 ## Dimension constraints for the various windows (in pixels)
 
######################################################################################################
 
-##main window constraints @{
+##main window constraints
 MIN_WINDOW_WIDTH = 600
 MIN_WINDOW_HEIGHT = 400
address@hidden
 
-##dialog constraints @{
+##dialog constraints
 MIN_DIALOG_WIDTH = 500
 MIN_DIALOG_HEIGHT = 500
address@hidden
 
 ##static height of reports window
 REPORTS_WINDOW_HEIGHT = 100
@@ -86,7 +83,7 @@
 BLOCK_SELECTION_WINDOW_WIDTH = 200
 
 
######################################################################################################
-## Constraints on displayable labels and ports @{
+## Constraints on displayable labels and ports
 
######################################################################################################
 
 LABEL_SEPARATION = 3
@@ -99,13 +96,13 @@
 PORT_BORDER_SEPARATION = 9
 MAX_NUM_PORTS = 7
 
+PARAM_LABEL_FONT = 'Sans 9.5'
 PARAM_FONT = 'Sans 7.5'
 BLOCK_FONT = 'Sans 8'
 PORT_FONT = 'Sans 7.5'
address@hidden
 
 
######################################################################################################
-## Dragging, scrolling, and redrawing constants for the flow graph window in 
pixels @{
+## Dragging, scrolling, and redrawing constants for the flow graph window in 
pixels
 
######################################################################################################
 
 ##How close can the mouse get to the window border before mouse events are 
ignored.
@@ -122,17 +119,16 @@
 
 ##How close the mouse click can be to a connection and register a connection 
select.
 CONNECTION_SELECT_SENSITIVITY = 5
address@hidden
 
 
######################################################################################################
-# A state is recorded for each change to the flow graph, the size dictates how 
many states we can record 
+# A state is recorded for each change to the flow graph, the size dictates how 
many states we can record
 
######################################################################################################
 
 ##The size of the state saving cache in the flow graph (for undo/redo 
functionality)
 STATE_CACHE_SIZE = 42
 
 
######################################################################################################
-## Constansts dealing with File Paths @{
+## Constansts dealing with File Paths
 
######################################################################################################
 
 ##Location of the python src directory.
@@ -155,5 +151,4 @@
 
 ##The default user preferences file.
 PREFERENCES_FILE_PATH = os.path.join(DEFAULT_FILE_PATH, 
FLOW_GRAPH_FILE_EXTENSION)
address@hidden
 

Modified: grc/trunk/src/grc/gui/FileDialogs.py
===================================================================
--- grc/trunk/src/grc/gui/FileDialogs.py        2008-07-23 19:04:52 UTC (rev 
8984)
+++ grc/trunk/src/grc/gui/FileDialogs.py        2008-07-23 20:33:40 UTC (rev 
8985)
@@ -44,14 +44,14 @@
 ##the filter for all files
 ALL_FILE_FILTER = gtk.FileFilter()
 ALL_FILE_FILTER.set_name('All Files')
-ALL_FILE_FILTER.add_pattern('*')       
+ALL_FILE_FILTER.add_pattern('*')
 
 class FileDialogHelper(gtk.FileChooserDialog):
        """
-       A wrapper class for the gtk file chooser dialog. 
+       A wrapper class for the gtk file chooser dialog.
        Implement a file chooser dialog with only necessary parameters.
        """
-       
+
        def __init__(self, action, title):
                """!
                FileDialogHelper contructor.
@@ -61,28 +61,17 @@
                @param title the title of the dialog (string)
                """
                ok_stock = {gtk.FILE_CHOOSER_ACTION_OPEN : 'gtk-open', 
gtk.FILE_CHOOSER_ACTION_SAVE : 'gtk-save'}[action]
-               gtk.FileChooserDialog.__init__(self, title, None, action, 
('gtk-cancel', gtk.RESPONSE_CANCEL, ok_stock, gtk.RESPONSE_OK))               
+               gtk.FileChooserDialog.__init__(self, title, None, action, 
('gtk-cancel', gtk.RESPONSE_CANCEL, ok_stock, gtk.RESPONSE_OK))
                self.set_select_multiple(False)
                self.set_local_only(True)
                self.add_filter(ALL_FILE_FILTER)
-               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
-               """
-               keyname = gtk.gdk.keyval_name(event.keyval)
-               if keyname == 'Return': self.response(gtk.RESPONSE_OK)          
        
-               return False #forward the keypress
-
 class FileDialog(FileDialogHelper):
        """A dialog box to save or open flow graph files. This is a base class, 
do not use."""
-               
+
        def __init__(self, current_file_path=''):
                """!
-               FileDialog constructor. 
+               FileDialog constructor.
                @param current_file_path the current directory or path to the 
open flow graph
                """
                if not current_file_path: current_file_path = 
path.join(DEFAULT_FILE_PATH, NEW_FLOGRAPH_TITLE + FLOW_GRAPH_FILE_EXTENSION)
@@ -91,16 +80,16 @@
                        self.add_and_set_filter(FLOW_GRAPH_FILE_FILTER)
                        self.set_select_multiple(True)
                elif self.type == SAVE_FLOW_GRAPH:
-                       FileDialogHelper.__init__(self, 
gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph to a File...') 
+                       FileDialogHelper.__init__(self, 
gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph to a File...')
                        self.add_and_set_filter(FLOW_GRAPH_FILE_FILTER)
-                       self.set_current_name(path.basename(current_file_path)) 
#show the current filename
+                       self.set_current_name(path.basename(current_file_path)) 
#show the current filename
                elif self.type == SAVE_IMAGE:
                        FileDialogHelper.__init__(self, 
gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph Screen Shot...')
                        self.add_and_set_filter(IMAGE_FILE_FILTER)
-                       current_file_path = current_file_path + 
IMAGE_FILE_EXTENSION    
-                       self.set_current_name(path.basename(current_file_path)) 
#show the current filename              
-               self.set_current_folder(path.dirname(current_file_path))        
#current directory      
-               
+                       current_file_path = current_file_path + 
IMAGE_FILE_EXTENSION
+                       self.set_current_name(path.basename(current_file_path)) 
#show the current filename
+               self.set_current_folder(path.dirname(current_file_path)) 
#current directory
+
        def add_and_set_filter(self, filter):
                """!
                Add the gtk file filter to the list of filters and set it as 
the default file filter.
@@ -111,41 +100,42 @@
 
        def get_rectified_filename(self):
                """!
-               Run the dialog and get the filename. 
+               Run the dialog and get the filename.
                If this is a save dialog and the file name is missing the 
extension, append the file extension.
                If the file name with the extension already exists, show a 
overwrite dialog.
                If this is an open dialog, return a list of filenames.
-               @return the complete file path 
+               @return the complete file path
                """
-               if gtk.FileChooserDialog.run(self) != gtk.RESPONSE_OK: return 
None      #response was cancel
+               if gtk.FileChooserDialog.run(self) != gtk.RESPONSE_OK: return 
None #response was cancel
                #############################################
                # Handle Save Dialogs
                #############################################
                if self.type in (SAVE_FLOW_GRAPH, SAVE_IMAGE):
-                       filename = self.get_filename()                          
        
-                       for extension,filter in (
-                               (FLOW_GRAPH_FILE_EXTENSION, 
FLOW_GRAPH_FILE_FILTER), 
-                               (IMAGE_FILE_EXTENSION, IMAGE_FILE_FILTER)
+                       filename = self.get_filename()
+                       for extension, filter in (
+                               (FLOW_GRAPH_FILE_EXTENSION, 
FLOW_GRAPH_FILE_FILTER),
+                               (IMAGE_FILE_EXTENSION, IMAGE_FILE_FILTER),
                        ): #append the missing file extension if the filter 
matches
-                               if      filename[len(filename)-len(extension):] 
!= extension and filter == self.get_filter(): filename = filename + extension   
                
-                       self.set_current_name(path.basename(filename))  #show 
the filename with extension                               
-                       if path.exists(filename): #ask the user to confirm 
overwrite                                            
+                               if filename[len(filename)-len(extension):] != 
extension \
+                                       and filter == self.get_filter(): 
filename += extension
+                       self.set_current_name(path.basename(filename)) #show 
the filename with extension
+                       if path.exists(filename): #ask the user to confirm 
overwrite
                                if MessageDialogHelper(
                                        gtk.MESSAGE_QUESTION, 
gtk.BUTTONS_YES_NO, 'Confirm Overwrite!',
                                        'File <b>"%s"</b> Exists!\nWould you 
like to overwrite the existing file?'%filename,
-                               ) == gtk.RESPONSE_NO: return 
self.get_rectified_filename()      
-                       return filename         
+                               ) == gtk.RESPONSE_NO: return 
self.get_rectified_filename()
+                       return filename
                #############################################
                # Handle Open Dialogs
                #############################################
                elif self.type in (OPEN_FLOW_GRAPH,):
-                       filenames = self.get_filenames()                
-                       for filename in filenames:                      
+                       filenames = self.get_filenames()
+                       for filename in filenames:
                                if not path.exists(filename): #show a warning 
and re-run
                                        MessageDialogHelper(
                                                gtk.MESSAGE_WARNING, 
gtk.BUTTONS_CLOSE, 'Cannot Open!',
                                                'File <b>"%s"</b> Does not 
Exist!'%filename,
-                                       )       
+                                       )
                                        return self.get_rectified_filename()
                        return filenames
 
@@ -153,12 +143,12 @@
                """!
                Get the filename and destroy the dialog.
                @return the filename or None if a close/cancel occured.
-               """             
+               """
                filename = self.get_rectified_filename()
                self.destroy()
-               return filename 
-               
-class OpenFlowGraphFileDialog(FileDialog): type = OPEN_FLOW_GRAPH      
-class SaveFlowGraphFileDialog(FileDialog): type = SAVE_FLOW_GRAPH      
-class SaveImageFileDialog(FileDialog): type = SAVE_IMAGE       
+               return filename
 
+class OpenFlowGraphFileDialog(FileDialog): type = OPEN_FLOW_GRAPH
+class SaveFlowGraphFileDialog(FileDialog): type = SAVE_FLOW_GRAPH
+class SaveImageFileDialog(FileDialog): type = SAVE_IMAGE
+

Modified: grc/trunk/src/grc/gui/elements/FlowGraph.py
===================================================================
--- grc/trunk/src/grc/gui/elements/FlowGraph.py 2008-07-23 19:04:52 UTC (rev 
8984)
+++ grc/trunk/src/grc/gui/elements/FlowGraph.py 2008-07-23 20:33:40 UTC (rev 
8985)
@@ -86,10 +86,10 @@
                        index = index + 1
                        #make sure that the id is not used by another block
                        if not filter(lambda e: e.is_block() and e.get_id() == 
id, self.get_elements()):
-                               vAdj = 
self.get_scroll_pane().get_vadjustment().get_value()
-                               hAdj = 
self.get_scroll_pane().get_hadjustment().get_value()
-                               x = random.randint(100,200)+int(hAdj)
-                               y = random.randint(100,200)+int(vAdj)
+                               v_val = 
self.get_scroll_pane().get_vadjustment().get_value()
+                               h_val = 
self.get_scroll_pane().get_hadjustment().get_value()
+                               x = random.randint(100,200) + int(v_val)
+                               y = random.randint(100,200) + int(h_val)
                                #get the new block
                                block = self.get_new_block(key)
                                block.set_coordinate((x, y))
@@ -363,31 +363,25 @@
                #to perform a movement, the mouse must be pressed, an element 
selected, timediff large enough.
                if time.time() - self.time >= 
MOTION_DETECT_REDRAWING_SENSITIVITY and \
                        self.mouse_pressed and self.get_selected_element():
-                       #The event coordinates must be within BPS pixels away 
from the bounds of the flow graph.
-                       fgW,fgH = self.get_size()
-                       x,y = coordinate
-                       #get the change in coordinates
-                       X,Y = self.get_coordinate()
-                       deltaX = int(x - X)
-                       deltaY = int(y - Y)
-                       vAdj = 
self.get_scroll_pane().get_vadjustment().get_value()
-                       hAdj = 
self.get_scroll_pane().get_hadjustment().get_value()
-                       width = 
self.get_scroll_pane().get_hadjustment().page_size
-                       height = 
self.get_scroll_pane().get_vadjustment().page_size
-                       #scroll horizontal if we moved near the border
-                       if x-hAdj > width-SCROLL_PROXIMITY_SENSITIVITY and \
-                               hAdj+SCROLL_DISTANCE < fgW - width:
-                               
self.get_scroll_pane().get_hadjustment().set_value(hAdj+SCROLL_DISTANCE)
-                       elif x-hAdj < SCROLL_PROXIMITY_SENSITIVITY:
-                               
self.get_scroll_pane().get_hadjustment().set_value(hAdj-SCROLL_DISTANCE)
-                       #scroll vertical if we moved near the border
-                       if y-vAdj > height-SCROLL_PROXIMITY_SENSITIVITY and \
-                               vAdj+SCROLL_DISTANCE < fgH - height:
-                               
self.get_scroll_pane().get_vadjustment().set_value(vAdj+SCROLL_DISTANCE)
-                       elif y-vAdj < SCROLL_PROXIMITY_SENSITIVITY:
-                               
self.get_scroll_pane().get_vadjustment().set_value(vAdj-SCROLL_DISTANCE)
+                       #perform autoscrolling
+                       width, height = self.get_size()
+                       x, y = coordinate
+                       v_adj = self.get_scroll_pane().get_vadjustment()
+                       h_adj = self.get_scroll_pane().get_hadjustment()
+                       for pos, length, adj, adj_val, adj_len in (
+                               (x, width, h_adj, h_adj.get_value(), 
h_adj.page_size),
+                               (y, height, v_adj, v_adj.get_value(), 
v_adj.page_size),
+                       ):
+                               #scroll if we moved near the border
+                               if pos-adj_val > 
adj_len-SCROLL_PROXIMITY_SENSITIVITY and adj_val+SCROLL_DISTANCE < 
length-adj_len:
+                                       adj.set_value(adj_val+SCROLL_DISTANCE)
+                                       adj.emit('changed')
+                               elif pos-adj_val < SCROLL_PROXIMITY_SENSITIVITY:
+                                       adj.set_value(adj_val-SCROLL_DISTANCE)
+                                       adj.emit('changed')
                        #move the selected element and record the new coordinate
-                       self.move_selected((deltaX, deltaY))
+                       X, Y = self.get_coordinate()
+                       self.move_selected((int(x - X), int(y - Y)))
                        self.set_coordinate((x, y))
                        #update time
                        self.time = time.time()

Modified: grc/trunk/src/grc/gui/elements/Param.py
===================================================================
--- grc/trunk/src/grc/gui/elements/Param.py     2008-07-23 19:04:52 UTC (rev 
8984)
+++ grc/trunk/src/grc/gui/elements/Param.py     2008-07-23 20:33:40 UTC (rev 
8985)
@@ -36,41 +36,41 @@
 
 class InputParam(gtk.HBox):
        """The base class for an input parameter inside the input parameters 
dialog."""
-       
+
        def __init__(self, param, _handle_changed):
                gtk.HBox.__init__(self)
                self.param = param
                self._handle_changed = _handle_changed
                self.label = gtk.Label('') #no label, markup is added by 
set_markup
-               self.label.set_size_request(140, -1)
+               self.label.set_size_request(150, -1)
                self.pack_start(self.label, False)
-               self.set_markup = lambda m: self.label.set_markup(m)    
-               self.tp = None          
-               
+               self.set_markup = lambda m: self.label.set_markup(m)
+               self.tp = None
+
 class EntryParam(InputParam):
        """Provide an entry box for strings and numbers."""
-       
+
        def __init__(self, *args, **kwargs):
                InputParam.__init__(self, *args, **kwargs)
-               self.entry = input = gtk.Entry()                
+               self.entry = input = gtk.Entry()
                input.set_text(self.param.get_value())
-               input.connect("changed", self._handle_changed)
+               input.connect('changed', self._handle_changed)
                self.pack_start(input, True)
                self.get_text = input.get_text
                #tool tip
                self.tp = gtk.Tooltips()
                self.tp.set_tip(self.entry, '')
                self.tp.enable()
-               
+
 class FileParam(EntryParam):
        """Provide an entry box for filename and a button to browse for a 
file."""
-       
+
        def __init__(self, *args, **kwargs):
-               EntryParam.__init__(self, *args, **kwargs)              
+               EntryParam.__init__(self, *args, **kwargs)
                input = gtk.Button('...')
                input.connect('clicked', self._handle_clicked)
                self.pack_start(input, False)
-       
+
        def _handle_clicked(self, widget=None):
                """
                If the button was clicked, open a file dialog in open/save 
format.
@@ -78,30 +78,30 @@
                """
                file_path = self.param.is_valid() and self.param.evaluate() or 
''
                #bad file paths will be redirected to default
-               if not path.exists(path.dirname(file_path)): file_path = 
DEFAULT_FILE_PATH      
-               if self.param.get_type() == 'file_open': 
+               if not path.exists(path.dirname(file_path)): file_path = 
DEFAULT_FILE_PATH
+               if self.param.get_type() == 'file_open':
                        file_dialog = gtk.FileChooserDialog('Open a Data 
File...', None,
                                gtk.FILE_CHOOSER_ACTION_OPEN, 
('gtk-cancel',gtk.RESPONSE_CANCEL,'gtk-open',gtk.RESPONSE_OK))
-               elif self.param.get_type() == 'file_save': 
+               elif self.param.get_type() == 'file_save':
                        file_dialog = gtk.FileChooserDialog('Save a Data 
File...', None,
                                gtk.FILE_CHOOSER_ACTION_SAVE, 
('gtk-cancel',gtk.RESPONSE_CANCEL, 'gtk-save',gtk.RESPONSE_OK))
                        file_dialog.set_do_overwrite_confirmation(True)
-                       file_dialog.set_current_name(path.basename(file_path))  
#show the current filename
-               file_dialog.set_current_folder(path.dirname(file_path)) 
#current directory
+                       file_dialog.set_current_name(path.basename(file_path)) 
#show the current filename
+               file_dialog.set_current_folder(path.dirname(file_path)) 
#current directory
                file_dialog.set_select_multiple(False)
                file_dialog.set_local_only(True)
                if gtk.RESPONSE_OK == file_dialog.run(): #run the dialog
                        file_path = file_dialog.get_filename() #get the file 
path
                        self.entry.set_text(file_path)
                        self._handle_changed()
-               file_dialog.destroy() #destroy the dialog                       
                        
-               
+               file_dialog.destroy() #destroy the dialog
+
 class EnumParam(InputParam):
        """Provide an entry box for Enum types with a drop down menu."""
-       
+
        def __init__(self, *args, **kwargs):
                InputParam.__init__(self, *args, **kwargs)
-               input = gtk.ComboBox(gtk.ListStore(gobject.TYPE_STRING))        
                        
+               input = gtk.ComboBox(gtk.ListStore(gobject.TYPE_STRING))
                cell = gtk.CellRendererText()
                input.pack_start(cell, True)
                input.add_attribute(cell, 'text', 0)
@@ -116,16 +116,16 @@
 
######################################################################################################
 
 class Param(Element):
-       """The graphical parameter."""  
+       """The graphical parameter."""
 
        def update(self):
                """Called when an external change occurs.
                Update the graphical input by calling the change handler."""
-               if hasattr(self, 'input'): self._handle_changed()       
-               
+               if hasattr(self, 'input'): self._handle_changed()
+
        def get_input_object(self, callback=None):
                """!
-               Get the graphical gtk class to represent this parameter.        
+               Get the graphical gtk class to represent this parameter.
                Create the input object with this data type and the handle 
changed method.
                @param callback a function of one argument(this param) to be 
called from the change handler
                @return gtk input object
@@ -137,7 +137,7 @@
                self.input = input(self, self._handle_changed)
                self._handle_changed()
                return self.input
-               
+
        def _handle_changed(self, widget=None):
                """!
                When the input changes, write the inputs to the data type.
@@ -147,26 +147,26 @@
                if self.is_enum(): value = self.get_option_keys()[int(value)]
                self.set_value(value)
                #set the markup on the label, red for errors in corresponding 
data type.
-               name = Utils.xml_encode(self.get_name())
+               name = '<span font_desc="%s">%s</span>'%(PARAM_LABEL_FONT, 
Utils.xml_encode(self.get_name()))
                #special markups if param is involved in a callback
                if hasattr(self.get_parent(), 'get_callbacks') and \
                        filter(lambda c: self.get_key() in c, 
self.get_parent()._callbacks):
-                       name = '<span underline="low">%s</span>'%name           
-               if not self.is_valid(): 
-                       self.input.set_markup('<span 
foreground="red"><b>%s</b></span>'%name)
+                       name = '<span underline="low">%s</span>'%name
+               if not self.is_valid():
+                       self.input.set_markup('<span 
foreground="red">%s</span>'%name)
                        tip = '- ' + '\n- '.join(self.get_error_messages())
-               else: 
+               else:
                        self.input.set_markup(name)
-                       tip = self.evaluate()   
-               #set the tooltip                
+                       tip = self.evaluate()
+               #set the tooltip
                if self.input.tp: self.input.tp.set_tip(self.input.entry, 
str(tip))
-               #execute the external callback 
+               #execute the external callback
                if self.callback: self.callback(self)
 
        def get_markup(self):
                """!
-               Create a markup to display the Param as a label on the 
SignalBlock.     
-               If the data type is an Enum type, use the cname of the Enum's 
current choice.   
+               Create a markup to display the Param as a label on the 
SignalBlock.
+               If the data type is an Enum type, use the cname of the Enum's 
current choice.
                Otherwise, use parsed the data type and use its string 
representation.
                If the data type is not valid, use a red foreground color.
                @return pango markup string
@@ -175,22 +175,22 @@
                #       display logic for numbers
                
###########################################################################
                def float_to_str(var):
-                       if var-int(var) == 0: return '%d'%int(var)              
                        
+                       if var-int(var) == 0: return '%d'%int(var)
                        if var*10-int(var*10) == 0: return '%.1f'%var
                        if var*100-int(var*100) == 0: return '%.2f'%var
                        if var*1000-int(var*1000) == 0: return '%.3f'%var
-                       else: return '%.3g'%var                         
-               def to_str(var): 
+                       else: return '%.3g'%var
+               def to_str(var):
                        if isinstance(var, str): return var
-                       elif isinstance(var, complex): 
+                       elif isinstance(var, complex):
                                if var.imag == var.real == 0: return '0'        
#value is zero
                                elif var.imag == 0: return 
'%s'%float_to_str(var.real)  #value is real
                                elif var.real == 0: return 
'%sj'%float_to_str(var.imag) #value is imaginary
                                elif var.imag < 0: return 
'%s-%sj'%(float_to_str(var.real), float_to_str(var.imag*-1))
                                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, float): return float_to_str(var)
                        elif isinstance(var, int): return '%d'%var
-                       else: return str(var)   
+                       else: return str(var)
                
###########################################################################
                if self.is_valid():
                        data = self.evaluate()
@@ -200,13 +200,13 @@
                        elif isinstance(data, (list, tuple, set)): #vector types
                                dt_str = ', '.join(map(to_str, data))
                        else: dt_str = to_str(data)     #other types
-                       #truncate 
+                       #truncate
                        max_len = max(42 - len(self.get_name()), 3)
                        if len(dt_str) > max_len:
-                               dt_str = dt_str[:max_len-3] + '...'             
        
+                               dt_str = dt_str[:max_len-3] + '...'
                        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):
                """!
                Create a layout based on the current markup.
@@ -215,6 +215,6 @@
                layout = gtk.DrawingArea().create_pango_layout('')
                layout.set_markup(self.get_markup())
                desc = pango.FontDescription(PARAM_FONT)
-               layout.set_font_description(desc) 
+               layout.set_font_description(desc)
                return layout
 

Modified: grc/trunk/src/grc_gnuradio/Param.py
===================================================================
--- grc/trunk/src/grc_gnuradio/Param.py 2008-07-23 19:04:52 UTC (rev 8984)
+++ grc/trunk/src/grc_gnuradio/Param.py 2008-07-23 20:33:40 UTC (rev 8985)
@@ -180,6 +180,7 @@
                        #avoid collisions
                        params = filter(lambda p: p is not self, 
self.get_all_params('grid_pos'))
                        for param in params:
+                               if not hasattr(param, '_hostage_cells'): 
continue
                                for cell in param._hostage_cells:
                                        if cell in self._hostage_cells:
                                                
self._add_error_message('Another graphical element is using cell 
"%s".'%str(cell))

Added: grc/trunk/src/grc_gnuradio/blocks/filters/gr_moving_average_xx.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/filters/gr_moving_average_xx.xml          
                (rev 0)
+++ grc/trunk/src/grc_gnuradio/blocks/filters/gr_moving_average_xx.xml  
2008-07-23 20:33:40 UTC (rev 8985)
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Moving Average
+###################################################
+ -->
+<block>
+       <name>Moving Average</name>
+       <key>gr_moving_average_xx</key>
+       <import>from gnuradio import gr</import>
+       <make>gr.moving_average_$(type.fcn)($length, $scale, $max_iter)</make>
+       <param>
+               <name>Type</name>
+               <key>type</key>
+               <type>enum</type>
+               <option>
+                       <name>Complex</name>
+                       <key>complex</key>
+                       <opt>fcn:cc</opt>
+                       <opt>scale:complex</opt>
+               </option>
+               <option>
+                       <name>Float</name>
+                       <key>float</key>
+                       <opt>fcn:ff</opt>
+                       <opt>scale:real</opt>
+               </option>
+               <option>
+                       <name>Int</name>
+                       <key>int</key>
+                       <opt>fcn:ii</opt>
+                       <opt>scale:int</opt>
+               </option>
+               <option>
+                       <name>Short</name>
+                       <key>short</key>
+                       <opt>fcn:ss</opt>
+                       <opt>scale:int</opt>
+               </option>
+       </param>
+       <param>
+               <name>Length</name>
+               <key>length</key>
+               <value>1000</value>
+               <type>int</type>
+       </param>
+       <param>
+               <name>Scale</name>
+               <key>scale</key>
+               <value>1</value>
+               <type>$type.scale</type>
+       </param>
+       <param>
+               <name>Max Iter</name>
+               <key>max_iter</key>
+               <value>4000</value>
+               <type>int</type>
+       </param>
+       <sink>
+               <name>in</name>
+               <type>$type</type>
+       </sink>
+       <source>
+               <name>out</name>
+               <type>$type</type>
+       </source>
+</block>

Modified: grc/trunk/src/grc_gnuradio/blocks/graphical_sinks/wxgui_fftsink2.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/graphical_sinks/wxgui_fftsink2.xml        
2008-07-23 19:04:52 UTC (rev 8984)
+++ grc/trunk/src/grc_gnuradio/blocks/graphical_sinks/wxgui_fftsink2.xml        
2008-07-23 20:33:40 UTC (rev 8985)
@@ -87,13 +87,13 @@
        <param>
                <name>FFT Size</name>
                <key>fft_size</key>
-               <value>512</value>
+               <value>1024</value>
                <type>int</type>
        </param>
        <param>
-               <name>FFT Rate</name>
+               <name>Refresh Rate</name>
                <key>fft_rate</key>
-               <value>15</value>
+               <value>30</value>
                <type>int</type>
        </param>
        <param>

Modified: grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_costas_loop_cc.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_costas_loop_cc.xml       
2008-07-23 19:04:52 UTC (rev 8984)
+++ grc/trunk/src/grc_gnuradio/blocks/synchronizers/gr_costas_loop_cc.xml       
2008-07-23 20:33:40 UTC (rev 8985)
@@ -9,6 +9,8 @@
        <key>gr_costas_loop_cc</key>
        <import>from gnuradio import gr</import>
        <make>gr.costas_loop_cc($alpha, $beta, $max_freq, $min_freq, 
$order)</make>
+       <callback>set_alpha($alpha)</callback>
+       <callback>set_beta($beta)</callback>
        <param>
                <name>Alpha</name>
                <key>alpha</key>

Modified: grc/trunk/src/grc_gnuradio/data/block_tree.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/data/block_tree.xml      2008-07-23 19:04:52 UTC 
(rev 8984)
+++ grc/trunk/src/grc_gnuradio/data/block_tree.xml      2008-07-23 20:33:40 UTC 
(rev 8985)
@@ -170,6 +170,7 @@
                <block>blks2_rational_resampler_xxx</block>
                <block>gr_fractional_interpolator_xx</block>
                <block>gr_keep_one_in_n</block>
+               <block>gr_moving_average_xx</block>
        </cat>
        <cat>
                <name>Modulators</name>





reply via email to

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