From b6a75be6077669b2696898049dde63859ca8812b Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 25 Jun 2012 19:05:43 +0200 Subject: [PATCH 1/2] Fix the inability to drag the splitters --- terminatorlib/paned.py | 6 ++++++ terminatorlib/window.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index 4272ac02..5ee13862 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -275,6 +275,12 @@ class Paned(Container): container.add(child) def new_size(self, widget, allocation): + if self.get_toplevel().set_pos_by_ratio: + self.set_position_by_ratio() + else: + self.set_position(self.get_position()) + + def set_position_by_ratio(self): self.set_pos(int(self.ratio*self.get_length())) def set_position(self, pos): diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 50fe79c9..2d7ed1b2 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -37,6 +37,7 @@ class Window(Container, gtk.Window): losefocus_time = 0 position = None ignore_startup_show = None + set_pos_by_ratio = None zoom_data = None @@ -479,6 +480,7 @@ class Window(Container, gtk.Window): def rotate(self, widget, clockwise): """Rotate children in this window""" + self.set_pos_by_ratio = True maker = Factory() # collect all paned children in breadth-first order paned = [] @@ -494,6 +496,10 @@ class Window(Container, gtk.Window): p.rotate(widget, clockwise) self.show_all() widget.grab_focus() + + while gtk.events_pending(): + gtk.main_iteration_do(False) + self.set_pos_by_ratio = False def get_visible_terminals(self): """Walk down the widget tree to find all of the visible terminals. From cbb86c48c5858a12e7a85f96d066eeebac3485c9 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 25 Jun 2012 20:01:35 +0200 Subject: [PATCH 2/2] Spotted some unevenness in the initial position of new splits. This fixes it to 50:50 --- terminatorlib/paned.py | 7 +++++++ terminatorlib/window.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index 5ee13862..abde04cb 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -43,6 +43,8 @@ class Paned(Container): container = VPaned() else: container = HPaned() + + self.get_toplevel().set_pos_by_ratio = True if not sibling: sibling = self.maker.make('terminal') @@ -60,6 +62,11 @@ class Paned(Container): container.add(terminal) self.show_all() + + while gtk.events_pending(): + gtk.main_iteration_do(False) + self.get_toplevel().set_pos_by_ratio = False + def add(self, widget, metadata=None): """Add a widget to the container""" diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 2d7ed1b2..e770a0fa 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -419,6 +419,8 @@ class Window(Container, gtk.Window): container = maker.make('VPaned') else: container = maker.make('HPaned') + + self.set_pos_by_ratio = True if not sibling: sibling = maker.make('Terminal') @@ -434,6 +436,11 @@ class Window(Container, gtk.Window): for term in order: container.add(term) container.show_all() + + while gtk.events_pending(): + gtk.main_iteration_do(False) + self.set_pos_by_ratio = False + def zoom(self, widget, font_scale=True): """Zoom a terminal widget"""