2008/10/29 Jérôme <email@example.com>
If you change things as above, the HavePhotos remains the same (for backward compatibility) or is removed, but HasGallery has more functionality.
What do you think?
True, this will be more general, but user needs to set a value.
Rules related to this rule will not be HasObject (or not) anymore, no ?
User must set label_value = 0 (+ greater than) for having the same list !
a _HasGalleryCountBase.py :)
A setup of prepare as in _HasReferenceCountBase.py
and the apply becomes:
def apply(self, db, obj):
count = len( obj.get_media_list())
if self.count_type == 0: # "lesser than"
return count < self.userSelectedCount
elif self.count_type == 2: # "greater than"
return count > self.userSelectedCount
# "equal to"
return count == self.userSelectedCount
I am rather a user than a dev...
I understand boolean|binary, but too many variables or forms sometimes disturb me. But can Gramps add a function which properly returns this count value !!! Maybe this could provide an help for NarrativeWeb and other reports ... (more than 1 media object and multiples locations)
Should I try to add "count selector" for Gallery ?
I don't know !!! I just add this rules for illustrated few of my feature requests. Now, I think that a _HasNote.py rule on /Family and a _HasSource.py on /Event and /Family could be useful !
I can easily revert changes, remove added files, maybe more time for retrieving /Person/HavePhotos.py or to try this improvement.
What should be done ?
If you agree, I can change your _HasGalleryBase code so that it takes two options. The filter would be more general, the default would be > 1
Also, on _HasNote.py, there is this kind of code :
seems to be the same as using True/False but with less code, no ?
bool(list) does a conversion from list to bool. I like len(list)>0 better, you read the code as what is meant, not as some conversion.