[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9119 - in grc/trunk/src/grc/gui: . elements
From: |
jblum |
Subject: |
[Commit-gnuradio] r9119 - in grc/trunk/src/grc/gui: . elements |
Date: |
Fri, 1 Aug 2008 01:32:13 -0600 (MDT) |
Author: jblum
Date: 2008-08-01 01:32:12 -0600 (Fri, 01 Aug 2008)
New Revision: 9119
Modified:
grc/trunk/src/grc/gui/ParamsDialog.py
grc/trunk/src/grc/gui/elements/Param.py
Log:
dynamic hide/show params in params dialog
Modified: grc/trunk/src/grc/gui/ParamsDialog.py
===================================================================
--- grc/trunk/src/grc/gui/ParamsDialog.py 2008-08-01 06:25:50 UTC (rev
9118)
+++ grc/trunk/src/grc/gui/ParamsDialog.py 2008-08-01 07:32:12 UTC (rev
9119)
@@ -67,7 +67,7 @@
err_box.pack_start(get_title_label('Error Messages'), False)
err_box.pack_start(self._error_messages_text_display, False)
#Add all the parameters
- for param in filter(lambda p: p.get_hide() != 'all',
self.block.get_params()):
+ for param in self.block.get_params():
vbox.pack_start(param.get_input_object(self._handle_changed), False)
vbox.pack_start(err_box, False)
#Done adding parameters
@@ -78,6 +78,8 @@
vbox.pack_start(TextDisplay(self.block.get_doc()),
False)
self.connect('key_press_event', self._handle_key_press)
self.show_all()
+ #initial update
+ for param in self.block.get_params(): param.update()
self._update_error_messages()
def _update_error_messages(self):
@@ -111,7 +113,9 @@
#update dependent params
if param.is_enum():
for other_param in param.get_parent().get_params():
- if param.get_key() in other_param._type:
other_param.update()
+ if param.get_key() is not other_param.get_key()
and (
+ param.get_key() in other_param._type or \
+ param.get_key() in other_param._hide):
other_param.update()
return True
def run(self):
Modified: grc/trunk/src/grc/gui/elements/Param.py
===================================================================
--- grc/trunk/src/grc/gui/elements/Param.py 2008-08-01 06:25:50 UTC (rev
9118)
+++ grc/trunk/src/grc/gui/elements/Param.py 2008-08-01 07:32:12 UTC (rev
9119)
@@ -119,8 +119,10 @@
"""The graphical parameter."""
def update(self):
- """Called when an external change occurs.
- Update the graphical input by calling the change handler."""
+ """!
+ Called when an external change occurs.
+ Update the graphical input by calling the change handler.
+ """
if hasattr(self, 'input'): self._handle_changed()
def get_input_object(self, callback=None):
@@ -130,12 +132,11 @@
@param callback a function of one argument(this param) to be
called from the change handler
@return gtk input object
"""
- self.callback=callback
+ self.callback = callback
if self.is_enum(): input = EnumParam
elif self.get_type() in ('file_open', 'file_save'): input =
FileParam
else: input = EntryParam
self.input = input(self, self._handle_changed)
- self._handle_changed()
return self.input
def _handle_changed(self, widget=None):
@@ -157,7 +158,10 @@
tip = '- ' + '\n- '.join(self.get_error_messages())
else:
self.input.set_markup(name)
- tip = self.evaluate()
+ tip = self.evaluate()
+ #hide/show
+ if self.get_hide() == 'all': self.input.hide_all()
+ else: self.input.show_all()
#set the tooltip
if self.input.tp: self.input.tp.set_tip(self.input.entry,
str(tip))
#execute the external callback
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9119 - in grc/trunk/src/grc/gui: . elements,
jblum <=