Lay out some UI groundwork ideas for simultaneous typing support
This commit is contained in:
parent
6fcd3c92e2
commit
9bc24e665b
@ -117,6 +117,7 @@ class TerminatorNotebookTabLabel(gtk.HBox):
|
||||
|
||||
class Terminator:
|
||||
options = None
|
||||
groupings = ["test 1", "test 2"]
|
||||
|
||||
def __init__ (self, profile = None, command = None, fullscreen = False,
|
||||
maximise = False, borderless = False, no_gconf = False,
|
||||
|
@ -45,6 +45,8 @@ class TerminatorTerm (gtk.VBox):
|
||||
matches = {}
|
||||
TARGET_TYPE_VTE = 8
|
||||
_custom_font_size = None
|
||||
_group = None
|
||||
_want_titlebar = False
|
||||
|
||||
def __init__ (self, terminator, profile = None, command = None, cwd = None):
|
||||
gtk.VBox.__init__ (self)
|
||||
@ -74,8 +76,10 @@ class TerminatorTerm (gtk.VBox):
|
||||
self._termbox.show()
|
||||
self._title = gtk.Label()
|
||||
self._title.show()
|
||||
self._titlebox = gtk.EventBox()
|
||||
self._titlebox.add(self._title)
|
||||
self._titlegroup = gtk.Label()
|
||||
self._titlebox = gtk.HBox()
|
||||
self._titlebox.pack_start (self._titlegroup, False, True)
|
||||
self._titlebox.pack_start (self._title, True, True)
|
||||
|
||||
self._search_string = None
|
||||
self._searchbox = gtk.HBox()
|
||||
@ -123,6 +127,7 @@ class TerminatorTerm (gtk.VBox):
|
||||
|
||||
if self.conf.titlebars:
|
||||
self._titlebox.show()
|
||||
self._want_titlebar = True
|
||||
else:
|
||||
self._titlebox.hide()
|
||||
|
||||
@ -663,6 +668,7 @@ text/plain
|
||||
self.toggle_widget_visibility (self._scrollbar)
|
||||
|
||||
def do_title_toggle (self):
|
||||
self._want_titlebar = not self._titlebox.get_property ('visible')
|
||||
self.toggle_widget_visibility (self._titlebox)
|
||||
|
||||
def toggle_widget_visibility (self, widget):
|
||||
@ -924,6 +930,8 @@ text/plain
|
||||
item = gtk.CheckMenuItem (_("Show _titlebar"))
|
||||
item.set_active (self._titlebox.get_property ('visible'))
|
||||
item.connect ("toggled", lambda menu_item: self.do_title_toggle ())
|
||||
if self._group:
|
||||
item.set_sensitive (False)
|
||||
menu.append (item)
|
||||
|
||||
self._do_encoding_items (menu)
|
||||
@ -998,6 +1006,15 @@ text/plain
|
||||
item = gtk.MenuItem ()
|
||||
menu.append (item)
|
||||
|
||||
item = gtk.MenuItem (_("_Group"))
|
||||
menu.append (item)
|
||||
submenu = gtk.Menu ()
|
||||
item.set_submenu (submenu)
|
||||
self.populate_grouping_menu (submenu)
|
||||
|
||||
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)
|
||||
@ -1007,6 +1024,54 @@ text/plain
|
||||
|
||||
return True
|
||||
|
||||
def populate_grouping_menu (self, widget):
|
||||
groupitem = None
|
||||
|
||||
if len (self.terminator.groupings) > 0:
|
||||
groupitem = gtk.RadioMenuItem (groupitem, _("None"))
|
||||
groupitem.set_active (self._group == None)
|
||||
groupitem.connect ("activate", self.set_group, None)
|
||||
widget.append (groupitem)
|
||||
|
||||
for group in self.terminator.groupings:
|
||||
item = gtk.RadioMenuItem (groupitem, group)
|
||||
item.set_active (self._group == group)
|
||||
item.connect ("toggled", self.set_group, group)
|
||||
widget.append (item)
|
||||
groupitem = item
|
||||
|
||||
item = gtk.MenuItem ()
|
||||
widget.append (item)
|
||||
|
||||
item = gtk.MenuItem (_("_Create new group"))
|
||||
item.connect ("activate", self.create_group)
|
||||
widget.append (item)
|
||||
|
||||
def create_group (self, item):
|
||||
print "Create grouping"
|
||||
|
||||
def set_group (self, item, data):
|
||||
if self._group == data:
|
||||
# No action needed
|
||||
return
|
||||
|
||||
if data:
|
||||
self._titlegroup.set_text (data)
|
||||
self._titlegroup.show()
|
||||
else:
|
||||
self._titlegroup.hide()
|
||||
|
||||
if not self._group:
|
||||
# We were not previously in a group
|
||||
self._titlebox.show ()
|
||||
else:
|
||||
# We were previously in a group
|
||||
if data == None:
|
||||
# We have been removed from a group
|
||||
if not self.conf.titlebars and not self._want_titlebar:
|
||||
self._titlebox.hide ()
|
||||
self._group = data
|
||||
|
||||
def on_encoding_change (self, widget, encoding):
|
||||
current = self._vte.get_encoding ()
|
||||
if current != encoding:
|
||||
|
Loading…
Reference in New Issue
Block a user