[pitivi] widgets: Make the GstElementSettingsDialog properly use configured values



commit 9c9eea22a2fbb7d5f87aa392226b82e6f9c38cf6
Author: Thibault Saunier <tsaunier igalia com>
Date:   Tue Oct 15 16:23:26 2019 -0300

    widgets: Make the GstElementSettingsDialog properly use configured values
    
    We were using the given values as properties to ignore....

 pitivi/utils/widgets.py |  3 ++-
 tests/test_widgets.py   | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index fc440f90..d6cb66fc 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -1144,7 +1144,7 @@ class GstElementSettingsDialog(Loggable):
         self.ok_btn = self.builder.get_object("okbutton1")
 
         self.window = self.builder.get_object("dialog1")
-        self.elementsettings = GstElementSettingsWidget(self.element, self.properties, controllable=False)
+        self.elementsettings = GstElementSettingsWidget(self.element, controllable=False)
         self.builder.get_object("viewport1").add(self.elementsettings)
 
         # set title and frame label
@@ -1164,6 +1164,7 @@ class GstElementSettingsDialog(Loggable):
                         caps_values[field] = val
         self.elementsettings.add_widgets(GstElementSettingsWidget.make_property_widget,
                                          with_reset_button=True,
+                                         values=properties,
                                          caps_values=caps_values)
 
         # Try to avoid scrolling, whenever possible.
diff --git a/tests/test_widgets.py b/tests/test_widgets.py
index 04fff43c..c8de3370 100644
--- a/tests/test_widgets.py
+++ b/tests/test_widgets.py
@@ -27,6 +27,7 @@ from pitivi.utils.widgets import NumericWidget
 from pitivi.utils.widgets import PathWidget
 from pitivi.utils.widgets import TextWidget
 from pitivi.utils.widgets import ToggleWidget
+from pitivi.utils.widgets import GstElementSettingsDialog
 from tests import common
 
 
@@ -76,3 +77,13 @@ class TestFractionWidget(common.TestCase):
         widget = FractionWidget()
         widget.setWidgetValue(Gst.Fraction(1000000000, 1001))
         self.assertEqual(widget.text.get_text(), "1000000M")
+
+
+class TestGstElementSettingsDialog(common.TestCase):
+
+    def test_reusing_properties(self):
+        """Check that passing values to be used on element to be configured works."""
+
+        dialog = GstElementSettingsDialog(Gst.ElementFactory.find("identity"), {"datarate": 12})
+        v, = [v for (k, v) in dialog.elementsettings.properties.items() if k.name == "datarate"]
+        self.assertEqual(v.getWidgetValue(), 12)
\ No newline at end of file


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