rework full-window-term branch to be called terminal zooming, and make the menu entries make a little more sense

This commit is contained in:
Chris Jones 2008-05-30 13:09:24 +01:00
parent 0a89a34441
commit bcad01126a
2 changed files with 51 additions and 50 deletions

View File

@ -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

View File

@ -723,32 +723,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)
item = gtk.MenuItem (_("M_aximize/Unmaximize")) if len (self.terminator.term_list) > 1:
item.connect ("activate", lambda menu_item: self.terminator.fullwindow (self)) if not self.terminator._zoomed:
menu.append (item) 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 () item = gtk.MenuItem ()
menu.append (item) 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))
@ -850,7 +856,7 @@ class Terminator:
self.profile = profile self.profile = profile
self.command = command self.command = command
self._fullwindow = False self._zoomed = False
self._fullscreen = False self._fullscreen = False
self.term_list = [] self.term_list = []
stores = [] stores = []
@ -1163,11 +1169,9 @@ class Terminator:
return None return None
def newtab(self,widget, toplevel = False): def newtab(self,widget, toplevel = False):
## Lines added for fullwidow (not fullscreen) support. if self._zoomed:
## Disables adding new tab when a terminal is # We don't want to add a new tab while we are zoomed in on a terminal
## maximized dbg ("newtab function called, but Terminator was in zoomed terminal mode.")
if self._fullwindow:
dbg ("newtab function called, but Terminator was in full-window mode.")
return return
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd()) terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
@ -1250,10 +1254,9 @@ 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. """
## Lines added for fullwidow (not fullscreen) support. if self._zoomed:
## Disables splitaxis when a terminal is maximized # We don't want to split the terminal while we are in zoomed mode
if self._fullwindow: dbg ("splitaxis function called, but Terminator was in zoomed mode.")
dbg ("splitaxis function called, but Terminator was in full-window mode.")
return return
# create a new terminal and parent pane. # create a new terminal and parent pane.
@ -1309,7 +1312,7 @@ class Terminator:
else: else:
grandparent.remove (parent) grandparent.remove (parent)
sibling.reparent (grandparent) sibling.reparent (grandparent)
if not self._fullwindow: if not self._zoomed:
grandparent.resize_children() 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):
@ -1356,12 +1359,10 @@ class Terminator:
return True return True
def closeterm (self, widget): def closeterm (self, widget):
## Lines added for fullwidow (not fullscreen) support. if self._zoomed:
## Disables adding new tab when a terminal is # We are zoomed, pop back out to normal layout before closing
## maximized dbg ("closeterm function called while in zoomed mode. Restoring previous layout before closing.")
if self._fullwindow: self.unzoom_term (widget)
dbg ("closeterm function called while in full-window mode. Restoring previous layout before closing.")
self.show_back_others(widget)
if self.remove(widget): if self.remove(widget):
widget.destroy () widget.destroy ()
@ -1509,15 +1510,13 @@ class Terminator:
for term in self.term_list: for term in self.term_list:
term.reconfigure_vte () term.reconfigure_vte ()
## Full window mode functions def toggle_zoom(self, widget):
if not self._zoomed:
def fullwindow(self, widget): self.zoom_term (widget)
if not self._fullwindow:
self.hide_all_but_me(widget)
else: else:
self.show_back_others(widget) self.unzoom_term (widget)
def hide_all_but_me (self, widget): def zoom_term (self, widget):
"""Proof of concept: Maximize to full window """Proof of concept: Maximize to full window
an instance of TerminatorTerm. an instance of TerminatorTerm.
""" """
@ -1530,20 +1529,20 @@ class Terminator:
self.window.remove(self.window_child) self.window.remove(self.window_child)
self.old_parent.remove(widget) self.old_parent.remove(widget)
self.window.add(widget) self.window.add(widget)
self._fullwindow = True self._zoomed = True
def show_back_others(self, widget): def unzoom_term (self, widget):
"""Proof of concept: Go back to previous application """Proof of concept: Go back to previous application
widget structure. widget structure.
""" """
if self._fullwindow: if self._zoomed:
self.window.remove(widget) self.window.remove(widget)
self.window.add(self.window_child) self.window.add(self.window_child)
self.old_parent.add(widget) self.old_parent.add(widget)
if isinstance(self.old_parent, gtk.Notebook): if isinstance(self.old_parent, gtk.Notebook):
self.old_parent.set_current_page(self.old_page) self.old_parent.set_current_page(self.old_page)
print "\nPARENT IS A NOTEBOOK\n" print "\nPARENT IS A NOTEBOOK\n"
self._fullwindow = False self._zoomed = False
return return
else: else:
return return