migrate more titlebar show/hide logic into TTT
This commit is contained in:
parent
bac635fc4a
commit
4c8c2614be
|
@ -512,8 +512,8 @@ class Terminator:
|
||||||
if (isinstance (parent, gtk.Notebook) or isinstance (parent, gtk.Window)) and widget.conf.titlebars:
|
if (isinstance (parent, gtk.Notebook) or isinstance (parent, gtk.Window)) and widget.conf.titlebars:
|
||||||
#not the only term in the notebook/window anymore, need to reshow the title
|
#not the only term in the notebook/window anymore, need to reshow the title
|
||||||
dbg ('SEGBUG: Showing _titlebox')
|
dbg ('SEGBUG: Showing _titlebox')
|
||||||
widget._titlebox.show()
|
widget._titlebox.update()
|
||||||
terminal._titlebox.show()
|
terminal._titlebox.update()
|
||||||
|
|
||||||
if isinstance (parent, gtk.Notebook):
|
if isinstance (parent, gtk.Notebook):
|
||||||
dbg ('SEGBUG: Parent is a notebook')
|
dbg ('SEGBUG: Parent is a notebook')
|
||||||
|
|
|
@ -41,15 +41,17 @@ except ImportError:
|
||||||
sys.exit (1)
|
sys.exit (1)
|
||||||
|
|
||||||
class TerminatorTermTitle (gtk.EventBox):
|
class TerminatorTermTitle (gtk.EventBox):
|
||||||
wanted = False
|
wanted = None
|
||||||
_title = None
|
_title = None
|
||||||
_group = None
|
_group = None
|
||||||
_separator = None
|
_separator = None
|
||||||
_hbox = None
|
_hbox = None
|
||||||
_icon = None
|
_icon = None
|
||||||
|
_parent = None
|
||||||
|
|
||||||
def __init__ (self):
|
def __init__ (self, configwanted = False):
|
||||||
gtk.EventBox.__init__ (self)
|
gtk.EventBox.__init__ (self)
|
||||||
|
|
||||||
self._title = gtk.Label ()
|
self._title = gtk.Label ()
|
||||||
self._group = gtk.Label ()
|
self._group = gtk.Label ()
|
||||||
self._separator = gtk.VSeparator ()
|
self._separator = gtk.VSeparator ()
|
||||||
|
@ -65,6 +67,8 @@ class TerminatorTermTitle (gtk.EventBox):
|
||||||
self._title.show ()
|
self._title.show ()
|
||||||
self._hbox.show ()
|
self._hbox.show ()
|
||||||
|
|
||||||
|
self.wanted = configwanted
|
||||||
|
|
||||||
def set_group_label (self, name):
|
def set_group_label (self, name):
|
||||||
"""If 'name' is None, hide the group name object, otherwise set it as the group label"""
|
"""If 'name' is None, hide the group name object, otherwise set it as the group label"""
|
||||||
if name:
|
if name:
|
||||||
|
@ -98,9 +102,16 @@ class TerminatorTermTitle (gtk.EventBox):
|
||||||
|
|
||||||
def update (self):
|
def update (self):
|
||||||
"""Update our state"""
|
"""Update our state"""
|
||||||
parent = self.get_parent ()
|
if not self._parent:
|
||||||
if parent._group:
|
self._parent = self.get_parent ()
|
||||||
self.set_group_label (parent._group)
|
|
||||||
|
if (self._parent.conf.titlebars and self.wanted) or self._parent._group:
|
||||||
|
self.show ()
|
||||||
|
else:
|
||||||
|
self.hide ()
|
||||||
|
|
||||||
|
if self._parent._group:
|
||||||
|
self.set_group_label (self._parent._group)
|
||||||
else:
|
else:
|
||||||
self.set_group_label (None)
|
self.set_group_label (None)
|
||||||
|
|
||||||
|
@ -138,7 +149,7 @@ class TerminatorTerm (gtk.VBox):
|
||||||
self._termbox = gtk.HBox ()
|
self._termbox = gtk.HBox ()
|
||||||
self._termbox.show()
|
self._termbox.show()
|
||||||
|
|
||||||
self._titlebox = TerminatorTermTitle ()
|
self._titlebox = TerminatorTermTitle (self.conf.titlebars)
|
||||||
|
|
||||||
self._search_string = None
|
self._search_string = None
|
||||||
self._searchbox = gtk.HBox()
|
self._searchbox = gtk.HBox()
|
||||||
|
@ -184,11 +195,7 @@ class TerminatorTerm (gtk.VBox):
|
||||||
self.pack_start(self._termbox)
|
self.pack_start(self._termbox)
|
||||||
self.pack_end(self._searchbox)
|
self.pack_end(self._searchbox)
|
||||||
|
|
||||||
if self.conf.titlebars:
|
self._titlebox.update ()
|
||||||
self._titlebox.show()
|
|
||||||
self._titlebox.wanted = True
|
|
||||||
else:
|
|
||||||
self._titlebox.hide()
|
|
||||||
|
|
||||||
self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ())
|
self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ())
|
||||||
if self.scrollbar_position != "hidden" and self.scrollbar_position != "disabled":
|
if self.scrollbar_position != "hidden" and self.scrollbar_position != "disabled":
|
||||||
|
@ -554,8 +561,7 @@ text/plain
|
||||||
dbg ('SEGBUG: Forked command')
|
dbg ('SEGBUG: Forked command')
|
||||||
|
|
||||||
self.on_vte_title_change(self._vte) # Force an initial update of our titles
|
self.on_vte_title_change(self._vte) # Force an initial update of our titles
|
||||||
if self.conf.titlebars:
|
self._titlebox.update ()
|
||||||
self._titlebox.show ()
|
|
||||||
|
|
||||||
if self._pid == -1:
|
if self._pid == -1:
|
||||||
err (_('Unable to start shell: ') + shell)
|
err (_('Unable to start shell: ') + shell)
|
||||||
|
@ -1267,21 +1273,13 @@ text/plain
|
||||||
if self._group == data:
|
if self._group == data:
|
||||||
# No action needed
|
# No action needed
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
self._group = data
|
||||||
|
|
||||||
self._titlebox.set_group_label (data)
|
self._titlebox.set_group_label (data)
|
||||||
|
self._titlebox.update ()
|
||||||
|
|
||||||
if not self._group:
|
self.terminator.group_hoover ()
|
||||||
# We were not previously in a group
|
|
||||||
self._titlebox.show ()
|
|
||||||
self._group = data
|
|
||||||
else:
|
|
||||||
# We were previously in a group
|
|
||||||
self._group = data
|
|
||||||
if data == None:
|
|
||||||
# We have been removed from a group
|
|
||||||
if not self.conf.titlebars and not self._titlebox.wanted:
|
|
||||||
self._titlebox.hide ()
|
|
||||||
self.terminator.group_hoover ()
|
|
||||||
|
|
||||||
def group_all (self, widget):
|
def group_all (self, widget):
|
||||||
allname = _("All")
|
allname = _("All")
|
||||||
|
@ -1381,11 +1379,11 @@ text/plain
|
||||||
notebookpage = self.terminator.get_first_notebook_page(notebookpage[0])
|
notebookpage = self.terminator.get_first_notebook_page(notebookpage[0])
|
||||||
|
|
||||||
def on_vte_focus_in(self, vte, event):
|
def on_vte_focus_in(self, vte, event):
|
||||||
self._titlebox.modify_bg(gtk.STATE_NORMAL,self.terminator.window.get_style().bg[gtk.STATE_SELECTED])
|
self._titlebox.set_background_color (self.terminator.window.get_style().bg[gtk.STATE_SELECTED])
|
||||||
return
|
return
|
||||||
|
|
||||||
def on_vte_focus_out(self, vte, event):
|
def on_vte_focus_out(self, vte, event):
|
||||||
self._titlebox.modify_bg(gtk.STATE_NORMAL, self.terminator.window.get_style().bg[gtk.STATE_NORMAL])
|
self._titlebox.set_background_color (self.terminator.window.get_style().bg[gtk.STATE_NORMAL])
|
||||||
return
|
return
|
||||||
|
|
||||||
def on_vte_focus(self, vte):
|
def on_vte_focus(self, vte):
|
||||||
|
|
Loading…
Reference in New Issue