[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11324 - in gnuradio/branches/developers/jblum/grc/grc
From: |
jblum |
Subject: |
[Commit-gnuradio] r11324 - in gnuradio/branches/developers/jblum/grc/grc: blocks grc_gnuradio/wxgui python |
Date: |
Wed, 1 Jul 2009 20:31:01 -0600 (MDT) |
Author: jblum
Date: 2009-07-01 20:31:00 -0600 (Wed, 01 Jul 2009)
New Revision: 11324
Modified:
gnuradio/branches/developers/jblum/grc/grc/blocks/wxgui_fftsink2.xml
gnuradio/branches/developers/jblum/grc/grc/grc_gnuradio/wxgui/panel.py
gnuradio/branches/developers/jblum/grc/grc/python/Param.py
Log:
work on verification of notebook params
Modified: gnuradio/branches/developers/jblum/grc/grc/blocks/wxgui_fftsink2.xml
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/blocks/wxgui_fftsink2.xml
2009-07-02 02:06:20 UTC (rev 11323)
+++ gnuradio/branches/developers/jblum/grc/grc/blocks/wxgui_fftsink2.xml
2009-07-02 02:31:00 UTC (rev 11324)
@@ -8,7 +8,7 @@
<name>FFT Sink</name>
<key>wxgui_fftsink2</key>
<import>from gnuradio.wxgui import fftsink2</import>
- <make>#set $parent = $notebook_page() and
'self.%s.GetPage(%s)'%($notebook_page()) or 'self'
+ <make>#set $parent = $notebook() and
'self.%s.GetPage(%s)'%($notebook()) or 'self'
fftsink2.$(type.fcn)(
$(parent).GetWin(),
baseband_freq=$baseband_freq,
@@ -159,10 +159,10 @@
<type>grid_pos</type>
</param>
<param>
- <name>Notebook Page</name>
- <key>notebook_page</key>
+ <name>Notebook</name>
+ <key>notebook</key>
<value></value>
- <type>notebook_page</type>
+ <type>notebook</type>
</param>
<sink>
<name>in</name>
@@ -173,6 +173,6 @@
Use the Grid Position (row, column, row span, column span) to position the
graphical element in the window.
-Use the Notebook Page (notebook-id, page-index) to place the graphical element
inside of a notebook page.
+Use the Notebook Param (notebook-id, page-index) to place the graphical
element inside of a notebook page.
</doc>
</block>
Modified: gnuradio/branches/developers/jblum/grc/grc/grc_gnuradio/wxgui/panel.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/grc_gnuradio/wxgui/panel.py
2009-07-02 02:06:20 UTC (rev 11323)
+++ gnuradio/branches/developers/jblum/grc/grc/grc_gnuradio/wxgui/panel.py
2009-07-02 02:31:00 UTC (rev 11324)
@@ -23,10 +23,10 @@
class Panel(wx.Panel):
def __init__(self, parent, orient=wx.VERTICAL):
wx.Panel.__init__(self, parent)
- self._vbox = wx.BoxSizer(orient)
+ self._box = wx.BoxSizer(orient)
self._grid = wx.GridBagSizer(5, 5)
self.Add(self._grid)
- self.SetSizer(self._vbox)
+ self.SetSizer(self._box)
def GetWin(self): return self
@@ -35,7 +35,7 @@
Add a window to the wx vbox.
@param win the wx window
"""
- self._vbox.Add(win, 0, wx.EXPAND)
+ self._box.Add(win, 0, wx.EXPAND)
def GridAdd(self, win, row, col, row_span=1, col_span=1):
"""
Modified: gnuradio/branches/developers/jblum/grc/grc/python/Param.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Param.py 2009-07-02
02:06:20 UTC (rev 11323)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Param.py 2009-07-02
02:31:00 UTC (rev 11324)
@@ -95,7 +95,7 @@
'hex', 'string', 'bool',
'file_open', 'file_save',
'id',
- 'grid_pos', 'notebook_page',
+ 'grid_pos', 'notebook',
'import',
]
@@ -172,6 +172,7 @@
'string': Constants.BYTE_VECTOR_COLOR_SPEC,
'id': Constants.ID_COLOR_SPEC,
'grid_pos': Constants.INT_VECTOR_COLOR_SPEC,
+ 'notebook': Constants.INT_VECTOR_COLOR_SPEC,
'raw': Constants.WILDCARD_COLOR_SPEC,
}[self.get_type()]
except: return _Param.get_color(self)
@@ -202,7 +203,7 @@
return 'part'
except: pass
#hide empty grid positions
- if self.get_key() in ('grid_pos', 'notebook_page') and not
self.get_value(): return 'part'
+ if self.get_key() in ('grid_pos', 'notebook') and not
self.get_value(): return 'part'
return hide
def validate(self):
@@ -332,30 +333,36 @@
#check row span, col span
try: assert row_span > 0 and col_span > 0
except AssertionError: raise Exception, 'Row and column
span must be greater than zero.'
+ #get hostage cell parent
+ try: my_parent =
self.get_parent().get_param('notebook').evaluate()
+ except: my_parent = ''
#calculate hostage cells
for r in range(row_span):
for c in range(col_span):
- self._hostage_cells.append((row+r,
col+c))
+ self._hostage_cells.append((my_parent,
(row+r, col+c)))
#avoid collisions
params = filter(lambda p: p is not self,
self.get_all_params('grid_pos'))
for param in params:
- for cell in param._hostage_cells:
- if cell in self._hostage_cells: raise
Exception, 'Another graphical element is using cell "%s".'%str(cell)
+ for parent, cell in param._hostage_cells:
+ if (parent, cell) in
self._hostage_cells:
+ raise Exception, 'Another
graphical element is using parent "%s", cell "%s".'%(str(parent), str(cell))
return e
#########################
# Notebook Page Type
#########################
- elif t == 'notebook_page':
+ elif t == 'notebook':
if not v: return '' #allow for empty notebook
+ #get a list of all notebooks
+ notebook_blocks = filter(lambda b: b.get_key() ==
'notebook', self.get_parent().get_parent().get_enabled_blocks())
+ #check for notebook param syntax
try: notebook_id, page_index = map(str.strip,
v.split(','))
except: raise Exception, 'Bad notebook page format.'
-
- #TODO check that notebook id is valid
-
- #TODO check that page index exists
-
- #TODO modify the grid params to be per notebook
-
+ #check that the notebook id is valid
+ 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()))
+ except: raise Exception, 'Page index "%s" is not a
valid index number.'%page_index
return notebook_id, page_index
#########################
# Import Type
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11324 - in gnuradio/branches/developers/jblum/grc/grc: blocks grc_gnuradio/wxgui python,
jblum <=