[pitivi] ui/dynamic.py: fix bug in ChoiceWidget.setWidgetValue()
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] ui/dynamic.py: fix bug in ChoiceWidget.setWidgetValue()
- Date: Tue, 17 Aug 2010 07:07:57 +0000 (UTC)
commit 887acea2603d942461781a50ab2c1337fa2d890a
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date: Wed Apr 14 21:40:58 2010 -0700
ui/dynamic.py: fix bug in ChoiceWidget.setWidgetValue()
pitivi/ui/dynamic.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/ui/dynamic.py b/pitivi/ui/dynamic.py
index f2a8454..a7e3f58 100644
--- a/pitivi/ui/dynamic.py
+++ b/pitivi/ui/dynamic.py
@@ -286,8 +286,8 @@ class ChoiceWidget(gtk.HBox):
def __init__(self, choices):
gtk.HBox.__init__(self)
- self.choices = [choice[0] for choice in choices]
- self.values = [choice[1] for choice in choices]
+ self.choices = None
+ self.values = None
self.contents = gtk.combo_box_new_text()
self.pack_start(self.contents)
self.setChoices(choices)
@@ -299,12 +299,17 @@ class ChoiceWidget(gtk.HBox):
return self.contents.connect("changed", callback, *args)
def setWidgetValue(self, value):
- self.contents.set_active(self.values.index(value))
+ try:
+ self.contents.set_active(self.values.index(value))
+ except ValueError:
+ raise ValueError("%r not in %r" % (value, self.values))
def getWidgetValue(self):
return self.values[self.contents.get_active()]
def setChoices(self, choices):
+ self.choices = [choice[0] for choice in choices]
+ self.values = [choice[1] for choice in choices]
m = gtk.ListStore(str)
self.contents.set_model(m)
for choice, value in choices:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]