aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib/toolbar
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2017-01-06 04:36:44 +0100
committerFlorian Zeitz <florob@babelmonkeys.de>2017-01-31 22:58:42 +0100
commit882ea5ba6e46b413694d9a74a6aa246d2c7153f5 (patch)
tree757d464099f7d35eca9ffa20e2f07ef4c38160c0 /voctogui/lib/toolbar
parentb66d7b2d653f65a318d67b413d8680123bf14b25 (diff)
Add a ShortcutsWindow and tooltips to display accelerators
The GtkShortcutsWindow is shown upon pressing `?`. This is only available in Gtk+ >= 3.20. For earlier versions nothing happens.
Diffstat (limited to 'voctogui/lib/toolbar')
-rw-r--r--voctogui/lib/toolbar/composition.py3
-rw-r--r--voctogui/lib/toolbar/misc.py2
2 files changed, 5 insertions, 0 deletions
diff --git a/voctogui/lib/toolbar/composition.py b/voctogui/lib/toolbar/composition.py
index 2674260..b55254a 100644
--- a/voctogui/lib/toolbar/composition.py
+++ b/voctogui/lib/toolbar/composition.py
@@ -31,6 +31,9 @@ class CompositionToolbarController(object):
)
btn.set_name(name)
+ tooltip = Gtk.accelerator_get_label(key, mod)
+ btn.set_tooltip_text(tooltip)
+
# Thanks to http://stackoverflow.com/a/19739855/1659732
btn.get_child().add_accelerator('clicked', accelerators,
key, mod, Gtk.AccelFlags.VISIBLE)
diff --git a/voctogui/lib/toolbar/misc.py b/voctogui/lib/toolbar/misc.py
index 530bbad..8947368 100644
--- a/voctogui/lib/toolbar/misc.py
+++ b/voctogui/lib/toolbar/misc.py
@@ -26,6 +26,8 @@ class MiscToolbarController(object):
key, mod = Gtk.accelerator_parse('t')
cutbtn.add_accelerator('clicked', accelerators,
key, mod, Gtk.AccelFlags.VISIBLE)
+ tooltip = Gtk.accelerator_get_label(key, mod)
+ cutbtn.set_tooltip_text(tooltip)
def on_closebtn_clicked(self, btn):
self.log.info('close-button clicked')