(trunk-1683) Merge feature branch for tab/terminal title editing from Haim Daniel
This commit is contained in:
parent
9115b62928
commit
295f884c6d
|
@ -221,8 +221,14 @@ Decrease font size. \fBNote:\fP This may require you to press shift, depending o
|
||||||
.B Ctrl+Zero (0)
|
.B Ctrl+Zero (0)
|
||||||
Restore font size to original setting.
|
Restore font size to original setting.
|
||||||
.TP
|
.TP
|
||||||
.B Alt+T
|
.B Ctrl+W
|
||||||
Rename titlebar.
|
Rename window title.
|
||||||
|
.TP
|
||||||
|
.B Ctrl+A
|
||||||
|
Rename tab title.
|
||||||
|
.TP
|
||||||
|
.B Ctrl+X
|
||||||
|
Rename terminal title.
|
||||||
.TP
|
.TP
|
||||||
.B Super+1
|
.B Super+1
|
||||||
Insert terminal number, i.e. 1 to 12.
|
Insert terminal number, i.e. 1 to 12.
|
||||||
|
|
|
@ -286,6 +286,18 @@ Note that <Alt><Shift>1 may need to be provided as <Alt>! or similar,
|
||||||
depending on your keyboard layout.
|
depending on your keyboard layout.
|
||||||
Default value: \fBUnbound\fR
|
Default value: \fBUnbound\fR
|
||||||
.TP
|
.TP
|
||||||
|
.B edit_window_title
|
||||||
|
Edit the current active window's title
|
||||||
|
Default value: \fB<Ctrl>W\fR
|
||||||
|
.TP
|
||||||
|
.B edit_tab_title
|
||||||
|
Edit the currently active tab's title
|
||||||
|
Default value: \fB<Ctrl>A\fR
|
||||||
|
.TP
|
||||||
|
.B edit_terminal_title
|
||||||
|
Edit the currently active terminal's title
|
||||||
|
Default value: \fB<Ctrl>X\fR
|
||||||
|
.TP
|
||||||
.B full_screen
|
.B full_screen
|
||||||
Toggle the window to a fullscreen window.
|
Toggle the window to a fullscreen window.
|
||||||
Default value: \fBF11\fR
|
Default value: \fBF11\fR
|
||||||
|
|
|
@ -192,7 +192,9 @@ DEFAULTS = {
|
||||||
'broadcast_all' : '<Alt>a',
|
'broadcast_all' : '<Alt>a',
|
||||||
'insert_number' : '<Super>1',
|
'insert_number' : '<Super>1',
|
||||||
'insert_padded' : '<Super>0',
|
'insert_padded' : '<Super>0',
|
||||||
'edit_window_title': '<Alt>t',
|
'edit_window_title': '<Control>w',
|
||||||
|
'edit_tab_title' : '<Control>a',
|
||||||
|
'edit_terminal_title': '<Control>x',
|
||||||
'layout_launcher' : '<Alt>l',
|
'layout_launcher' : '<Alt>l',
|
||||||
'next_profile' : '',
|
'next_profile' : '',
|
||||||
'previous_profile' : '',
|
'previous_profile' : '',
|
||||||
|
|
|
@ -25,7 +25,8 @@ class EditableLabel(Gtk.EventBox):
|
||||||
# pylint: disable-msg=R0904
|
# pylint: disable-msg=R0904
|
||||||
"""
|
"""
|
||||||
An eventbox that partialy emulate a Gtk.Label
|
An eventbox that partialy emulate a Gtk.Label
|
||||||
On double-click, the label is editable, entering an empty will revert back to automatic text
|
On double-click or key binding the label is editable, entering an empty
|
||||||
|
will revert back to automatic text
|
||||||
"""
|
"""
|
||||||
_label = None
|
_label = None
|
||||||
_ebox = None
|
_ebox = None
|
||||||
|
@ -67,30 +68,34 @@ class EditableLabel(Gtk.EventBox):
|
||||||
"""get the text from the label"""
|
"""get the text from the label"""
|
||||||
return(self._label.get_text())
|
return(self._label.get_text())
|
||||||
|
|
||||||
|
def edit(self):
|
||||||
|
""" Start editing the widget text """
|
||||||
|
if self._entry:
|
||||||
|
return False
|
||||||
|
self.remove (self._label)
|
||||||
|
self._entry = Gtk.Entry ()
|
||||||
|
self._entry.set_text (self._label.get_text ())
|
||||||
|
self._entry.show ()
|
||||||
|
self.add (self._entry)
|
||||||
|
sig = self._entry.connect ("focus-out-event", self._entry_to_label)
|
||||||
|
self._entry_handler_id.append(sig)
|
||||||
|
sig = self._entry.connect ("activate", self._on_entry_activated)
|
||||||
|
self._entry_handler_id.append(sig)
|
||||||
|
sig = self._entry.connect ("key-press-event",
|
||||||
|
self._on_entry_keypress)
|
||||||
|
self._entry_handler_id.append(sig)
|
||||||
|
sig = self._entry.connect("button-press-event",
|
||||||
|
self._on_entry_buttonpress)
|
||||||
|
self._entry_handler_id.append(sig)
|
||||||
|
self._entry.grab_focus ()
|
||||||
|
|
||||||
def _on_click_text(self, widget, event):
|
def _on_click_text(self, widget, event):
|
||||||
# pylint: disable-msg=W0613
|
# pylint: disable-msg=W0613
|
||||||
"""event handling text edition"""
|
"""event handling text edition"""
|
||||||
if event.button != 1:
|
if event.button != 1:
|
||||||
return False
|
return False
|
||||||
if event.type == Gdk.EventType._2BUTTON_PRESS:
|
if event.type == Gdk.EventType._2BUTTON_PRESS:
|
||||||
if self._entry:
|
self.edit()
|
||||||
return False
|
|
||||||
self.remove (self._label)
|
|
||||||
self._entry = Gtk.Entry ()
|
|
||||||
self._entry.set_text (self._label.get_text ())
|
|
||||||
self._entry.show ()
|
|
||||||
self.add (self._entry)
|
|
||||||
sig = self._entry.connect ("focus-out-event", self._entry_to_label)
|
|
||||||
self._entry_handler_id.append(sig)
|
|
||||||
sig = self._entry.connect ("activate", self._on_entry_activated)
|
|
||||||
self._entry_handler_id.append(sig)
|
|
||||||
sig = self._entry.connect ("key-press-event",
|
|
||||||
self._on_entry_keypress)
|
|
||||||
self._entry_handler_id.append(sig)
|
|
||||||
sig = self._entry.connect("button-press-event",
|
|
||||||
self._on_entry_buttonpress)
|
|
||||||
self._entry_handler_id.append(sig)
|
|
||||||
self._entry.grab_focus ()
|
|
||||||
return(True)
|
return(True)
|
||||||
return(False)
|
return(False)
|
||||||
|
|
||||||
|
|
|
@ -536,6 +536,9 @@ class TabLabel(Gtk.HBox):
|
||||||
else:
|
else:
|
||||||
return(None)
|
return(None)
|
||||||
|
|
||||||
|
def edit(self):
|
||||||
|
self.label.edit()
|
||||||
|
|
||||||
def update_button(self):
|
def update_button(self):
|
||||||
"""Update the state of our close button"""
|
"""Update the state of our close button"""
|
||||||
if not self.config['close_button_on_tab']:
|
if not self.config['close_button_on_tab']:
|
||||||
|
|
|
@ -147,6 +147,8 @@ class PrefsEditor:
|
||||||
'insert_number' : _('Insert terminal number'),
|
'insert_number' : _('Insert terminal number'),
|
||||||
'insert_padded' : _('Insert padded terminal number'),
|
'insert_padded' : _('Insert padded terminal number'),
|
||||||
'edit_window_title': _('Edit window title'),
|
'edit_window_title': _('Edit window title'),
|
||||||
|
'edit_terminal_title': _('Edit terminal title'),
|
||||||
|
'edit_tab_title' : _('Edit tab title'),
|
||||||
'layout_launcher' : _('Open layout launcher window'),
|
'layout_launcher' : _('Open layout launcher window'),
|
||||||
'next_profile' : _('Switch to next profile'),
|
'next_profile' : _('Switch to next profile'),
|
||||||
'previous_profile' : _('Switch to previous profile'),
|
'previous_profile' : _('Switch to previous profile'),
|
||||||
|
|
|
@ -1884,6 +1884,20 @@ class Terminal(Gtk.VBox):
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def key_edit_tab_title(self):
|
||||||
|
window = self.get_toplevel()
|
||||||
|
if not window.is_child_notebook():
|
||||||
|
return
|
||||||
|
|
||||||
|
notebook = window.get_children()[0]
|
||||||
|
n_page = notebook.get_current_page()
|
||||||
|
page = notebook.get_nth_page(n_page)
|
||||||
|
label = notebook.get_tab_label(page)
|
||||||
|
label.edit()
|
||||||
|
|
||||||
|
def key_edit_terminal_title(self):
|
||||||
|
self.titlebar.label.edit()
|
||||||
|
|
||||||
def key_layout_launcher(self):
|
def key_layout_launcher(self):
|
||||||
LAYOUTLAUNCHER=LayoutLauncher()
|
LAYOUTLAUNCHER=LayoutLauncher()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue