[pitivi] ProjectSettings: keep DAR and PAR text fields and combos in sync
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] ProjectSettings: keep DAR and PAR text fields and combos in sync
- Date: Fri, 10 Dec 2010 17:49:36 +0000 (UTC)
commit f8519689aa65d84886670b39cf0d5fbb3e2c4344
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date: Fri Nov 19 18:19:17 2010 +0000
ProjectSettings: keep DAR and PAR text fields and combos in sync
pitivi/ui/projectsettings.py | 49 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/ui/projectsettings.py b/pitivi/ui/projectsettings.py
index 0e7c136..6070052 100644
--- a/pitivi/ui/projectsettings.py
+++ b/pitivi/ui/projectsettings.py
@@ -107,10 +107,26 @@ class ProjectSettingsDialog(GladeWindow):
self.frame_rate_fraction_widget),
(self.frame_rate_fraction_widget, self._updateFraction,
"value-changed", self.frame_rate_combo),
+ (self.dar_combo, None, "changed"),
+ (self.dar_fraction_widget, None, "value-changed"),
+ (self.par_combo, None, "changed"),
+ (self.par_fraction_widget, None, "value-changed"),
)
# keep framereate text field and combo in sync
self.wg.add_bi_edge(self.frame_rate_combo,
- self.frame_rate_fraction_widget)
+ self.frame_rate_fraction_widget)
+
+ # keep dar text field and combo in sync
+ self.wg.add_edge(self.dar_combo, self.dar_fraction_widget,
+ edge_func=self.updateDarFromCombo)
+ self.wg.add_edge(self.dar_fraction_widget, self.dar_combo,
+ edge_func=self.updateDarFromFractionWidget)
+
+ # keep par text field and combo in sync
+ self.wg.add_edge(self.par_combo, self.par_fraction_widget,
+ edge_func=self.updateParFromCombo)
+ self.wg.add_edge(self.par_fraction_widget, self.par_combo,
+ edge_func=self.updateParFromFractionWidget)
self.updateUI()
@@ -120,6 +136,37 @@ class ProjectSettingsDialog(GladeWindow):
def _updateCombo(self, unused, combo, fraction):
set_combo_value(combo, fraction.getWidgetValue())
+ def getSAR(self):
+ width = int(self.width_spinbutton.get_value())
+ height = int(self.height_spinbutton.get_value())
+ return gst.Fraction(width, height)
+
+ def updateDarFromPar(self):
+ par = self.par_fraction_widget.getWidgetValue()
+ sar = self.getSAR()
+ self.dar_fraction_widget.setWidgetValue(sar * par)
+
+ def updateParFromDar(self):
+ dar = self.dar_fraction_widget.getWidgetValue()
+ sar = self.getSAR()
+ self.par_fraction_widget.setWidgetValue(dar * (1 / sar))
+
+ def updateDarFromCombo(self):
+ self.dar_fraction_widget.setWidgetValue(get_combo_value(
+ self.dar_combo))
+
+ def updateDarFromFractionWidget(self):
+ set_combo_value(self.dar_combo,
+ self.dar_fraction_widget.getWidgetValue())
+
+ def updateParFromCombo(self):
+ self.par_fraction_widget.setWidgetValue(get_combo_value(
+ self.par_combo))
+
+ def updateParFromFractionWidget(self):
+ set_combo_value(self.par_combo,
+ self.par_fraction_widget.getWidgetValue())
+
def updateUI(self):
self.width_spinbutton.set_value(self.settings.videowidth)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]