[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 09/25: grc: Added context menu to variable
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 09/25: grc: Added context menu to variable editor |
Date: |
Fri, 27 May 2016 19:14:58 +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 82459840e8633d6afa32c0069fdf6351b910fb31
Author: Glenn Richardson <address@hidden>
Date: Wed May 18 18:47:27 2016 -0400
grc: Added context menu to variable editor
---
grc/gui/VariableEditor.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/grc/gui/VariableEditor.py b/grc/gui/VariableEditor.py
index fcb1f4d..6d37a0f 100644
--- a/grc/gui/VariableEditor.py
+++ b/grc/gui/VariableEditor.py
@@ -33,6 +33,45 @@ BLOCK_INDEX = 0
ID_INDEX = 1
+class VariableEditorContextMenu(gtk.Menu):
+ """ A simple context menu for our variable editor """
+ def __init__(self, var_edit):
+ gtk.Menu.__init__(self)
+
+ self.imports = gtk.MenuItem("Add _Import")
+ self.imports.connect('activate', var_edit._handle_action,
var_edit.ADD_IMPORT)
+ self.add(self.imports)
+
+ self.variables = gtk.MenuItem("Add _Variable")
+ self.variables.connect('activate', var_edit._handle_action,
var_edit.ADD_VARIABLE)
+ self.add(self.variables)
+ self.add(gtk.SeparatorMenuItem())
+
+ self.enable = gtk.MenuItem("_Enable")
+ self.enable.connect('activate', var_edit._handle_action,
var_edit.ENABLE_BLOCK)
+ self.disable = gtk.MenuItem("_Disable")
+ self.disable.connect('activate', var_edit._handle_action,
var_edit.DISABLE_BLOCK)
+ self.add(self.enable)
+ self.add(self.disable)
+ self.add(gtk.SeparatorMenuItem())
+
+ self.delete = gtk.MenuItem("_Delete")
+ self.delete.connect('activate', var_edit._handle_action,
var_edit.DELETE_BLOCK)
+ self.add(self.delete)
+ self.add(gtk.SeparatorMenuItem())
+
+ self.properties = gtk.MenuItem("_Properties...")
+ self.properties.connect('activate', var_edit._handle_action,
var_edit.OPEN_PROPERTIES)
+ self.add(self.properties)
+ self.show_all()
+
+ def update_sensitive(self, selected, enabled=False):
+ self.delete.set_sensitive(selected)
+ self.properties.set_sensitive(selected)
+ self.enable.set_sensitive(selected and not enabled)
+ self.disable.set_sensitive(selected and enabled)
+
+
class VariableEditor(gtk.VBox):
# Actions that are handled by the editor
@@ -101,6 +140,7 @@ class VariableEditor(gtk.VBox):
self.pack_start(scrolled_window)
# Context menus
+ self._context_menu = VariableEditorContextMenu(self)
self._confirm_delete = Preferences.variable_editor_confirm_delete()
# Sets cell contents
@@ -269,6 +309,12 @@ class VariableEditor(gtk.VBox):
else:
self._handle_action(None, self.DELETE_CONFIRM,
event=event)
return True
+ elif event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
+ if self._block:
+ self._context_menu.update_sensitive(True,
enabled=self._block.get_enabled())
+ else:
+ self._context_menu.update_sensitive(False)
+ self._context_menu.popup(None, None, None, event.button,
event.time)
return False
def _handle_key_button_press(self, widget, event):
- [Commit-gnuradio] [gnuradio] 20/25: grc: faulty callback code if setter call contained a variable block id, (continued)
- [Commit-gnuradio] [gnuradio] 20/25: grc: faulty callback code if setter call contained a variable block id, git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 14/25: Revert "grc: fix callback evaluation", git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 18/25: modtool: Added version support for OOTs, git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 19/25: grc-refactor: minor clean-up of callback generator code, git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 15/25: grc: fix flow graph execution (amends ActionHandler refactoring), git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 10/25: grc: Variable editor tweaks., git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 25/25: Merge remote-tracking branch 'dkozel/uhd_lo_api', git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 16/25: Added controls for importing, exporting, and sharing LOs, git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 17/25: grc-refactor: fix custom canvas font sizes, git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 08/25: grc: Added the variable editor panel, git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 09/25: grc: Added context menu to variable editor,
git <=
- [Commit-gnuradio] [gnuradio] 06/25: grc: remove some dead code in FlowGraph.what_is_selected(), git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 23/25: Merge remote-tracking branch 'mbr0wn/modtool/versioning', git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 02/25: grc: block alignment tools, git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 03/25: grc: minor fixes/clean-ups, git, 2016/05/27
- [Commit-gnuradio] [gnuradio] 05/25: grc: some action handler refactoring, add flow_graph.update() wrapper, git, 2016/05/27