2007-05-07 Benny Malengier <bm@cage.ugent.be>
* src/Editors/_EditPlace.py:
* src/Editors/_EditAddress.py:
* src/Editors/_EditLdsOrd.py:
* src/Editors/_EditSourceRef.py:
* src/Editors/_EditSource.py:
* src/Editors/_EditRepoRef.py:
* src/Editors/_EditAttribute.py:
* src/Editors/_EditPersonRef.py:
* src/Editors/_EditNote.py:
* src/Editors/_EditPerson.py:
* src/Editors/_EditMediaRef.py:
* src/Editors/_EditEventRef.py:
* src/Editors/_EditMedia.py:
* src/Editors/_EditRepository.py:
* src/Editors/_EditName.py:
* src/Editors/_EditChildRef.py:
* src/Editors/_EditFamily.py:
* src/Editors/_EditEvent.py:
* src/RelLib/_NoteType.py:
* src/DisplayTabs/_NoteTab.py:
* src/GrampsWidgets.py:
* TODO:
Implement using a specific notetype instead of General for notes created as part of a
primary or secondary object. Add list of types to ignore for inclusion in MonitoredDataType in a general manner.
List remaining issues in TODO for multiple notes.
svn: r8441
This commit is contained in:
@@ -434,10 +434,27 @@ class MonitoredType:
|
||||
self.set_val(self.sel.get_values())
|
||||
|
||||
class MonitoredDataType:
|
||||
|
||||
|
||||
def __init__(self, obj, set_val, get_val, readonly=False,
|
||||
custom_values=None):
|
||||
|
||||
custom_values=None, ignore_values=None):
|
||||
"""
|
||||
Constructor for the MonitoredDataType class.
|
||||
|
||||
@param obj: Existing ComboBoxEntry widget to use.
|
||||
@type obj: gtk.ComboBoxEntry
|
||||
@param set_val: The function that sets value of the type in the object
|
||||
@type set_val: method
|
||||
@param get_val: The function that gets value of the type in the object.
|
||||
This returns a GrampsType, of which get_map returns all possible types
|
||||
@type get_val: method
|
||||
@param custom_values: Extra values to show in the combobox. These can be
|
||||
text of custom type, tuple with type info or GrampsType class
|
||||
@type : list of str, tuple or GrampsType
|
||||
@ignore_values: list of values not to show in the combobox. If the result
|
||||
of get_val is in these, it is not ignored
|
||||
@type : list of int
|
||||
"""
|
||||
self.set_val = set_val
|
||||
self.get_val = get_val
|
||||
|
||||
@@ -449,9 +466,19 @@ class MonitoredDataType:
|
||||
default = int(val)
|
||||
else:
|
||||
default = None
|
||||
|
||||
map = get_val().get_map().copy()
|
||||
if ignore_values :
|
||||
for key in map.keys():
|
||||
try :
|
||||
i = ignore_values.index(key)
|
||||
except ValueError:
|
||||
i = None
|
||||
if (not i==None) and (not ignore_values[i] == default) :
|
||||
del map[key]
|
||||
|
||||
self.sel = AutoComp.StandardCustomSelector(
|
||||
get_val().get_map(),
|
||||
map,
|
||||
obj,
|
||||
get_val().get_custom(),
|
||||
default,
|
||||
|
||||
Reference in New Issue
Block a user