[pitivi] Replace size_request calls with get_preferred_size



commit 97c8b7ffdbc8992a88290f217528eb83ddf2f72b
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Mon Nov 30 04:11:52 2015 +0100

    Replace size_request calls with get_preferred_size
    
    Fixes https://phabricator.freedesktop.org/T3466
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D571

 pitivi/dialogs/prefs.py |    2 +-
 pitivi/mainwindow.py    |    7 ++++---
 pitivi/utils/widgets.py |    2 +-
 pitivi/viewer.py        |    5 ++---
 4 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index c102e36..a9a2e87 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -77,7 +77,7 @@ class PreferencesDialog(object):
 
         self.sections = {}
         self.__fillContents()
-        req = self.contents.size_request()
+        req = self.contents.get_preferred_size()[0]
         min_width = req.width
         min_height = req.height
         width = max(min_width, self.settings.prefsDialogWidth)
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index ec48c8f..090d638 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -356,11 +356,12 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
         if self.settings.mainWindowVPanePosition is None:
             screen_width = float(self.get_screen().get_width())
             screen_height = float(self.get_screen().get_height())
+            req = self.vpaned.get_preferred_size()[0]
             if screen_width / screen_height < 0.75:
                 # Tall screen, give some more vertical space the the tabs.
-                value = self.vpaned.size_request().height / 3
+                value = req.height / 3
             else:
-                value = self.vpaned.size_request().height / 2
+                value = req.height / 2
             self.settings.mainWindowVPanePosition = value
 
     def checkScreenConstraints(self):
@@ -1356,7 +1357,7 @@ class PreviewAssetWindow(Gtk.Window):
         max_width = 0.85 * mainwindow_width
         max_height = 0.85 * mainwindow_height
 
-        controls_height = self._previewer.bbox.size_request().height
+        controls_height = self._previewer.bbox.get_preferred_size()[0].height
         if img_width < max_width and (img_height + controls_height) < max_height:
             # The video is small enough, keep it 1:1
             return img_width, img_height + controls_height
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index f50d09c..d2d28d6 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -884,7 +884,7 @@ class GstElementSettingsDialog(Loggable):
 
         # Try to avoid scrolling, whenever possible.
         screen_height = self.window.get_screen().get_height()
-        contents_height = self.elementsettings.size_request().height
+        contents_height = self.elementsettings.get_preferred_size()[0].height
         maximum_contents_height = max(500, 0.7 * screen_height)
         if contents_height < maximum_contents_height:
             # The height of the content is small enough, disable the
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index 26311f8..45c812b 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -148,10 +148,9 @@ class ViewerContainer(Gtk.Box, Loggable):
             screen = Gdk.Screen.get_default()
             height = screen.get_height()
             # Force the AspectFrame to be tall (and wide) enough to look good.
-            # TODO: review this code to create a smarter algorithm,
-            # and use get_preferred_size() instead of size_request()
+            # TODO: review this code to create a smarter algorithm.
             if not self._compactMode:
-                req = self.buttons.size_request()
+                req = self.buttons.get_preferred_size()[0]
                 width = req.width
                 height = int(width / self.target.props.ratio)
                 width += 110  # Magic number to minimize dead padding


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]