Implement (un)group_all and (un)group_tab
This commit is contained in:
parent
9c72b6287d
commit
14f98c1b89
@ -41,7 +41,12 @@ class Notebook(Container, gtk.Notebook):
|
||||
|
||||
def configure(self):
|
||||
"""Apply widget-wide settings"""
|
||||
# FIXME: Should all of our widgets have this?
|
||||
# FIXME: Should all of our widgets have a ::configure()?
|
||||
|
||||
# FIXME: The old reordered handler updated Terminator.terminals with
|
||||
# the new order of terminals. We probably need to preserve this for
|
||||
# navigation to next/prev terminals.
|
||||
|
||||
#self.connect('page-reordered', self.on_page_reordered)
|
||||
self.set_property('homogeneous', not self.config['scroll_tabbar'])
|
||||
self.set_scrollable(self.config['scroll_tabbar'])
|
||||
|
@ -79,7 +79,6 @@ class Paned(Container):
|
||||
|
||||
if maker.isinstance(widget, 'Terminal'):
|
||||
top_window = get_top_window(self)
|
||||
|
||||
signals = {'close-term': self.wrapcloseterm,
|
||||
'split-horiz': self.split_horiz,
|
||||
'split-vert': self.split_vert,
|
||||
@ -90,8 +89,14 @@ class Paned(Container):
|
||||
for signal in signals:
|
||||
self.connect_child(widget, signal, signals[signal])
|
||||
|
||||
# FIXME: We shouldn't be doing this exact same thing in each
|
||||
# Container
|
||||
self.connect_child(widget, 'maximise', top_window.zoom, False)
|
||||
self.connect_child(widget, 'tab-change', top_window.tab_change)
|
||||
self.connect_child(widget, 'group-all', top_window.group_all)
|
||||
self.connect_child(widget, 'ungroup-all', top_window.ungroup_all)
|
||||
self.connect_child(widget, 'group-tab', top_window.group_tab)
|
||||
self.connect_child(widget, 'ungroup-tab', top_window.ungroup_tab)
|
||||
|
||||
widget.grab_focus()
|
||||
|
||||
|
@ -58,6 +58,10 @@ class Terminal(gtk.VBox):
|
||||
(gobject.TYPE_STRING,)),
|
||||
'tab-change': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
|
||||
(gobject.TYPE_INT,)),
|
||||
'group-all': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
'ungroup-all': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
'group-tab': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
'ungroup-tab': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
|
||||
}
|
||||
|
||||
TARGET_TYPE_VTE = 8
|
||||
@ -1241,20 +1245,16 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
||||
self.vte.reset (True, True)
|
||||
|
||||
def key_group_all(self):
|
||||
# FIXME: Implement this
|
||||
self.group_all(self)
|
||||
self.emit('group-all')
|
||||
|
||||
def key_ungroup_all(self):
|
||||
# FIXME: Implement this
|
||||
self.ungroup_all(self)
|
||||
self.emit('ungroup-all')
|
||||
|
||||
def key_group_tab(self):
|
||||
# FIXME: Implement this
|
||||
self.group_tab(self)
|
||||
self.emit('group-tab')
|
||||
|
||||
def key_ungroup_tab(self):
|
||||
# FIXME: IMplement this
|
||||
self.ungroup_tab(self)
|
||||
self.emit('ungroup-tab')
|
||||
|
||||
def key_new_window(self):
|
||||
cmd = sys.argv[0]
|
||||
|
@ -405,6 +405,50 @@ class Window(Container, gtk.Window):
|
||||
# change
|
||||
child.set_current_page(child.get_current_page())
|
||||
|
||||
# FIXME: All of these (un)group_(all|tab) methods need refactoring work
|
||||
def group_all(self, widget):
|
||||
"""Group all terminals"""
|
||||
# FIXME: Why isn't this being done by Terminator() ?
|
||||
group = _('All')
|
||||
self.terminator.create_group(group)
|
||||
for terminal in self.terminator.terminals:
|
||||
terminal.set_group(None, group)
|
||||
|
||||
def ungroup_all(self, widget):
|
||||
"""Ungroup all terminals"""
|
||||
for terminal in self.terminator.terminals:
|
||||
terminal.set_group(None, None)
|
||||
|
||||
def group_tab(self, widget):
|
||||
"""Group all terminals in the current tab"""
|
||||
maker = Factory()
|
||||
notebook = self.get_child()
|
||||
|
||||
if not maker.isinstance(notebook, 'Notebook'):
|
||||
dbg('not in a notebook, refusing to group tab')
|
||||
return
|
||||
|
||||
pagenum = notebook.get_current_page()
|
||||
while True:
|
||||
group = _('Tab %d') % pagenum
|
||||
if group not in self.terminator.groups:
|
||||
break
|
||||
pagenum += 1
|
||||
for terminal in self.get_visible_terminals():
|
||||
terminal.set_group(None, group)
|
||||
|
||||
def ungroup_tab(self, widget):
|
||||
"""Ungroup all terminals in the current tab"""
|
||||
maker = Factory()
|
||||
notebook = self.get_child()
|
||||
|
||||
if not maker.isinstance(notebook, 'Notebook'):
|
||||
dbg('note in a notebook, refusing to ungroup tab')
|
||||
return
|
||||
|
||||
for terminal in self.get_visible_terminals():
|
||||
terminal.set_group(None, None)
|
||||
|
||||
class WindowTitle(object):
|
||||
"""Class to handle the setting of the window title"""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user