Merge pull request #442 from Vulcalien/master

Fixed issue #433 (layout sometimes ignores ratio)
This commit is contained in:
Matt Rose 2021-06-01 16:42:04 -04:00 committed by GitHub
commit 013336191e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -488,11 +488,15 @@ class Paned(Container):
return float(position) / float(non_separator_size) return float(position) / float(non_separator_size)
def set_position_by_ratio(self): def set_position_by_ratio(self):
# For reasons unknown to me, self.ratio often changes when the following loop is executed
ratio = self.ratio
# Fix for strange race condition where every so often get_length returns 1. (LP:1655027) # Fix for strange race condition where every so often get_length returns 1. (LP:1655027)
while self.terminator.doing_layout and self.get_length() == 1: while self.terminator.doing_layout and self.get_length() == 1:
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
self.ratio = ratio
self.set_pos(self.position_by_ratio(self.get_length(), self.get_handlesize(), self.ratio)) self.set_pos(self.position_by_ratio(self.get_length(), self.get_handlesize(), self.ratio))
def set_position(self, pos): def set_position(self, pos):