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
=== modified file 'terminatorlib/paned.py'
--- terminatorlib/paned.py 2012-04-04 15:48:29 +0000
+++ terminatorlib/paned.py 2012-06-25 18:03:17 +0000
@@ -43,6 +43,8 @@
43 container = VPaned()43 container = VPaned()
44 else:44 else:
45 container = HPaned()45 container = HPaned()
46
47 self.get_toplevel().set_pos_by_ratio = True
4648
47 if not sibling:49 if not sibling:
48 sibling = self.maker.make('terminal')50 sibling = self.maker.make('terminal')
@@ -60,6 +62,11 @@
60 container.add(terminal)62 container.add(terminal)
6163
62 self.show_all()64 self.show_all()
65
66 while gtk.events_pending():
67 gtk.main_iteration_do(False)
68 self.get_toplevel().set_pos_by_ratio = False
69
6370
64 def add(self, widget, metadata=None):71 def add(self, widget, metadata=None):
65 """Add a widget to the container"""72 """Add a widget to the container"""
@@ -275,6 +282,12 @@
275 container.add(child)282 container.add(child)
276283
277 def new_size(self, widget, allocation):284 def new_size(self, widget, allocation):
285 if self.get_toplevel().set_pos_by_ratio:
286 self.set_position_by_ratio()
287 else:
288 self.set_position(self.get_position())
289
290 def set_position_by_ratio(self):
278 self.set_pos(int(self.ratio*self.get_length()))291 self.set_pos(int(self.ratio*self.get_length()))
279292
280 def set_position(self, pos):293 def set_position(self, pos):
281294
=== modified file 'terminatorlib/window.py'
--- terminatorlib/window.py 2012-04-19 10:06:26 +0000
+++ terminatorlib/window.py 2012-06-25 18:03:17 +0000
@@ -37,6 +37,7 @@
37 losefocus_time = 037 losefocus_time = 0
38 position = None38 position = None
39 ignore_startup_show = None39 ignore_startup_show = None
40 set_pos_by_ratio = None
4041
41 zoom_data = None42 zoom_data = None
4243
@@ -418,6 +419,8 @@
418 container = maker.make('VPaned')419 container = maker.make('VPaned')
419 else:420 else:
420 container = maker.make('HPaned')421 container = maker.make('HPaned')
422
423 self.set_pos_by_ratio = True
421424
422 if not sibling:425 if not sibling:
423 sibling = maker.make('Terminal')426 sibling = maker.make('Terminal')
@@ -433,6 +436,11 @@
433 for term in order:436 for term in order:
434 container.add(term)437 container.add(term)
435 container.show_all()438 container.show_all()
439
440 while gtk.events_pending():
441 gtk.main_iteration_do(False)
442 self.set_pos_by_ratio = False
443
436444
437 def zoom(self, widget, font_scale=True):445 def zoom(self, widget, font_scale=True):
438 """Zoom a terminal widget"""446 """Zoom a terminal widget"""
@@ -479,6 +487,7 @@
479487
480 def rotate(self, widget, clockwise):488 def rotate(self, widget, clockwise):
481 """Rotate children in this window"""489 """Rotate children in this window"""
490 self.set_pos_by_ratio = True
482 maker = Factory()491 maker = Factory()
483 # collect all paned children in breadth-first order492 # collect all paned children in breadth-first order
484 paned = []493 paned = []
@@ -494,6 +503,10 @@
494 p.rotate(widget, clockwise)503 p.rotate(widget, clockwise)
495 self.show_all()504 self.show_all()
496 widget.grab_focus()505 widget.grab_focus()
506
507 while gtk.events_pending():
508 gtk.main_iteration_do(False)
509 self.set_pos_by_ratio = False
497510
498 def get_visible_terminals(self):511 def get_visible_terminals(self):
499 """Walk down the widget tree to find all of the visible terminals.512 """Walk down the widget tree to find all of the visible terminals.