"Form" Gramplet - Many Improvements - Anyone Want to try/test My Changes?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

"Form" Gramplet - Many Improvements - Anyone Want to try/test My Changes?

dbareis
Hi all,

I haven't had any responses to my previous yet, so maybe the "Form" Gramplet isn't as popular as I thought or it deserves to be...

I have added my latest code to "https://gramps-project.org/bugs/view.php?id=11707" if anyone wants to try as it currently stands.  All changes are intended to be backwards compatible. Feedback welcome, I want to add more entry field validations as well.

Current changes are:


* Added error handler "DisplayLogError()".
  When invoked this will display errors in a popup and
  show exception details in the log (gramps51.log).
  Also some debug messages are now produced by Forms.

* DisplayLogError() used:
    * On XML SYNTAX Error in any of the forms configuration files.
      This shows the file name and what the DOM reports as the issue.
    * If no "<form>" tags exist in a file.
    * If a "section" is missing a "role" attribute (or it's empty).
    * If a "section" is missing a "type" attribute (or it's invalid).

* If there is no date or reference in the event an error message will be displayed for you to fix that.  If for some reason your form doesn't need
  them then I'd suggest giving them default values date='today' and
  reference='none required'.

* I display a message (and abort the save) in at least one error
  situation (person unchosen) where in the past it just quietly closed.
  Because of my other improvement to default a 'person" you should only
  see this on 'multi' or 'family'.

* The created event how has the "Description" field filled in with
  the reference followed by " @ " then the name of the source followed by
  " [form]".

* For section "type=person" [others later...], you no longer have to remember
  if you have selected someone or worry that you selected the wrong person
  as the state is now displayed:
      * Initially "no one selected yet" (in italics)
      * After person creation/selection the name is displayed [small bold]

* For section "type=person" [maybe 'multi' later...], the selected person becomes
  the default person (don't need to go though person selection dialog).
  If multiple people selected then the first is used.
  This occurs exactly once per form.
  [Bug] Currently doesn't work well for multiple sections/people, all will
        have same person preloaded (still better than before).

* The "title" attribute of the "<section>" tag has been improved.
  If not specified (or blank) then the "role" tag's value will be used.
  Also, that way, a title is always displayed, in the past you could have
  completely anonymous sections on the form!!!!

* The value for the "type" attribute of a "section" is now case insensitive
  ('Person' == 'person').

* Fixed the Location "+" & "use existing" location button order so it is not
  only consistent with the rest of the form but with Gramps in general.

* The "Headings" tab is no longer displayed if there are no headings, if it
  exists then you should remember to swap to it and fill it in.

* The following applies to the existing 'date' and the new
  'location' & 'reference' values:

  # If no "=" exists in the string then it is the "default" value, this makes
    the 'date' key's value backwards compatible for existing forms.

  # If you want a default value to contain a "=" sign you need to put
    "default=" in front of it.  This works since for each pair only the first
    "=" is used to separate the key from the value.

  # If "=" is anywhere in the value you provide then its contents are one or
    more "key=value" pairs separated by "; " (semi-colon followed by a single space).

  # The order you supply keys is irrelevant.

  # Incorrectly specified keys will be reported in the log (gramps51.log).

  # Unspecified keys will default to some value (generally '').

* New "location" attribute on the "<form>" tag:
    * Example: location="label=Where in QLD?; default=Queensland, Australia"

    * [Key: default] You can now specify a default location.
      If the location (place) is pre-existing then it will be used, otherwise it
      will be created (and given the type "_FORM" so you can find and update it easily).

    * [Key: label] You can replace the label "Location:" with your own text to better inform
      the user as to the form's intention.

* New "reference" attribute on the "<form>" tag:
    * Example: reference='label=QLD [B]DM #'

    * [Key: label] You can replace "Reference:" with your own text to better inform the user
      as to the form's intention.

    * [Key: default] Can now specify a default Reference
      (or perhaps a default prefix you want used).
      You can replace or edit the value.

* The "date" attribute of the "<form>" tag:
    * Example: date='label=Date of Birth'
    * Example: date='label=Discovery Date; default=today; ro=N'

    * [Key: label] You can replace "Date:" with your own text to better inform the user
      as to the form's intention.  To do this you supply alternative text
      followed by the pipe (|) character as in date="Birth Date|" or
      "Found Date|today".

    * [Key: default] The default date which can take "today" or "." to represent
      todays date.

    * [Key: ro] The value should be "Y" (yes) or "N" (no) as to whether the date
      displayed in the form is read-only or can be modified by the user.
      It defaults to "Y" to be backwards compatible with existing functionality.
      This is of corse ignored if no "default" date was provided, as you will
      need to enter it!

    * Tooltips on date fields in form (for read-only & not).

    * In the date entry field you can type "." as shorthand for 'today', which
      you could always type, it was just longer!
      If "." used the field will still be highlighted in red.

* Made the source selection buttons (NEW/EDIT) slightly larger to make
  clicking them easier



TODO:
~~~~~~~~~~~~~~~~~~~~~~~
* Optional Form Help (how to fill in THIS form)
  Maybe in a column on the right (HTML?)
  Probably in a separate .html file (name = form id or maybe title or both)

* [DO MULTI/FAMILY]
  For section type=person, you no longer have to remember if you have
  selected someone or worry that you selected the wrong person
  as the state is now displayed:
      * Initially "no one selected yet" (in italics)
      * Afer person creation/selection the name is displayed [small bold]

* If # selected people = #sections then grab their names (defaulting)
  How do I get the selected information (when multiple selection)?

* Prevent use OK unless all people selected - HOW TO CANCEL Button press?

* [bug] In headings tab, type in data in a field, don't leave it and press OK,
  that field's data is lost.

* The "Heading" tag should be deleted and handled like all other fields,
  these fields should be placed in a "heading" section and handled just
  like any other exception (except that you can't choose people/family).
  That way the UI is also less confusing and the user doesn't need to go
  to 2 tabs to find everything. It also means all the "column"
  formatting also applies to headings.


Facts
~~~~~~~~~~~~~~~~~~~~~~~
* size tag in "column" not used by Form, seems to have been obsoleted
* title tag in "form" is not used by Form, seems to have been obsoleted,
  still required! Should fix this
* HeadingsTab.is_empty doesn't work, always returns True


CAN'T WORK IT OUT (YET):
~~~~~~~~~~~~~~~~~~~~~~~~
* How to add selected people as "main participants"?
  ?: from ...utils.db import get_participant_from_event
     MAYBE: set_participant?

---
Thanks
Dennis


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: "Form" Gramplet - Many Improvements - Anyone Want to try/test My Changes?

dbareis
Hi,

Seems even small pictures can't be attached to group emails, if anyone want to see what a lot of the visual changes might look like, I have a screenshot with text and arrows here:  https://user-images.githubusercontent.com/295230/82112487-c6865a80-9790-11ea-9324-312f02d5b832.png  

---
Thanks
Dennis


Virus-free. www.avast.com

On Fri, 15 May 2020 at 06:43, Dennis Bareis <[hidden email]> wrote:
Hi all,

I haven't had any responses to my previous yet, so maybe the "Form" Gramplet isn't as popular as I thought or it deserves to be...

I have added my latest code to "https://gramps-project.org/bugs/view.php?id=11707" if anyone wants to try as it currently stands.  All changes are intended to be backwards compatible. Feedback welcome, I want to add more entry field validations as well.

Current changes are:


* Added error handler "DisplayLogError()".
  When invoked this will display errors in a popup and
  show exception details in the log (gramps51.log).
  Also some debug messages are now produced by Forms.

* DisplayLogError() used:
    * On XML SYNTAX Error in any of the forms configuration files.
      This shows the file name and what the DOM reports as the issue.
    * If no "<form>" tags exist in a file.
    * If a "section" is missing a "role" attribute (or it's empty).
    * If a "section" is missing a "type" attribute (or it's invalid).

* If there is no date or reference in the event an error message will be displayed for you to fix that.  If for some reason your form doesn't need
  them then I'd suggest giving them default values date='today' and
  reference='none required'.

* I display a message (and abort the save) in at least one error
  situation (person unchosen) where in the past it just quietly closed.
  Because of my other improvement to default a 'person" you should only
  see this on 'multi' or 'family'.

* The created event how has the "Description" field filled in with
  the reference followed by " @ " then the name of the source followed by
  " [form]".

* For section "type=person" [others later...], you no longer have to remember
  if you have selected someone or worry that you selected the wrong person
  as the state is now displayed:
      * Initially "no one selected yet" (in italics)
      * After person creation/selection the name is displayed [small bold]

* For section "type=person" [maybe 'multi' later...], the selected person becomes
  the default person (don't need to go though person selection dialog).
  If multiple people selected then the first is used.
  This occurs exactly once per form.
  [Bug] Currently doesn't work well for multiple sections/people, all will
        have same person preloaded (still better than before).

* The "title" attribute of the "<section>" tag has been improved.
  If not specified (or blank) then the "role" tag's value will be used.
  Also, that way, a title is always displayed, in the past you could have
  completely anonymous sections on the form!!!!

* The value for the "type" attribute of a "section" is now case insensitive
  ('Person' == 'person').

* Fixed the Location "+" & "use existing" location button order so it is not
  only consistent with the rest of the form but with Gramps in general.

* The "Headings" tab is no longer displayed if there are no headings, if it
  exists then you should remember to swap to it and fill it in.

* The following applies to the existing 'date' and the new
  'location' & 'reference' values:

  # If no "=" exists in the string then it is the "default" value, this makes
    the 'date' key's value backwards compatible for existing forms.

  # If you want a default value to contain a "=" sign you need to put
    "default=" in front of it.  This works since for each pair only the first
    "=" is used to separate the key from the value.

  # If "=" is anywhere in the value you provide then its contents are one or
    more "key=value" pairs separated by "; " (semi-colon followed by a single space).

  # The order you supply keys is irrelevant.

  # Incorrectly specified keys will be reported in the log (gramps51.log).

  # Unspecified keys will default to some value (generally '').

* New "location" attribute on the "<form>" tag:
    * Example: location="label=Where in QLD?; default=Queensland, Australia"

    * [Key: default] You can now specify a default location.
      If the location (place) is pre-existing then it will be used, otherwise it
      will be created (and given the type "_FORM" so you can find and update it easily).

    * [Key: label] You can replace the label "Location:" with your own text to better inform
      the user as to the form's intention.

* New "reference" attribute on the "<form>" tag:
    * Example: reference='label=QLD [B]DM #'

    * [Key: label] You can replace "Reference:" with your own text to better inform the user
      as to the form's intention.

    * [Key: default] Can now specify a default Reference
      (or perhaps a default prefix you want used).
      You can replace or edit the value.

* The "date" attribute of the "<form>" tag:
    * Example: date='label=Date of Birth'
    * Example: date='label=Discovery Date; default=today; ro=N'

    * [Key: label] You can replace "Date:" with your own text to better inform the user
      as to the form's intention.  To do this you supply alternative text
      followed by the pipe (|) character as in date="Birth Date|" or
      "Found Date|today".

    * [Key: default] The default date which can take "today" or "." to represent
      todays date.

    * [Key: ro] The value should be "Y" (yes) or "N" (no) as to whether the date
      displayed in the form is read-only or can be modified by the user.
      It defaults to "Y" to be backwards compatible with existing functionality.
      This is of corse ignored if no "default" date was provided, as you will
      need to enter it!

    * Tooltips on date fields in form (for read-only & not).

    * In the date entry field you can type "." as shorthand for 'today', which
      you could always type, it was just longer!
      If "." used the field will still be highlighted in red.

* Made the source selection buttons (NEW/EDIT) slightly larger to make
  clicking them easier



TODO:
~~~~~~~~~~~~~~~~~~~~~~~
* Optional Form Help (how to fill in THIS form)
  Maybe in a column on the right (HTML?)
  Probably in a separate .html file (name = form id or maybe title or both)

* [DO MULTI/FAMILY]
  For section type=person, you no longer have to remember if you have
  selected someone or worry that you selected the wrong person
  as the state is now displayed:
      * Initially "no one selected yet" (in italics)
      * Afer person creation/selection the name is displayed [small bold]

* If # selected people = #sections then grab their names (defaulting)
  How do I get the selected information (when multiple selection)?

* Prevent use OK unless all people selected - HOW TO CANCEL Button press?

* [bug] In headings tab, type in data in a field, don't leave it and press OK,
  that field's data is lost.

* The "Heading" tag should be deleted and handled like all other fields,
  these fields should be placed in a "heading" section and handled just
  like any other exception (except that you can't choose people/family).
  That way the UI is also less confusing and the user doesn't need to go
  to 2 tabs to find everything. It also means all the "column"
  formatting also applies to headings.


Facts
~~~~~~~~~~~~~~~~~~~~~~~
* size tag in "column" not used by Form, seems to have been obsoleted
* title tag in "form" is not used by Form, seems to have been obsoleted,
  still required! Should fix this
* HeadingsTab.is_empty doesn't work, always returns True


CAN'T WORK IT OUT (YET):
~~~~~~~~~~~~~~~~~~~~~~~~
* How to add selected people as "main participants"?
  ?: from ...utils.db import get_participant_from_event
     MAYBE: set_participant?

---
Thanks
Dennis

Virus-free. www.avast.com


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel