commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11258 - in gnuradio/branches/developers/jblum/grc/grc


From: jblum
Subject: [Commit-gnuradio] r11258 - in gnuradio/branches/developers/jblum/grc/grc: . base gui python
Date: Sun, 21 Jun 2009 22:49:10 -0600 (MDT)

Author: jblum
Date: 2009-06-21 22:49:10 -0600 (Sun, 21 Jun 2009)
New Revision: 11258

Modified:
   gnuradio/branches/developers/jblum/grc/grc/base/Platform.py
   gnuradio/branches/developers/jblum/grc/grc/gui/ActionHandler.py
   gnuradio/branches/developers/jblum/grc/grc/gui/Actions.py
   gnuradio/branches/developers/jblum/grc/grc/gui/Bars.py
   gnuradio/branches/developers/jblum/grc/grc/gui/Dialogs.py
   gnuradio/branches/developers/jblum/grc/grc/python/Constants.py
   gnuradio/branches/developers/jblum/grc/grc/python/Param.py
   gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
   gnuradio/branches/developers/jblum/grc/grc/todo.txt
Log:
handly dandy dialog dialog for showing color mapping for data types

Modified: gnuradio/branches/developers/jblum/grc/grc/base/Platform.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/base/Platform.py 2009-06-22 
02:12:55 UTC (rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/base/Platform.py 2009-06-22 
04:49:10 UTC (rev 11258)
@@ -30,19 +30,21 @@
 
 class Platform(_Element):
 
-       def __init__(self, name, version, key, license, website,
-               block_paths, block_dtd, default_flow_graph, generator):
+       def __init__(self, name, version, key,
+               block_paths, block_dtd, default_flow_graph, generator,
+               license='', website=None, colors=[]):
                """
                Make a platform from the arguments.
                @param name the platform name
                @param version the version string
                @param key the unique platform key
-               @param license a multi-line license (first line is copyright)
-               @param website the website url for this platform
                @param block_paths the file paths to blocks in this platform
                @param block_dtd the dtd validator for xml block wrappers
                @param default_flow_graph the default flow graph file path
-               @param load_one a single file to load into this platform or None
+               @param generator the generator class for this platform
+               @param colors a list of title, color_spec tuples
+               @param license a multi-line license (first line is copyright)
+               @param website the website url for this platform
                @return a platform object
                """
                _Element.__init__(self)
@@ -55,6 +57,7 @@
                self._block_dtd = block_dtd
                self._default_flow_graph = default_flow_graph
                self._generator = generator
+               self._colors = colors
                #create a dummy flow graph for the blocks
                self._flow_graph = _Element(self)
                #search for *.xml files in the given search path
@@ -158,6 +161,7 @@
        def get_key(self): return self._key
        def get_license(self): return self._license
        def get_website(self): return self._website
+       def get_colors(self): return self._colors
 
        ##############################################
        # Constructors

Modified: gnuradio/branches/developers/jblum/grc/grc/gui/ActionHandler.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/ActionHandler.py     
2009-06-22 02:12:55 UTC (rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/ActionHandler.py     
2009-06-22 04:49:10 UTC (rev 11258)
@@ -133,6 +133,7 @@
                                Actions.FLOW_GRAPH_OPEN, 
Actions.FLOW_GRAPH_SAVE_AS,
                                Actions.FLOW_GRAPH_CLOSE, 
Actions.ABOUT_WINDOW_DISPLAY,
                                Actions.FLOW_GRAPH_SCREEN_CAPTURE, 
Actions.HELP_WINDOW_DISPLAY,
+                               Actions.COLORS_WINDOW_DISPLAY,
                        ): 
Actions.get_action_from_name(action).set_sensitive(True)
                        if not self.init_file_paths:
                                self.init_file_paths = Preferences.files_open()
@@ -236,6 +237,8 @@
                        Dialogs.AboutDialog(self.get_flow_graph().get_parent())
                elif state == Actions.HELP_WINDOW_DISPLAY:
                        Dialogs.HelpDialog()
+               elif state == Actions.COLORS_WINDOW_DISPLAY:
+                       Dialogs.ColorsDialog(self.get_flow_graph().get_parent())
                ##################################################
                # Param Modifications
                ##################################################

Modified: gnuradio/branches/developers/jblum/grc/grc/gui/Actions.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/Actions.py   2009-06-22 
02:12:55 UTC (rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/Actions.py   2009-06-22 
04:49:10 UTC (rev 11258)
@@ -57,6 +57,7 @@
 FLOW_GRAPH_SCREEN_CAPTURE = 'flow graph screen capture'
 ABOUT_WINDOW_DISPLAY = 'about window display'
 HELP_WINDOW_DISPLAY = 'help window display'
+COLORS_WINDOW_DISPLAY = 'colors window display'
 
 
######################################################################################################
 # Action Key Map
@@ -131,6 +132,7 @@
        gtk.Action(BLOCK_PASTE, '_Paste', 'Paste', gtk.STOCK_PASTE),
        gtk.Action(ABOUT_WINDOW_DISPLAY, '_About', 'About this program', 
gtk.STOCK_ABOUT),
        gtk.Action(HELP_WINDOW_DISPLAY, '_Help', 'Usage Tips', gtk.STOCK_HELP),
+       gtk.Action(COLORS_WINDOW_DISPLAY, '_Colors', 'Color Mapping', 
gtk.STOCK_DIALOG_INFO),
        gtk.Action(FLOW_GRAPH_GEN, '_Generate', 'Generate the flow graph', 
gtk.STOCK_CONVERT),
        gtk.Action(FLOW_GRAPH_EXEC, '_Execute', 'Execute the flow graph', 
gtk.STOCK_EXECUTE),
        gtk.Action(FLOW_GRAPH_KILL, '_Kill', 'Kill the flow graph', 
gtk.STOCK_STOP),

Modified: gnuradio/branches/developers/jblum/grc/grc/gui/Bars.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/Bars.py      2009-06-22 
02:12:55 UTC (rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/Bars.py      2009-06-22 
04:49:10 UTC (rev 11258)
@@ -88,6 +88,7 @@
        ]),
        (gtk.Action('Help', '_Help', None, None), [
                Actions.HELP_WINDOW_DISPLAY,
+               Actions.COLORS_WINDOW_DISPLAY,
                None,
                Actions.ABOUT_WINDOW_DISPLAY,
        ]),

Modified: gnuradio/branches/developers/jblum/grc/grc/gui/Dialogs.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/Dialogs.py   2009-06-22 
02:12:55 UTC (rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/Dialogs.py   2009-06-22 
04:49:10 UTC (rev 11258)
@@ -21,6 +21,7 @@
 pygtk.require('2.0')
 import gtk
 import Preferences
+import Utils
 
 class TextDisplay(gtk.TextView):
        """A non editable gtk text view."""
@@ -70,12 +71,11 @@
                self.run()
                self.destroy()
 
-def HelpDialog():
-       MessageDialogHelper(
-               type=gtk.MESSAGE_INFO,
-               buttons=gtk.BUTTONS_CLOSE,
-               title='Help',
-               markup="""\
+def HelpDialog(): MessageDialogHelper(
+       type=gtk.MESSAGE_INFO,
+       buttons=gtk.BUTTONS_CLOSE,
+       title='Help',
+       markup="""\
 <b>Usage Tips</b>
 
 <u>Add block</u>: drag and drop or double click a block in the block selection 
window.
@@ -86,3 +86,20 @@
 <u>Remove connection</u>: select the connection and press delete, or drag the 
connection.
 
 * See the menu for other keyboard shortcuts.""")
+
+COLORS_DIALOG_MARKUP_TMPL = """\
+<b>Color Mapping</b>
+
+#if $colors
+       #set $max_len = max([len(color[0]) for color in $colors]) + 10
+       #for $title, $color_spec in $colors
+<span 
background="$color_spec"><tt>$($encode($title).center($max_len))</tt></span>
+       #end for
+#end if
+"""
+
+def ColorsDialog(platform): MessageDialogHelper(
+       type=gtk.MESSAGE_INFO,
+       buttons=gtk.BUTTONS_CLOSE,
+       title='Colors',
+       markup=Utils.parse_template(COLORS_DIALOG_MARKUP_TMPL, 
colors=platform.get_colors()))

Modified: gnuradio/branches/developers/jblum/grc/grc/python/Constants.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Constants.py      
2009-06-22 02:12:55 UTC (rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Constants.py      
2009-06-22 04:49:10 UTC (rev 11258)
@@ -60,3 +60,4 @@
 SHORT_VECTOR_COLOR_SPEC = '#CCCC33'
 BYTE_VECTOR_COLOR_SPEC = '#CC66CC'
 ID_COLOR_SPEC = '#DDDDDD'
+WILDCARD_COLOR_SPEC = '#FFFFFF'

Modified: gnuradio/branches/developers/jblum/grc/grc/python/Param.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Param.py  2009-06-22 
02:12:55 UTC (rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Param.py  2009-06-22 
04:49:10 UTC (rev 11258)
@@ -171,6 +171,7 @@
                                'string': Constants.BYTE_VECTOR_COLOR_SPEC,
                                'id': Constants.ID_COLOR_SPEC,
                                'grid_pos': Constants.INT_VECTOR_COLOR_SPEC,
+                               'raw': Constants.WILDCARD_COLOR_SPEC,
                        }[self.get_type()]
                except: return _Param.get_color(self)
 

Modified: gnuradio/branches/developers/jblum/grc/grc/python/Platform.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Platform.py       
2009-06-22 02:12:55 UTC (rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Platform.py       
2009-06-22 04:49:10 UTC (rev 11258)
@@ -29,7 +29,22 @@
 from Constants import \
        HIER_BLOCKS_LIB_DIR, BLOCK_DTD, \
        DEFAULT_FLOW_GRAPH, BLOCKS_DIRS
+import Constants
 
+COLORS = (#title, #color spec
+       ('Complex', Constants.COMPLEX_COLOR_SPEC),
+       ('Float', Constants.FLOAT_COLOR_SPEC),
+       ('Integer', Constants.INT_COLOR_SPEC),
+       ('Short', Constants.SHORT_COLOR_SPEC),
+       ('Byte', Constants.BYTE_COLOR_SPEC),
+       ('Complex Vector', Constants.COMPLEX_VECTOR_COLOR_SPEC),
+       ('Float Vector', Constants.FLOAT_VECTOR_COLOR_SPEC),
+       ('Integer Vector', Constants.INT_VECTOR_COLOR_SPEC),
+       ('Short Vector', Constants.SHORT_VECTOR_COLOR_SPEC),
+       ('Byte Vector', Constants.BYTE_VECTOR_COLOR_SPEC),
+       ('Wildcard Type', Constants.WILDCARD_COLOR_SPEC),
+)
+
 class Platform(_Platform):
 
        def __init__(self):
@@ -52,6 +67,7 @@
                        block_dtd=BLOCK_DTD,
                        default_flow_graph=DEFAULT_FLOW_GRAPH,
                        generator=Generator,
+                       colors=COLORS,
                )
 
        ##############################################

Modified: gnuradio/branches/developers/jblum/grc/grc/todo.txt
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/todo.txt 2009-06-22 02:12:55 UTC 
(rev 11257)
+++ gnuradio/branches/developers/jblum/grc/grc/todo.txt 2009-06-22 04:49:10 UTC 
(rev 11258)
@@ -20,7 +20,8 @@
 * separate generated code into top block and gui class
   * use gui.py in gr-wxgui and remove custom top_block_gui
 * configuration option for adding block paths
-* data types guide/colors for the help menu
+* orientations for ports (top, right, bottom, left)
+  * source defaults to right, sink defaults to left
 
 ##################################################
 # Problems





reply via email to

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