Commit 800c5919 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist

XML Console: Add keyboard shortcuts

Adds Ctrl+Enter to send and Ctrl+Up to paste the last message
parent 617aad4a
......@@ -120,6 +120,13 @@ class XMLConsoleWindow(Gtk.Window):
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.destroy()
if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and
event.keyval == Gdk.KEY_Return or
event.keyval == Gdk.KEY_KP_Enter):
self.on_send()
if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and
event.keyval == Gdk.KEY_Up):
self.on_paste_last()
def on_row_activated(self, listbox, row):
text = row.get_child().get_text()
......@@ -170,7 +177,7 @@ class XMLConsoleWindow(Gtk.Window):
self.last_stanza = stanza
buffer_.set_text('')
def on_paste_last(self, button):
def on_paste_last(self, *args):
buffer_ = self._ui.input_entry.get_buffer()
if buffer_ is not None and self.last_stanza is not None:
buffer_.set_text(self.last_stanza)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment