[pitivi] Fix crash when trying to configure an effect which as not readable properties
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Fix crash when trying to configure an effect which as not readable properties
- Date: Wed, 22 Sep 2010 13:47:53 +0000 (UTC)
commit 5fb4da99ce4c2e161e008323f8f44275303deb17
Author: Thibault Saunier <tsaunier gnome org>
Date: Fri Sep 3 20:40:33 2010 +0200
Fix crash when trying to configure an effect which as not readable properties
pitivi/effects.py | 3 ++-
pitivi/formatters/etree.py | 11 ++++++-----
pitivi/ui/effectsconfiguration.py | 3 ++-
pitivi/ui/gstwidget.py | 4 ++++
4 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 6a04d3a..d8c4c3e 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -332,7 +332,8 @@ class EffectGstElementPropertyChangeTracker:
gst_element.connect('notify::' + prop.name,
self._propertyChangedCb,
gst_element)
- properties[prop.name] = gst_element.get_property(prop.name)
+ if prop.flags & gobject.PARAM_READABLE:
+ properties[prop.name] = gst_element.get_property(prop.name)
self._tracked_effects[gst_element] = properties
def _propertyChangedCb(self, gst_element, pspec, unused):
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index f9fbbf5..eabc377 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -360,11 +360,12 @@ class ElementTreeFormatter(Formatter):
for prop in properties:
type_name = str(gobject.type_name(prop.value_type.fundamental))
#FIXME we just take the int equivalent to the GEnum, how should it be handled?
- if type_name == "GEnum":
- value = str(effect.get_property(prop.name).__int__())
- else:
- value = str(effect.get_property(prop.name))
- effect_properties.attrib[prop.name] = '(' + type_name + ')' + value
+ if prop.flags & gobject.PARAM_READABLE:
+ if type_name == "GEnum":
+ value = str(effect.get_property(prop.name).__int__())
+ else:
+ value = str(effect.get_property(prop.name))
+ effect_properties.attrib[prop.name] = '(' + type_name + ')' + value
effect_element.append(effect_properties)
diff --git a/pitivi/ui/effectsconfiguration.py b/pitivi/ui/effectsconfiguration.py
index 3e48940..1d7628a 100644
--- a/pitivi/ui/effectsconfiguration.py
+++ b/pitivi/ui/effectsconfiguration.py
@@ -65,7 +65,8 @@ class EffectsPropertiesHandling:
self._current_effect_setting_ui = effect_set_ui
element = self._current_effect_setting_ui.element
for prop in gobject.list_properties(element):
- self._current_element_values[prop.name] = element.get_property(prop.name)
+ if prop.flags & gobject.PARAM_READABLE:
+ self._current_element_values[prop.name] = element.get_property(prop.name)
return self.cache_dict[effect]
diff --git a/pitivi/ui/gstwidget.py b/pitivi/ui/gstwidget.py
index d4ee244..1aa6880 100644
--- a/pitivi/ui/gstwidget.py
+++ b/pitivi/ui/gstwidget.py
@@ -111,6 +111,10 @@ class GstElementSettingsWidget(gtk.VBox, Loggable):
table.set_border_width(5)
y = 0
for prop in props:
+ if not prop.flags & gobject.PARAM_WRITABLE\
+ or not prop.flags & gobject.PARAM_READABLE:
+ continue
+
label = gtk.Label(prop.nick+":")
label.set_alignment(0.0, 0.5)
table.attach(label, 0, 1, y, y+1, xoptions=gtk.FILL, yoptions=gtk.FILL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]