Complete refactoring of splitting terminals. Also fix function spacing in a few places
This commit is contained in:
parent
794bfc097c
commit
674326ead4
|
@ -310,9 +310,9 @@ class Terminator:
|
||||||
gobject.timeout_add (1000, self.do_initial_setup, term)
|
gobject.timeout_add (1000, self.do_initial_setup, term)
|
||||||
|
|
||||||
def do_initial_setup (self, term):
|
def do_initial_setup (self, term):
|
||||||
term2 = self.splitvert (term)
|
term2 = self.splitaxis (term, True)
|
||||||
self.splithoriz (term)
|
self.splitaxis (term, False)
|
||||||
self.splithoriz (term2)
|
self.splitaxis (term2, False)
|
||||||
return (False)
|
return (False)
|
||||||
|
|
||||||
def on_delete_event (self, widget, event, data=None):
|
def on_delete_event (self, widget, event, data=None):
|
||||||
|
@ -384,84 +384,6 @@ class Terminator:
|
||||||
parent.show_all ()
|
parent.show_all ()
|
||||||
return (term2)
|
return (term2)
|
||||||
|
|
||||||
def splithoriz (self, widget):
|
|
||||||
term2 = TerminatorTerm (self)
|
|
||||||
|
|
||||||
parent = widget.get_box ().get_parent()
|
|
||||||
pane = gtk.HPaned ()
|
|
||||||
|
|
||||||
# VTE doesn't seem to cope well with being resized by the window manager. I expect I am supposed to send some kind of WINCH, or just generally connect window resizing events to a callback that will often tell vte about the new size. For now, cheat. Badly.
|
|
||||||
cols = widget._vte.get_column_count ()
|
|
||||||
rows = widget._vte.get_row_count ()
|
|
||||||
allowance = widget._scrollbar.allocation.width + pane.style_get_property ('handle-size')
|
|
||||||
widget._vte.set_size ((cols / 2) - (allowance / widget._vte.get_char_width ()), rows)
|
|
||||||
term2._vte.set_size ((cols / 2) - (allowance / widget._vte.get_char_width ()), rows)
|
|
||||||
|
|
||||||
if isinstance (parent, gtk.Window):
|
|
||||||
# We just have one term
|
|
||||||
termwidth = parent.allocation.width / 2
|
|
||||||
widget.get_box ().reparent (pane)
|
|
||||||
|
|
||||||
pane.add1 (widget.get_box ())
|
|
||||||
pane.add2 (term2.get_box ())
|
|
||||||
|
|
||||||
parent.add (pane)
|
|
||||||
pane.set_position (termwidth)
|
|
||||||
|
|
||||||
if isinstance (parent, gtk.Paned):
|
|
||||||
# We are inside a split term
|
|
||||||
if (widget.get_box () == parent.get_child1 ()):
|
|
||||||
widget.get_box ().reparent (pane)
|
|
||||||
parent.add1 (pane)
|
|
||||||
else:
|
|
||||||
widget.get_box ().reparent (pane)
|
|
||||||
parent.add2 (pane)
|
|
||||||
|
|
||||||
pane.add1 (widget.get_box ())
|
|
||||||
pane.add2 (term2.get_box ())
|
|
||||||
|
|
||||||
parent.show_all ()
|
|
||||||
return (term2)
|
|
||||||
|
|
||||||
def splitvert (self, widget):
|
|
||||||
term2 = TerminatorTerm (self)
|
|
||||||
|
|
||||||
parent = widget.get_box ().get_parent()
|
|
||||||
pane = gtk.VPaned ()
|
|
||||||
cols = widget._vte.get_column_count ()
|
|
||||||
rows = widget._vte.get_row_count ()
|
|
||||||
allowance = widget._scrollbar.allocation.width + pane.style_get_property ('handle-size')
|
|
||||||
widget._vte.set_size (cols, (rows / 2) - (allowance / widget._vte.get_char_height ()))
|
|
||||||
term2._vte.set_size (cols, (rows / 2) - (allowance / widget._vte.get_char_height ()))
|
|
||||||
|
|
||||||
if isinstance (parent, gtk.Window):
|
|
||||||
# We just have one term
|
|
||||||
termheight = parent.allocation.height / 2
|
|
||||||
widget.get_box ().reparent (pane)
|
|
||||||
|
|
||||||
pane.add1 (widget.get_box ())
|
|
||||||
pane.add2 (term2.get_box ())
|
|
||||||
|
|
||||||
parent.add (pane)
|
|
||||||
pane.set_position (termheight)
|
|
||||||
|
|
||||||
if isinstance (parent, gtk.Paned):
|
|
||||||
# We are inside a split term
|
|
||||||
term2._vte.set_size (cols, (rows / 2) - 1)
|
|
||||||
|
|
||||||
if (widget.get_box () == parent.get_child1 ()):
|
|
||||||
widget.get_box ().reparent (pane)
|
|
||||||
parent.add1 (pane)
|
|
||||||
else:
|
|
||||||
widget.get_box ().reparent (pane)
|
|
||||||
parent.add2 (pane)
|
|
||||||
|
|
||||||
pane.add1 (widget.get_box ())
|
|
||||||
pane.add2 (term2.get_box ())
|
|
||||||
|
|
||||||
parent.show_all ()
|
|
||||||
return (term2)
|
|
||||||
|
|
||||||
def closeterm (self, widget):
|
def closeterm (self, widget):
|
||||||
parent = widget.get_box ().get_parent ()
|
parent = widget.get_box ().get_parent ()
|
||||||
sibling = None
|
sibling = None
|
||||||
|
|
Loading…
Reference in New Issue