merge in full-window-term branch for terminal zooming feature. Fixes LP #229201
This commit is contained in:
commit
0de2ba1561
|
@ -18,6 +18,8 @@ terminator 0.9:
|
||||||
* Drag & Drop support
|
* Drag & Drop support
|
||||||
* Many bug fixes and wider compatibility with GNOME Terminal
|
* Many bug fixes and wider compatibility with GNOME Terminal
|
||||||
* Alpha transparency support when running in a composited window manager
|
* Alpha transparency support when running in a composited window manager
|
||||||
|
* Support terminal zooming - now you can quickly hide all terminals apart
|
||||||
|
from one
|
||||||
|
|
||||||
terminator 0.8.1:
|
terminator 0.8.1:
|
||||||
* Fixed ChangeLog
|
* Fixed ChangeLog
|
||||||
|
|
|
@ -77,6 +77,9 @@ Move to \fBp\fRrevious terminal.
|
||||||
.B Ctrl+Shift+W
|
.B Ctrl+Shift+W
|
||||||
Close the current terminal.
|
Close the current terminal.
|
||||||
.TP
|
.TP
|
||||||
|
.B Ctrl+Shift+Z
|
||||||
|
Toggle between showing all terminals and only showing the current one.
|
||||||
|
.TP
|
||||||
.B Ctrl+Shift+Q
|
.B Ctrl+Shift+Q
|
||||||
Close the current window.
|
Close the current window.
|
||||||
.TP
|
.TP
|
||||||
|
|
107
terminator
107
terminator
|
@ -623,6 +623,9 @@ text/plain
|
||||||
elif keyname == 'Page_Up':
|
elif keyname == 'Page_Up':
|
||||||
self.terminator.move_tab(self, 'left')
|
self.terminator.move_tab(self, 'left')
|
||||||
return (True)
|
return (True)
|
||||||
|
elif keyname == 'Z':
|
||||||
|
self.terminator.toggle_zoom (self)
|
||||||
|
return (True)
|
||||||
|
|
||||||
mask = gtk.gdk.CONTROL_MASK
|
mask = gtk.gdk.CONTROL_MASK
|
||||||
if (event.state & mask) == mask:
|
if (event.state & mask) == mask:
|
||||||
|
@ -723,25 +726,38 @@ text/plain
|
||||||
item = gtk.MenuItem ()
|
item = gtk.MenuItem ()
|
||||||
menu.append (item)
|
menu.append (item)
|
||||||
|
|
||||||
item = gtk.MenuItem (_("Split H_orizontally"))
|
if not self.terminator._zoomed:
|
||||||
item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, False))
|
item = gtk.MenuItem (_("Split H_orizontally"))
|
||||||
menu.append (item)
|
item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, False))
|
||||||
|
|
||||||
item = gtk.MenuItem (_("Split V_ertically"))
|
|
||||||
item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, True))
|
|
||||||
menu.append (item)
|
|
||||||
|
|
||||||
item = gtk.MenuItem (_("Open _Tab"))
|
|
||||||
item.connect ("activate", lambda menu_item: self.terminator.newtab (self))
|
|
||||||
menu.append (item)
|
|
||||||
|
|
||||||
if self.conf.extreme_tabs:
|
|
||||||
item = gtk.MenuItem (_("Open Top Level Tab"))
|
|
||||||
item.connect ("activate", lambda menu_item: self.terminator.newtab (self, True))
|
|
||||||
menu.append (item)
|
menu.append (item)
|
||||||
|
|
||||||
|
item = gtk.MenuItem (_("Split V_ertically"))
|
||||||
|
item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, True))
|
||||||
|
menu.append (item)
|
||||||
|
|
||||||
|
item = gtk.MenuItem (_("Open _Tab"))
|
||||||
|
item.connect ("activate", lambda menu_item: self.terminator.newtab (self))
|
||||||
|
menu.append (item)
|
||||||
|
|
||||||
|
if self.conf.extreme_tabs:
|
||||||
|
item = gtk.MenuItem (_("Open Top Level Tab"))
|
||||||
|
item.connect ("activate", lambda menu_item: self.terminator.newtab (self, True))
|
||||||
|
menu.append (item)
|
||||||
|
|
||||||
item = gtk.MenuItem ()
|
item = gtk.MenuItem ()
|
||||||
menu.append (item)
|
menu.append (item)
|
||||||
|
|
||||||
|
if len (self.terminator.term_list) > 1:
|
||||||
|
if not self.terminator._zoomed:
|
||||||
|
item = gtk.MenuItem (_("_Zoom terminal"))
|
||||||
|
item.connect ("activate", lambda menu_item: self.terminator.toggle_zoom (self))
|
||||||
|
else:
|
||||||
|
item = gtk.MenuItem (_("_Unzoom terminal"))
|
||||||
|
item.connect ("activate", lambda menu_item: self.terminator.toggle_zoom (self))
|
||||||
|
menu.append (item)
|
||||||
|
|
||||||
|
item = gtk.MenuItem ()
|
||||||
|
menu.append (item)
|
||||||
|
|
||||||
item = gtk.ImageMenuItem (gtk.STOCK_CLOSE)
|
item = gtk.ImageMenuItem (gtk.STOCK_CLOSE)
|
||||||
item.connect ("activate", lambda menu_item: self.terminator.closeterm (self))
|
item.connect ("activate", lambda menu_item: self.terminator.closeterm (self))
|
||||||
|
@ -843,6 +859,7 @@ class Terminator:
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
self.command = command
|
self.command = command
|
||||||
|
|
||||||
|
self._zoomed = False
|
||||||
self._fullscreen = False
|
self._fullscreen = False
|
||||||
self.term_list = []
|
self.term_list = []
|
||||||
stores = []
|
stores = []
|
||||||
|
@ -1155,6 +1172,11 @@ class Terminator:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def newtab(self,widget, toplevel = False):
|
def newtab(self,widget, toplevel = False):
|
||||||
|
if self._zoomed:
|
||||||
|
# We don't want to add a new tab while we are zoomed in on a terminal
|
||||||
|
dbg ("newtab function called, but Terminator was in zoomed terminal mode.")
|
||||||
|
return
|
||||||
|
|
||||||
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
|
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
|
||||||
#only one term, we don't show the title
|
#only one term, we don't show the title
|
||||||
terminal._titlebox.hide()
|
terminal._titlebox.hide()
|
||||||
|
@ -1235,6 +1257,11 @@ class Terminator:
|
||||||
|
|
||||||
def splitaxis (self, widget, vertical=True):
|
def splitaxis (self, widget, vertical=True):
|
||||||
""" Split the provided widget on the horizontal or vertical axis. """
|
""" Split the provided widget on the horizontal or vertical axis. """
|
||||||
|
if self._zoomed:
|
||||||
|
# We don't want to split the terminal while we are in zoomed mode
|
||||||
|
dbg ("splitaxis function called, but Terminator was in zoomed mode.")
|
||||||
|
return
|
||||||
|
|
||||||
# create a new terminal and parent pane.
|
# create a new terminal and parent pane.
|
||||||
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
|
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
|
||||||
pos = vertical and "bottom" or "right"
|
pos = vertical and "bottom" or "right"
|
||||||
|
@ -1288,7 +1315,8 @@ class Terminator:
|
||||||
else:
|
else:
|
||||||
grandparent.remove (parent)
|
grandparent.remove (parent)
|
||||||
sibling.reparent (grandparent)
|
sibling.reparent (grandparent)
|
||||||
grandparent.resize_children()
|
if not self._zoomed:
|
||||||
|
grandparent.resize_children()
|
||||||
parent.destroy ()
|
parent.destroy ()
|
||||||
if isinstance(sibling, TerminatorTerm) and isinstance(sibling.get_parent(), gtk.Notebook):
|
if isinstance(sibling, TerminatorTerm) and isinstance(sibling.get_parent(), gtk.Notebook):
|
||||||
sibling._titlebox.hide()
|
sibling._titlebox.hide()
|
||||||
|
@ -1334,6 +1362,11 @@ class Terminator:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def closeterm (self, widget):
|
def closeterm (self, widget):
|
||||||
|
if self._zoomed:
|
||||||
|
# We are zoomed, pop back out to normal layout before closing
|
||||||
|
dbg ("closeterm function called while in zoomed mode. Restoring previous layout before closing.")
|
||||||
|
self.unzoom_term (widget)
|
||||||
|
|
||||||
if self.remove(widget):
|
if self.remove(widget):
|
||||||
widget.destroy ()
|
widget.destroy ()
|
||||||
return True
|
return True
|
||||||
|
@ -1480,6 +1513,44 @@ class Terminator:
|
||||||
for term in self.term_list:
|
for term in self.term_list:
|
||||||
term.reconfigure_vte ()
|
term.reconfigure_vte ()
|
||||||
|
|
||||||
|
def toggle_zoom(self, widget):
|
||||||
|
if not self._zoomed:
|
||||||
|
self.zoom_term (widget)
|
||||||
|
else:
|
||||||
|
self.unzoom_term (widget)
|
||||||
|
|
||||||
|
def zoom_term (self, widget):
|
||||||
|
"""Proof of concept: Maximize to full window
|
||||||
|
an instance of TerminatorTerm.
|
||||||
|
"""
|
||||||
|
self.old_parent = widget.get_parent()
|
||||||
|
if isinstance(self.old_parent, gtk.Window):
|
||||||
|
return
|
||||||
|
if isinstance(self.old_parent, gtk.Notebook):
|
||||||
|
self.old_page = self.old_parent.get_current_page()
|
||||||
|
self.window_child = self.window.get_children()[0]
|
||||||
|
self.window.remove(self.window_child)
|
||||||
|
self.old_parent.remove(widget)
|
||||||
|
self.window.add(widget)
|
||||||
|
self._zoomed = True
|
||||||
|
|
||||||
|
def unzoom_term (self, widget):
|
||||||
|
"""Proof of concept: Go back to previous application
|
||||||
|
widget structure.
|
||||||
|
"""
|
||||||
|
if self._zoomed:
|
||||||
|
self.window.remove(widget)
|
||||||
|
self.window.add(self.window_child)
|
||||||
|
self.old_parent.add(widget)
|
||||||
|
if isinstance(self.old_parent, gtk.Notebook):
|
||||||
|
self.old_parent.set_current_page(self.old_page)
|
||||||
|
print "\nPARENT IS A NOTEBOOK\n"
|
||||||
|
self._zoomed = False
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
def execute_cb (option, opt, value, parser):
|
def execute_cb (option, opt, value, parser):
|
||||||
assert value is None
|
assert value is None
|
||||||
|
|
Loading…
Reference in New Issue