Merge lp:~stephen-j-boddy/terminator/bugfix-lp-1017230 into lp:terminator/trunk

Proposed by Stephen Boddy
Status: Merged
Merged at revision: 1316
Proposed branch: lp:~stephen-j-boddy/terminator/bugfix-lp-1017230
Merge into: lp:terminator/trunk
Diff against target: 89 lines (+26/-0)
2 files modified
terminatorlib/paned.py (+13/-0)
terminatorlib/window.py (+13/-0)
To merge this branch: bzr merge lp:~stephen-j-boddy/terminator/bugfix-lp-1017230
Reviewer Review Type Date Requested Status
Chris Jones (community) Approve
Review via email: mp+111897@code.launchpad.net

Description of the change

Well this was a bit of a bugger! Some unpleasant interaction between the rotation code and my optimisation work meant that this was tricky to isolate and correctly fix. So now dragging works, and rotating the terms remembers the ratios too.

To post a comment you must log in.
1311. By Stephen Boddy

Spotted some unevenness in the initial position of new splits. This fixes it to 50:50

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Found some oddness with redistribute. I suspect bugfix-lp-1017230, rev 1311. Until I fix it please hold off on:
- feature-redistribute-terms
- bugfix-lp-1017230

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

I think this is mostly good to go now. The oddness is mostly gone with lp:~stephen-j-boddy/terminator/feature-redistribute-terms rev 1311.

Revision history for this message
Chris Jones (cmsj) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'terminatorlib/paned.py'
2--- terminatorlib/paned.py 2012-04-04 15:48:29 +0000
3+++ terminatorlib/paned.py 2012-06-25 18:03:17 +0000
4@@ -43,6 +43,8 @@
5 container = VPaned()
6 else:
7 container = HPaned()
8+
9+ self.get_toplevel().set_pos_by_ratio = True
10
11 if not sibling:
12 sibling = self.maker.make('terminal')
13@@ -60,6 +62,11 @@
14 container.add(terminal)
15
16 self.show_all()
17+
18+ while gtk.events_pending():
19+ gtk.main_iteration_do(False)
20+ self.get_toplevel().set_pos_by_ratio = False
21+
22
23 def add(self, widget, metadata=None):
24 """Add a widget to the container"""
25@@ -275,6 +282,12 @@
26 container.add(child)
27
28 def new_size(self, widget, allocation):
29+ if self.get_toplevel().set_pos_by_ratio:
30+ self.set_position_by_ratio()
31+ else:
32+ self.set_position(self.get_position())
33+
34+ def set_position_by_ratio(self):
35 self.set_pos(int(self.ratio*self.get_length()))
36
37 def set_position(self, pos):
38
39=== modified file 'terminatorlib/window.py'
40--- terminatorlib/window.py 2012-04-19 10:06:26 +0000
41+++ terminatorlib/window.py 2012-06-25 18:03:17 +0000
42@@ -37,6 +37,7 @@
43 losefocus_time = 0
44 position = None
45 ignore_startup_show = None
46+ set_pos_by_ratio = None
47
48 zoom_data = None
49
50@@ -418,6 +419,8 @@
51 container = maker.make('VPaned')
52 else:
53 container = maker.make('HPaned')
54+
55+ self.set_pos_by_ratio = True
56
57 if not sibling:
58 sibling = maker.make('Terminal')
59@@ -433,6 +436,11 @@
60 for term in order:
61 container.add(term)
62 container.show_all()
63+
64+ while gtk.events_pending():
65+ gtk.main_iteration_do(False)
66+ self.set_pos_by_ratio = False
67+
68
69 def zoom(self, widget, font_scale=True):
70 """Zoom a terminal widget"""
71@@ -479,6 +487,7 @@
72
73 def rotate(self, widget, clockwise):
74 """Rotate children in this window"""
75+ self.set_pos_by_ratio = True
76 maker = Factory()
77 # collect all paned children in breadth-first order
78 paned = []
79@@ -494,6 +503,10 @@
80 p.rotate(widget, clockwise)
81 self.show_all()
82 widget.grab_focus()
83+
84+ while gtk.events_pending():
85+ gtk.main_iteration_do(False)
86+ self.set_pos_by_ratio = False
87
88 def get_visible_terminals(self):
89 """Walk down the widget tree to find all of the visible terminals.