diff --git a/terminator b/terminator index 9cd4a9f7..956665f4 100755 --- a/terminator +++ b/terminator @@ -730,6 +730,13 @@ text/plain item = gtk.MenuItem () menu.append (item) + item = gtk.MenuItem (_("M_aximize/Unmaximize")) + item.connect ("activate", lambda menu_item: self.terminator.fullwindow (self)) + menu.append (item) + + item = gtk.MenuItem () + menu.append (item) + item = gtk.ImageMenuItem (gtk.STOCK_CLOSE) item.connect ("activate", lambda menu_item: self.terminator.closeterm (self)) menu.append (item) @@ -830,6 +837,7 @@ class Terminator: self.profile = profile self.command = command + self._fullwindow = False self._fullscreen = False self.term_list = [] stores = [] @@ -1118,6 +1126,10 @@ class Terminator: return None def newtab(self,widget): + if self._fullwindow: + dbg ("newtab function called, but Terminator was in full-window mode.") + return + terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd()) parent = widget.get_parent () @@ -1186,6 +1198,9 @@ class Terminator: def splitaxis (self, widget, vertical=True): """ Split the provided widget on the horizontal or vertical axis. """ # create a new terminal and parent pane. + if self._fullwindow: + dbg ("splitaxis function called, but Terminator was in full-window mode.") + return terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd()) pos = vertical and "bottom" or "right" self.add(widget, terminal, pos) @@ -1278,6 +1293,10 @@ class Terminator: return True def closeterm (self, widget): + if self._fullwindow: + self.show_back_others(widget) + dbg ("closeterm function called while Terminator was in full-window mode.") + if self.remove(widget): widget.destroy () return True @@ -1440,6 +1459,44 @@ class Terminator: for term in self.term_list: term.reconfigure_vte () + def fullwindow(self, widget): + if not self._fullwindow: + self.hide_all_but_me(widget) + else: + self.show_back_others(widget) + + def hide_all_but_me (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._fullwindow = True + + def show_back_others(self, widget): + """Proof of concept: Go back to previous application + widget structure. + """ + if self._fullwindow: + 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._fullwindow = False + return + else: + return + + if __name__ == '__main__': def execute_cb (option, opt, value, parser):