Merge a branch from Stephen J Boddy that fixes a dragging bug.
This commit is contained in:
commit
425e2aed6a
|
@ -43,6 +43,8 @@ class Paned(Container):
|
||||||
container = VPaned()
|
container = VPaned()
|
||||||
else:
|
else:
|
||||||
container = HPaned()
|
container = HPaned()
|
||||||
|
|
||||||
|
self.get_toplevel().set_pos_by_ratio = True
|
||||||
|
|
||||||
if not sibling:
|
if not sibling:
|
||||||
sibling = self.maker.make('terminal')
|
sibling = self.maker.make('terminal')
|
||||||
|
@ -60,6 +62,11 @@ class Paned(Container):
|
||||||
container.add(terminal)
|
container.add(terminal)
|
||||||
|
|
||||||
self.show_all()
|
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):
|
def add(self, widget, metadata=None):
|
||||||
"""Add a widget to the container"""
|
"""Add a widget to the container"""
|
||||||
|
@ -361,6 +368,12 @@ class Paned(Container):
|
||||||
container.add(child)
|
container.add(child)
|
||||||
|
|
||||||
def new_size(self, widget, allocation):
|
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()))
|
self.set_pos(int(self.ratio*self.get_length()))
|
||||||
|
|
||||||
def set_position(self, pos):
|
def set_position(self, pos):
|
||||||
|
|
|
@ -37,6 +37,7 @@ class Window(Container, gtk.Window):
|
||||||
losefocus_time = 0
|
losefocus_time = 0
|
||||||
position = None
|
position = None
|
||||||
ignore_startup_show = None
|
ignore_startup_show = None
|
||||||
|
set_pos_by_ratio = None
|
||||||
|
|
||||||
zoom_data = None
|
zoom_data = None
|
||||||
|
|
||||||
|
@ -418,6 +419,8 @@ class Window(Container, gtk.Window):
|
||||||
container = maker.make('VPaned')
|
container = maker.make('VPaned')
|
||||||
else:
|
else:
|
||||||
container = maker.make('HPaned')
|
container = maker.make('HPaned')
|
||||||
|
|
||||||
|
self.set_pos_by_ratio = True
|
||||||
|
|
||||||
if not sibling:
|
if not sibling:
|
||||||
sibling = maker.make('Terminal')
|
sibling = maker.make('Terminal')
|
||||||
|
@ -433,6 +436,11 @@ class Window(Container, gtk.Window):
|
||||||
for term in order:
|
for term in order:
|
||||||
container.add(term)
|
container.add(term)
|
||||||
container.show_all()
|
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):
|
def zoom(self, widget, font_scale=True):
|
||||||
"""Zoom a terminal widget"""
|
"""Zoom a terminal widget"""
|
||||||
|
@ -479,6 +487,7 @@ class Window(Container, gtk.Window):
|
||||||
|
|
||||||
def rotate(self, widget, clockwise):
|
def rotate(self, widget, clockwise):
|
||||||
"""Rotate children in this window"""
|
"""Rotate children in this window"""
|
||||||
|
self.set_pos_by_ratio = True
|
||||||
maker = Factory()
|
maker = Factory()
|
||||||
# collect all paned children in breadth-first order
|
# collect all paned children in breadth-first order
|
||||||
paned = []
|
paned = []
|
||||||
|
@ -494,6 +503,10 @@ class Window(Container, gtk.Window):
|
||||||
p.rotate(widget, clockwise)
|
p.rotate(widget, clockwise)
|
||||||
self.show_all()
|
self.show_all()
|
||||||
widget.grab_focus()
|
widget.grab_focus()
|
||||||
|
|
||||||
|
while gtk.events_pending():
|
||||||
|
gtk.main_iteration_do(False)
|
||||||
|
self.set_pos_by_ratio = False
|
||||||
|
|
||||||
def get_visible_terminals(self):
|
def get_visible_terminals(self):
|
||||||
"""Walk down the widget tree to find all of the visible terminals.
|
"""Walk down the widget tree to find all of the visible terminals.
|
||||||
|
|
Loading…
Reference in New Issue