[pitivi/gtktimeline] project: Fix the project settings dialog to calculate the DAR consistently



commit 4d27564f0c3613db11ed11e86d5572c998036833
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Fri May 8 00:26:58 2015 +0200

    project: Fix the project settings dialog to calculate the DAR consistently
    
    The bug manifests in some cases when the w/h are linked and
    you change the width to a small value and simply switch the focus
    between the w/h fields. You can see slightly different values
    computed for the DAR.
    
    By making sure we set int values instead of Gst.Fraction values
    to the width and height widgets we stabilize the thing.

 pitivi/project.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index 8c734c9..30fd3cd 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -1764,11 +1764,15 @@ class ProjectSettingsDialog():
 
     def updateWidth(self):
         height = int(self.height_spinbutton.get_value())
-        self.width_spinbutton.set_value(height * self.sar)
+        fraction = height * self.sar
+        width = int(fraction.num / fraction.denom)
+        self.width_spinbutton.set_value(width)
 
     def updateHeight(self):
         width = int(self.width_spinbutton.get_value())
-        self.height_spinbutton.set_value(width / self.sar)
+        fraction = width / self.sar
+        height = int(fraction.num / fraction.denom)
+        self.height_spinbutton.set_value(height)
 
     def updateDarFromPar(self):
         par = self.par_fraction_widget.getWidgetValue()


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