Additional shortcuts/code to toggle All/Tab grouping
This commit is contained in:
commit
3fa48565ef
|
@ -163,8 +163,10 @@ DEFAULTS = {
|
||||||
'reset_clear' : '<Shift><Control>g',
|
'reset_clear' : '<Shift><Control>g',
|
||||||
'hide_window' : '<Shift><Control><Alt>a',
|
'hide_window' : '<Shift><Control><Alt>a',
|
||||||
'group_all' : '<Super>g',
|
'group_all' : '<Super>g',
|
||||||
|
'group_all_toggle' : '',
|
||||||
'ungroup_all' : '<Shift><Super>g',
|
'ungroup_all' : '<Shift><Super>g',
|
||||||
'group_tab' : '<Super>t',
|
'group_tab' : '<Super>t',
|
||||||
|
'group_tab_toggle' : '',
|
||||||
'ungroup_tab' : '<Shift><Super>t',
|
'ungroup_tab' : '<Shift><Super>t',
|
||||||
'new_window' : '<Shift><Control>i',
|
'new_window' : '<Shift><Control>i',
|
||||||
'new_terminator' : '<Super>i',
|
'new_terminator' : '<Super>i',
|
||||||
|
|
|
@ -249,8 +249,10 @@ class Notebook(Container, gtk.Notebook):
|
||||||
'unzoom': self.unzoom,
|
'unzoom': self.unzoom,
|
||||||
'tab-change': top_window.tab_change,
|
'tab-change': top_window.tab_change,
|
||||||
'group-all': top_window.group_all,
|
'group-all': top_window.group_all,
|
||||||
|
'group-all-toggle': top_window.group_all_toggle,
|
||||||
'ungroup-all': top_window.ungroup_all,
|
'ungroup-all': top_window.ungroup_all,
|
||||||
'group-tab': top_window.group_tab,
|
'group-tab': top_window.group_tab,
|
||||||
|
'group-tab-toggle': top_window.group_tab_toggle,
|
||||||
'ungroup-tab': top_window.ungroup_tab,
|
'ungroup-tab': top_window.ungroup_tab,
|
||||||
'move-tab': top_window.move_tab,
|
'move-tab': top_window.move_tab,
|
||||||
'tab-new': [top_window.tab_new, widget],
|
'tab-new': [top_window.tab_new, widget],
|
||||||
|
|
|
@ -98,8 +98,10 @@ class Paned(Container):
|
||||||
'zoom': top_window.zoom,
|
'zoom': top_window.zoom,
|
||||||
'tab-change': top_window.tab_change,
|
'tab-change': top_window.tab_change,
|
||||||
'group-all': top_window.group_all,
|
'group-all': top_window.group_all,
|
||||||
|
'group-all-toggle': top_window.group_all_toggle,
|
||||||
'ungroup-all': top_window.ungroup_all,
|
'ungroup-all': top_window.ungroup_all,
|
||||||
'group-tab': top_window.group_tab,
|
'group-tab': top_window.group_tab,
|
||||||
|
'group-tab-toggle': top_window.group_tab_toggle,
|
||||||
'ungroup-tab': top_window.ungroup_tab,
|
'ungroup-tab': top_window.ungroup_tab,
|
||||||
'move-tab': top_window.move_tab,
|
'move-tab': top_window.move_tab,
|
||||||
'maximise': [top_window.zoom, False],
|
'maximise': [top_window.zoom, False],
|
||||||
|
|
|
@ -134,8 +134,10 @@ class PrefsEditor:
|
||||||
'reset_clear' : 'Reset and clear the terminal',
|
'reset_clear' : 'Reset and clear the terminal',
|
||||||
'hide_window' : 'Toggle window visibility',
|
'hide_window' : 'Toggle window visibility',
|
||||||
'group_all' : 'Group all terminals',
|
'group_all' : 'Group all terminals',
|
||||||
|
'group_all_toggle' : 'Group/Ungroup all terminals',
|
||||||
'ungroup_all' : 'Ungroup all terminals',
|
'ungroup_all' : 'Ungroup all terminals',
|
||||||
'group_tab' : 'Group terminals in tab',
|
'group_tab' : 'Group terminals in tab',
|
||||||
|
'group_tab_toggle' : 'Group/Ungroup terminals in tab',
|
||||||
'ungroup_tab' : 'Ungroup terminals in tab',
|
'ungroup_tab' : 'Ungroup terminals in tab',
|
||||||
'new_window' : 'Create a new window',
|
'new_window' : 'Create a new window',
|
||||||
'new_terminator' : 'Spawn a new Terminator process',
|
'new_terminator' : 'Spawn a new Terminator process',
|
||||||
|
|
|
@ -46,6 +46,7 @@ class Terminal(gtk.VBox):
|
||||||
'enumerate': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
'enumerate': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
||||||
(gobject.TYPE_INT,)),
|
(gobject.TYPE_INT,)),
|
||||||
'group-tab': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
'group-tab': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||||
|
'group-tab-toggle': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||||
'ungroup-tab': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
'ungroup-tab': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||||
'ungroup-all': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
'ungroup-all': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||||
'split-horiz': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
'split-horiz': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
||||||
|
@ -69,6 +70,7 @@ class Terminal(gtk.VBox):
|
||||||
'tab-change': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
'tab-change': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
||||||
(gobject.TYPE_INT,)),
|
(gobject.TYPE_INT,)),
|
||||||
'group-all': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
'group-all': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||||
|
'group-all-toggle': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||||
'move-tab': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
'move-tab': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
||||||
(gobject.TYPE_STRING,)),
|
(gobject.TYPE_STRING,)),
|
||||||
}
|
}
|
||||||
|
@ -1679,12 +1681,18 @@ class Terminal(gtk.VBox):
|
||||||
def key_group_all(self):
|
def key_group_all(self):
|
||||||
self.emit('group-all')
|
self.emit('group-all')
|
||||||
|
|
||||||
|
def key_group_all_toggle(self):
|
||||||
|
self.emit('group-all-toggle')
|
||||||
|
|
||||||
def key_ungroup_all(self):
|
def key_ungroup_all(self):
|
||||||
self.emit('ungroup-all')
|
self.emit('ungroup-all')
|
||||||
|
|
||||||
def key_group_tab(self):
|
def key_group_tab(self):
|
||||||
self.emit('group-tab')
|
self.emit('group-tab')
|
||||||
|
|
||||||
|
def key_group_tab_toggle(self):
|
||||||
|
self.emit('group-tab-toggle')
|
||||||
|
|
||||||
def key_ungroup_tab(self):
|
def key_ungroup_tab(self):
|
||||||
self.emit('ungroup-tab')
|
self.emit('ungroup-tab')
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,6 @@ class Terminator(Borg):
|
||||||
dbg('Terminator::register_terminal: registering %s:%s' %
|
dbg('Terminator::register_terminal: registering %s:%s' %
|
||||||
(id(terminal), type(terminal)))
|
(id(terminal), type(terminal)))
|
||||||
self.terminals.append(terminal)
|
self.terminals.append(terminal)
|
||||||
terminal.connect('ungroup-all', self.ungroup_all)
|
|
||||||
|
|
||||||
def deregister_terminal(self, terminal):
|
def deregister_terminal(self, terminal):
|
||||||
"""De-register a terminal widget"""
|
"""De-register a terminal widget"""
|
||||||
|
@ -377,12 +376,6 @@ class Terminator(Borg):
|
||||||
dbg('Terminator::create_group: registering group %s' % name)
|
dbg('Terminator::create_group: registering group %s' % name)
|
||||||
self.groups.append(name)
|
self.groups.append(name)
|
||||||
|
|
||||||
def ungroup_all(self, widget):
|
|
||||||
"""Remove all groups"""
|
|
||||||
for terminal in self.terminals:
|
|
||||||
terminal.set_group(None, None)
|
|
||||||
self.groups = []
|
|
||||||
|
|
||||||
def closegroupedterms(self, group):
|
def closegroupedterms(self, group):
|
||||||
"""Close all terminals in a group"""
|
"""Close all terminals in a group"""
|
||||||
for terminal in self.terminals[:]:
|
for terminal in self.terminals[:]:
|
||||||
|
|
|
@ -411,8 +411,10 @@ class Window(Container, gtk.Window):
|
||||||
'unzoom': self.unzoom,
|
'unzoom': self.unzoom,
|
||||||
'tab-change': self.tab_change,
|
'tab-change': self.tab_change,
|
||||||
'group-all': self.group_all,
|
'group-all': self.group_all,
|
||||||
|
'group-all-toggle': self.group_all_toggle,
|
||||||
'ungroup-all': self.ungroup_all,
|
'ungroup-all': self.ungroup_all,
|
||||||
'group-tab': self.group_tab,
|
'group-tab': self.group_tab,
|
||||||
|
'group-tab-toggle': self.group_tab_toggle,
|
||||||
'ungroup-tab': self.ungroup_tab,
|
'ungroup-tab': self.ungroup_tab,
|
||||||
'move-tab': self.move_tab,
|
'move-tab': self.move_tab,
|
||||||
'tab-new': [self.tab_new, widget],
|
'tab-new': [self.tab_new, widget],
|
||||||
|
@ -687,21 +689,29 @@ class Window(Container, gtk.Window):
|
||||||
# change
|
# change
|
||||||
child.set_current_page(child.get_current_page())
|
child.set_current_page(child.get_current_page())
|
||||||
|
|
||||||
# FIXME: All of these (un)group_(all|tab) methods need refactoring work
|
def set_groups(self, new_group, term_list):
|
||||||
|
"""Set terminals in term_list to new_group"""
|
||||||
|
for terminal in term_list:
|
||||||
|
terminal.set_group(None, new_group)
|
||||||
|
self.terminator.focus_changed(self.terminator.last_focused_term)
|
||||||
|
|
||||||
def group_all(self, widget):
|
def group_all(self, widget):
|
||||||
"""Group all terminals"""
|
"""Group all terminals"""
|
||||||
# FIXME: Why isn't this being done by Terminator() ?
|
# FIXME: Why isn't this being done by Terminator() ?
|
||||||
group = _('All')
|
group = _('All')
|
||||||
self.terminator.create_group(group)
|
self.terminator.create_group(group)
|
||||||
for terminal in self.terminator.terminals:
|
self.set_groups(group, self.terminator.terminals)
|
||||||
terminal.set_group(None, group)
|
|
||||||
self.terminator.focus_changed(self.terminator.last_focused_term)
|
def group_all_toggle(self, widget):
|
||||||
|
"""Toggle grouping to all"""
|
||||||
|
if widget.group == 'All':
|
||||||
|
self.ungroup_all(widget)
|
||||||
|
else:
|
||||||
|
self.group_all(widget)
|
||||||
|
|
||||||
def ungroup_all(self, widget):
|
def ungroup_all(self, widget):
|
||||||
"""Ungroup all terminals"""
|
"""Ungroup all terminals"""
|
||||||
for terminal in self.terminator.terminals:
|
self.set_groups(None, self.terminator.terminals)
|
||||||
terminal.set_group(None, None)
|
|
||||||
self.terminator.focus_changed(self.terminator.last_focused_term)
|
|
||||||
|
|
||||||
def group_tab(self, widget):
|
def group_tab(self, widget):
|
||||||
"""Group all terminals in the current tab"""
|
"""Group all terminals in the current tab"""
|
||||||
|
@ -718,9 +728,14 @@ class Window(Container, gtk.Window):
|
||||||
if group not in self.terminator.groups:
|
if group not in self.terminator.groups:
|
||||||
break
|
break
|
||||||
pagenum += 1
|
pagenum += 1
|
||||||
for terminal in self.get_visible_terminals():
|
self.set_groups(group, self.get_visible_terminals())
|
||||||
terminal.set_group(None, group)
|
|
||||||
self.terminator.focus_changed(self.terminator.last_focused_term)
|
def group_tab_toggle(self, widget):
|
||||||
|
"""Blah"""
|
||||||
|
if widget.group and widget.group[:4] == 'Tab ':
|
||||||
|
self.ungroup_tab(widget)
|
||||||
|
else:
|
||||||
|
self.group_tab(widget)
|
||||||
|
|
||||||
def ungroup_tab(self, widget):
|
def ungroup_tab(self, widget):
|
||||||
"""Ungroup all terminals in the current tab"""
|
"""Ungroup all terminals in the current tab"""
|
||||||
|
@ -731,9 +746,7 @@ class Window(Container, gtk.Window):
|
||||||
dbg('note in a notebook, refusing to ungroup tab')
|
dbg('note in a notebook, refusing to ungroup tab')
|
||||||
return
|
return
|
||||||
|
|
||||||
for terminal in self.get_visible_terminals():
|
self.set_groups(None, self.get_visible_terminals())
|
||||||
terminal.set_group(None, None)
|
|
||||||
self.terminator.focus_changed(self.terminator.last_focused_term)
|
|
||||||
|
|
||||||
def move_tab(self, widget, direction):
|
def move_tab(self, widget, direction):
|
||||||
"""Handle a keyboard shortcut for moving tab positions"""
|
"""Handle a keyboard shortcut for moving tab positions"""
|
||||||
|
|
Loading…
Reference in New Issue