2008-03-04 Douglas S. Blank <dblank@cs.brynmawr.edu>

* src/PluginUtils/_GuiOptions.py (make_gui_option): 
	new stand-alone function that takes Option, returns GuiOption
	(attempting to make Options useable in additional ways)



svn: r10179
This commit is contained in:
Doug Blank 2008-03-04 12:24:04 +00:00
parent e6fd73cebd
commit df33e354a5
2 changed files with 71 additions and 60 deletions

View File

@ -1,3 +1,8 @@
2008-03-04 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/PluginUtils/_GuiOptions.py (make_gui_option):
new stand-alone function that takes Option, returns GuiOption
(attempting to make Options useable in additional ways)
2008-03-03 Frederik De Richter <frederik.de.richter@pandora.be>
* src/plugins/Desbrowser.py
links to wiki manual

View File

@ -1192,66 +1192,10 @@ class GuiMenuOptions:
if name in self.options_dict:
option.set_value(self.options_dict[name])
found = True
label = True
if isinstance(option, _MenuOptions.PersonOption):
widget = GuiPersonOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.FamilyOption):
widget = GuiFamilyOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.NoteOption):
widget = GuiNoteOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.MediaOption):
widget = GuiMediaOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.PersonListOption):
widget = GuiPersonListOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.NumberOption):
widget = GuiNumberOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.BooleanOption):
widget = GuiBooleanOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
label = False
elif isinstance(option, _MenuOptions.DestinationOption):
widget = GuiDestinationOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.StringOption):
widget = GuiStringOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.EnumeratedListOption):
widget = GuiEnumeratedListOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.TextOption):
widget = GuiTextOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.ColourOption):
widget = GuiColourOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
elif isinstance(option, _MenuOptions.SurnameColourOption):
widget = GuiSurnameColourOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
self.__tooltips)
else:
found = False
if not found:
widget, label = make_gui_option(option, dialog,
self.__tooltips)
if widget == None:
print "UNKNOWN OPTION: ", option
else:
if label:
@ -1269,3 +1213,65 @@ class GuiMenuOptions:
option = self.menu.get_option_by_name(name)
self.options_dict[name] = option.get_value()
def make_gui_option(option, dialog, tooltips):
"""
Stand-alone function so that Options can be used in other
ways, too. Takes an Option and returns a GuiOption.
"""
widget = None
label = True
if isinstance(option, _MenuOptions.PersonOption):
widget = GuiPersonOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.FamilyOption):
widget = GuiFamilyOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.NoteOption):
widget = GuiNoteOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.MediaOption):
widget = GuiMediaOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.PersonListOption):
widget = GuiPersonListOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.NumberOption):
widget = GuiNumberOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.BooleanOption):
widget = GuiBooleanOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
label = False
elif isinstance(option, _MenuOptions.DestinationOption):
widget = GuiDestinationOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.StringOption):
widget = GuiStringOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.EnumeratedListOption):
widget = GuiEnumeratedListOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.TextOption):
widget = GuiTextOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.ColourOption):
widget = GuiColourOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
elif isinstance(option, _MenuOptions.SurnameColourOption):
widget = GuiSurnameColourOption(option, dialog.dbstate,
dialog.uistate, dialog.track,
tooltips)
return widget, label