[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 05/08: grc: update PropsDialog on external
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 05/08: grc: update PropsDialog on external param change |
Date: |
Wed, 11 Nov 2015 23:08:07 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 2252b5caa205c792ac70a16e956b22cfc2d781df
Author: Sebastian Koslowski <address@hidden>
Date: Tue Sep 8 12:19:19 2015 -0400
grc: update PropsDialog on external param change
---
grc/gui/ActionHandler.py | 12 ++++++++----
grc/gui/Param.py | 10 +++++++---
grc/gui/PropsDialog.py | 8 ++++----
grc/python/Block.py | 4 ++--
4 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 6273178..a2c48a7 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -58,9 +58,10 @@ class ActionHandler:
platform: platform module
"""
self.clipboard = None
+ self.dialog = None
for action in Actions.get_all_actions(): action.connect('activate',
self._handle_action)
#setup the main window
- self.platform = platform;
+ self.platform = platform
self.main_window = MainWindow(platform, self._handle_action)
self.main_window.connect('delete-event', self._quit)
self.main_window.connect('key-press-event', self._handle_key_press)
@@ -425,10 +426,10 @@ class ActionHandler:
elif action == Actions.BLOCK_PARAM_MODIFY:
selected_block = self.get_flow_graph().get_selected_block()
if selected_block:
- dialog = PropsDialog(selected_block)
+ self.dialog = PropsDialog(selected_block)
response = gtk.RESPONSE_APPLY
while response == gtk.RESPONSE_APPLY: # rerun the dialog if
Apply was hit
- response = dialog.run()
+ response = self.dialog.run()
if response in (gtk.RESPONSE_APPLY, gtk.RESPONSE_ACCEPT):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
@@ -440,10 +441,13 @@ class ActionHandler:
if response == gtk.RESPONSE_APPLY:
# null action, that updates the main window
Actions.ELEMENT_SELECT()
- dialog.destroy()
+ self.dialog.destroy()
+ self.dialog = None
elif action == Actions.EXTERNAL_UPDATE:
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_flow_graph().update()
+ if self.dialog is not None:
+ self.dialog.update_gui(force=True)
self.get_page().set_saved(False)
##################################################
# View Parser Errors
diff --git a/grc/gui/Param.py b/grc/gui/Param.py
index 3588b81..5f83689 100644
--- a/grc/gui/Param.py
+++ b/grc/gui/Param.py
@@ -216,9 +216,9 @@ class PythonEditorParam(InputParam):
def __init__(self, *args, **kwargs):
InputParam.__init__(self, *args, **kwargs)
- input = gtk.Button('Open in Editor')
- input.connect('clicked', self.open_editor)
- self.pack_start(input, True)
+ button = self._button = gtk.Button('Open in Editor')
+ button.connect('clicked', self.open_editor)
+ self.pack_start(button, True)
def open_editor(self, widget=None):
if not os.path.exists(Constants.EDITOR):
@@ -229,6 +229,10 @@ class PythonEditorParam(InputParam):
def get_text(self):
pass # we never update the value from here
+ def set_color(self, color):
+ # self._button.modify_base(gtk.STATE_NORMAL,
gtk.gdk.color_parse(color))
+ self._button.modify_text(gtk.STATE_NORMAL,
Colors.PARAM_ENTRY_TEXT_COLOR)
+
def _apply_change(self, *args):
pass
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
index abf2426..f5a136e 100644
--- a/grc/gui/PropsDialog.py
+++ b/grc/gui/PropsDialog.py
@@ -127,7 +127,7 @@ class PropsDialog(gtk.Dialog):
# Connect events
self.connect('key-press-event', self._handle_key_press)
- self.connect('show', self._update_gui)
+ self.connect('show', self.update_gui)
self.connect('response', self._handle_response)
self.show_all() # show all (performs initial gui update)
@@ -158,12 +158,12 @@ class PropsDialog(gtk.Dialog):
# update for the block
self._block.rewrite()
self._block.validate()
- self._update_gui()
+ self.update_gui()
def _activate_apply(self, *args):
self.set_response_sensitive(gtk.RESPONSE_APPLY, True)
- def _update_gui(self, *args):
+ def update_gui(self, widget=None, force=False):
"""
Repopulate the parameters boxes (if changed).
Update all the input parameters.
@@ -173,7 +173,7 @@ class PropsDialog(gtk.Dialog):
Hide the box if there are no docs.
"""
# update the params box
- if self._params_changed():
+ if force or self._params_changed():
# hide params box before changing
for tab, label, vbox in self._params_boxes:
vbox.hide_all()
diff --git a/grc/python/Block.py b/grc/python/Block.py
index accfd21..f5f4064 100644
--- a/grc/python/Block.py
+++ b/grc/python/Block.py
@@ -117,7 +117,7 @@ class Block(_Block, _GUIBlock):
check_generate_mode('WX GUI', BLOCK_FLAG_NEED_WX_GUI, ('wx_gui',))
check_generate_mode('QT GUI', BLOCK_FLAG_NEED_QT_GUI, ('qt_gui',
'hb_qt_gui'))
if self._epy_reload_error:
- self.add_error_message(str(self._epy_reload_error))
+
self.get_param('_source_code').add_error_message(str(self._epy_reload_error))
def rewrite(self):
"""
@@ -245,7 +245,7 @@ class Block(_Block, _GUIBlock):
blk_io = epy_block_io.extract(src)
except Exception as e:
- self._epy_reload_error = ValueError('Source code eval:\n' + str(e))
+ self._epy_reload_error = ValueError(str(e))
try: # load last working block io
blk_io = epy_block_io.BlockIO(*eval(param_blk.get_value()))
except:
- [Commit-gnuradio] [gnuradio] branch master updated (6a88efb -> a18e480), git, 2015/11/11
- [Commit-gnuradio] [gnuradio] 01/08: runtime: add accessors for in_sig and out_sig in python blocks, git, 2015/11/11
- [Commit-gnuradio] [gnuradio] 04/08: grc: open and update params from external editor, git, 2015/11/11
- [Commit-gnuradio] [gnuradio] 02/08: grc: mark param type multiline as protected, git, 2015/11/11
- [Commit-gnuradio] [gnuradio] 05/08: grc: update PropsDialog on external param change,
git <=
- [Commit-gnuradio] [gnuradio] 03/08: grc: add embedded python block definition and support in GRC, git, 2015/11/11
- [Commit-gnuradio] [gnuradio] 06/08: grc: fix output file encoding, git, 2015/11/11
- [Commit-gnuradio] [gnuradio] 08/08: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/11/11
- [Commit-gnuradio] [gnuradio] 07/08: Merge branch 'maint', git, 2015/11/11