From 8fc1b24125422fb34838ca2202bd78af7f70dbb1 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Tue, 9 Sep 2008 04:00:15 +0000 Subject: [PATCH] 0002309: Crash rerunning report after deleting used filter. (Improved fix - the last fix caused errors) svn: r11043 --- src/PluginUtils/_MenuOptions.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/PluginUtils/_MenuOptions.py b/src/PluginUtils/_MenuOptions.py index c237e134c..168f1139e 100644 --- a/src/PluginUtils/_MenuOptions.py +++ b/src/PluginUtils/_MenuOptions.py @@ -356,17 +356,25 @@ class EnumeratedListOption(Option): self.__items = [] self.emit('options-changed') - def get_value(self): + def set_value(self, value): """ - Get the value of this option. + Set the value of this option. - @return: The option value. + @param value: A value for this option. + Example: True + @type value: The type will depend on the type of option. + @return: nothing """ - value = Option.get_value(self) - if value >= len(self.__items): - # Range check the value - value = 0 - return value + found = False + for (opt_value, opt_description) in self.__items: + if value == opt_value: + found = True + + if found: + Option.set_value(self, value) + else: + print "Value %s not found for option %s" % ( str(value), + self.get_label() ) #------------------------------------------------------------------------- #