EnumeratedListObject.set_value()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

EnumeratedListObject.set_value()

Stephen Adams
Hi everyone, 

I'm having an issue getting the value of an EnumeratedListObject so that the user's choices will be populated into the configure dialogue.

I'm having some trouble figuring it out because I am not familiar with this syntax (from _enumeratedlist.py):
        if value in (v for v, d in self.__items):
            Option.set_value(self, value)

        items = ''
        op = EnumeratedListOption( self.__SORTBY, items )
        op.add_item( -1, "" )
        op.add_item( 0, "Person Name" )
        op.add_item( 1, "Event Type" )
        op.add_item( 2, "Event Year" )
        op.add_item( 3, "Gramps ID" )
        op.add_item( 4, "Location" )
        self.opts.append( op )
        if len( self.gui.data ) == 3:
            ops = self.opts[1].get_items() 
            for o in ops:
                if o[0] == self.__sortOrder:
                    self.opts[1].set_value( o )
                    break

Results in errors like:
C:\Program Files\GrampsAIO64-5.0.0-beta1-3>grampsd
2018-06-11 00:12:38.666: WARNING: dummydb.py: line 1234: database is closed
2018-06-11 00:12:52.363: WARNING: _enumeratedlist.py: line 143: Value '(0, 'Person Name')' not found for option 'Sort by '
2018-06-11 00:12:52.363: WARNING: _enumeratedlist.py: line 144: Valid values: [(-1, ''), (0, 'Person Name'), (1, 'Event Type'), (2, 'Event Year'), (3, 'Gramps ID'), (4, 'Location')]

I've played with several variants, any suggestions what's at issue here?

Thanks,
Steve

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel