kkujansuu / gramps

MIT License
1 stars 1 forks source link

FilterParams 1.1.7 is rendering oddly in Gramps 5.2.1 #41

Open emyoulation opened 2 months ago

emyoulation commented 2 months ago

Filter Params rendered the filter very strangely.
1) The filter name and check box parameters are indented way to the right of their labels 2) checkboxes are shown as values 3) the color fills are fragmented (2 shades of grey fill and 5 shades of blue fill.) image

I created a 2-stage custom filter using Mathias Kemmer's addon rule PersonsInFamilyFilterMatch ( infamilyrule.py ) of the FilterRules addon rule pack.

I think that part of the problem is the way the addon rule is written. It certainly is SLOOOOW. And the source is internally remarks as having some ugly hacks. (I will ask Matt to open a Discourse discussion about optimizing it. This could serve as an example of how to improve rule coding.)

<filters>
  <object type="Person">
    <filter name="Find the Family Members of" function="and">
      <rule class="PersonsInFamilyFilterMatch" use_regex="False" use_case="False">
        <arg value="Find a specific Family"/>
        <arg value="1"/>
        <arg value="1"/>
      </rule>
    </filter>  
  </object>
  <object type="Family">
    <filter name="Find a specific Family" function="and">
        <rule class="HasIdOf" use_regex="False" use_case="False">
          <arg value="F000162"/>
        </rule>
    </filter>
  </object>
</filters>
kkujansuu commented 2 months ago

This indeed seems to have to do with the way the rule is written. The rule uses the advanced feature of "creating its own GUI element". This is not supported by FilterParams. Maybe I will try to fix this at some point.

Issues like this are one reason I don't want to encourage people to use FilterParams. It is not thoroughly tested and I am not confident that it is robust enough for general use. And this problem proves that point - as well as the other issues. FilterParams was intended to be just a proof-of-concept.

emyoulation commented 2 months ago

Actually, I think that FilterParams may a very effective litmus test for whether a rule is consistent with guidelines.

In use, I suspect it is a far better tool than you fear.