commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 04/13: grc: only show code preview tab afte


From: git
Subject: [Commit-gnuradio] [gnuradio] 04/13: grc: only show code preview tab after user enables it
Date: Fri, 24 Jul 2015 15:33:48 +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 11752ea4f6868594b511fceac05d5677670e2f1c
Author: Sebastian Koslowski <address@hidden>
Date:   Fri Jul 17 10:03:17 2015 +0200

    grc: only show code preview tab after user enables it
---
 grc/gui/ActionHandler.py |  4 ++++
 grc/gui/Actions.py       | 11 +++++++++--
 grc/gui/Bars.py          |  2 ++
 grc/gui/PropsDialog.py   | 24 +++++++++++++++---------
 4 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 1ce4aed..584b412 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -124,6 +124,7 @@ class ActionHandler:
                 Actions.CLEAR_REPORTS, Actions.SAVE_REPORTS,
                 Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, 
Actions.TOGGLE_SNAP_TO_GRID,
                 Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
+                Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB,
             ): action.set_sensitive(True)
             if ParseXML.xml_failures:
                 Messages.send_xml_errors_if_any(ParseXML.xml_failures)
@@ -146,6 +147,7 @@ class ActionHandler:
                 Actions.TOGGLE_SCROLL_LOCK,
                 Actions.TOGGLE_SNAP_TO_GRID,
                 Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
+                Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB,
             ): action.load_from_preferences()
         elif action == Actions.APPLICATION_QUIT:
             if self.main_window.close_pages():
@@ -410,6 +412,8 @@ class ActionHandler:
             action.save_to_preferences()
         elif action == Actions.TOGGLE_SHOW_BLOCK_COMMENTS:
             action.save_to_preferences()
+        elif action == Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB:
+            action.save_to_preferences()
         ##################################################
         # Param Modifications
         ##################################################
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index cfb72d3..d864db7 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -278,6 +278,13 @@ TOGGLE_SHOW_BLOCK_COMMENTS = ToggleAction(
     tooltip="Show comment beneath each block",
     preference_name='show_block_comments'
 )
+TOGGLE_SHOW_CODE_PREVIEW_TAB = ToggleAction(
+    label='Generated Code Preview',
+    tooltip="Show a preview of the code generated for each Block in its "
+            "Properties Dialog",
+    preference_name='show_generated_code_tab',
+    default=False,
+)
 BLOCK_CREATE_HIER = Action(
     label='C_reate Hier',
     tooltip='Create hier block from selected blocks',
@@ -308,13 +315,13 @@ ERRORS_WINDOW_DISPLAY = Action(
     stock_id=gtk.STOCK_DIALOG_ERROR,
 )
 TOGGLE_REPORTS_WINDOW = ToggleAction(
-    label='Show _Reports',
+    label='Show _Reports Panel',
     tooltip='Toggle visibility of the Report widget',
     keypresses=(gtk.keysyms.r, gtk.gdk.CONTROL_MASK),
     preference_name='reports_window_visible'
 )
 TOGGLE_BLOCKS_WINDOW = ToggleAction(
-    label='Show _Block Tree',
+    label='Show _Block Tree Panel',
     tooltip='Toggle visibility of the block tree widget',
     keypresses=(gtk.keysyms.b, gtk.gdk.CONTROL_MASK),
     preference_name='blocks_window_visible'
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index abcc3c6..f0f8dac 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -103,6 +103,8 @@ MENU_BAR_LIST = (
         Actions.TOGGLE_SNAP_TO_GRID,
         Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
         None,
+        Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB,
+        None,
         Actions.ERRORS_WINDOW_DISPLAY,
         Actions.FIND_BLOCKS,
     ]),
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
index 009c763..9594470 100644
--- a/grc/gui/PropsDialog.py
+++ b/grc/gui/PropsDialog.py
@@ -104,15 +104,18 @@ class PropsDialog(gtk.Dialog):
         notebook.append_page(self._docs_box, gtk.Label("Documentation"))
 
         # Generated code for the block
-        self._code_text_display = code_view = SimpleTextDisplay()
-        code_view.set_wrap_mode(gtk.WRAP_NONE)
-        code_view.get_buffer().create_tag('b', weight=pango.WEIGHT_BOLD)
-        code_view.modify_font(pango.FontDescription(
-            'monospace %d' % FONT_SIZE))
-        code_box = gtk.ScrolledWindow()
-        code_box.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-        code_box.add_with_viewport(self._code_text_display)
-        notebook.append_page(code_box, gtk.Label("Generated Code"))
+        if Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB.get_active():
+            self._code_text_display = code_view = SimpleTextDisplay()
+            code_view.set_wrap_mode(gtk.WRAP_NONE)
+            code_view.get_buffer().create_tag('b', weight=pango.WEIGHT_BOLD)
+            code_view.modify_font(pango.FontDescription(
+                'monospace %d' % FONT_SIZE))
+            code_box = gtk.ScrolledWindow()
+            code_box.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+            code_box.add_with_viewport(self._code_text_display)
+            notebook.append_page(code_box, gtk.Label("Generated Code"))
+        else:
+            self._code_text_display = None
 
         # Error Messages for the block
         self._error_messages_text_display = SimpleTextDisplay()
@@ -201,6 +204,9 @@ class PropsDialog(gtk.Dialog):
         self._update_generated_code_page()
 
     def _update_generated_code_page(self):
+        if not self._code_text_display:
+            return  # user disabled code preview
+
         buffer = self._code_text_display.get_buffer()
         block = self._block
 



reply via email to

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