[pitivi] project: Add the aspect_ratio dynamic property



commit 16a35b5862e5d5e849142347abac4d078bad9552
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Jan 28 07:23:16 2014 +0100

    project: Add the aspect_ratio dynamic property

 pitivi/mainwindow.py |    4 +---
 pitivi/project.py    |    6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index e43eac0..26bac6a 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -1141,9 +1141,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         """
         When the project setting change, we reset the viewer aspect ratio
         """
-        ratio = float(project.videopar.num / project.videopar.denom *
-                      project.videowidth) / float(project.videoheight)
-        self.viewer.setDisplayAspectRatio(ratio)
+        self.viewer.setDisplayAspectRatio(project.aspect_ratio)
         self.viewer.timecode_entry.setFramerate(project.videorate)
 
     def _sourceListMissingPluginsCb(self, unused_project, unused_uri, unused_factory,
diff --git a/pitivi/project.py b/pitivi/project.py
index 55e4e42..55b2c7a 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -713,6 +713,12 @@ class Project(Loggable, GES.Project):
         self.set_video_restriction_value("pixel-aspect-ratio", value)
 
     @property
+    def aspect_ratio(self):
+        videopar = self.videopar
+        par = videopar.num / videopar.denom
+        return par * float(self.videowidth) / float(self.videoheight)
+
+    @property
     def audiochannels(self):
         return self.audio_profile.get_restriction()[0]["channels"]
 


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