Ghini / ghini.desktop

plant collections manager (desktop version)
http://ghini.github.io/
GNU General Public License v2.0
24 stars 14 forks source link

Xsl changes #429

Closed RoDuth closed 6 years ago

RoDuth commented 6 years ago

Close this if you're not interested...

You have asked for examples xsl templates, I have included a few here, but you will need the other changes for them to work.

The 2 list_notes... versions are just a slight rework of one of Brett's originals but demonstrate how you may use the 2 versions of notes. They also show simple examples of templates that could be used at species, accession or plant level with differing but relevant results. To clarify why the 2 methods: abcd only allows a single element (i.e. a block of text), this is a pain to parse in xsl so I added a 'Notes' element with sub-elements named after each notes' category. This is similar to the way the label_distribution is included (only if used for_labels and not part of the abcd namespace).

the other 2 examples are adapted from how we currently do labels. The logic for variable font size dependent on the botanic name is clunky but it works for us. I've added the ability to add extra files (in this case images) by including them in a directory beside the template with the same name as the template. (images included in the example are public domain from here and here) for the memorial version to work you need a note of category 'memorial tree no' (or 'memorial_tree_no') that contains just a number and another category 'memorial name' with a name. We add these to a plant and print the reports from the plant source type.

abcd_2.06.xsd has been updated to latest version from here

Anyway, although #285 suggests you have no interest, #395 and #413 suggest that you may want to see this at least.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 65.89% when pulling c48064b9a6820295a0a567e9a7f9fc3c1c807960 on RoDuth:xsl-changes into 24246638b515fd2871fa2a71bce48d9526223549 on Ghini:ghini-1.0-dev.

mfrasca commented 6 years ago

thank you for this pull request! I see I don't manage to make myself understood on the point whether I'm interested or not in XSL. should I try again? it's several years that I've been asking for examples and documentation, and you sort of announced both. now I'm moving things in this part of the code, and I still have no documentation and hardly any examples and actually not a single unit test for the XSL formatter. I've been working with the Mako formatter and I know how to produce svg labels, postscript, html, csv, and how to achieve a quite decent graphic result, and a very broad range of usages. From what I see in the XSL results (unattractive, simplistic, stiff, limited), there's very little point in keeping both things. I'm sure you have a different opinion, but will you share docs and models? about models, you said a very sharp NO some time ago. so:

right. I'm now having a look at the contents of your pull-request.

RoDuth commented 6 years ago

There is a unit test in bauble/test/test_utils.py for the function in utils.
If I'm to be honest, after #109 I have little desire to bother writing documentation again, but also nor do I have the time right now.

images of the sort of output: label_example.xsl one page example. screen shot 2018-09-25 at 9 51 24 pm

label_memorial_example.xsl using a single accession. screen shot 2018-09-25 at 6 12 28 am

list_notes(abcd).xsl screen shot 2018-09-25 at 8 32 06 pm

list_notes.xsl screen shot 2018-09-25 at 8 27 52 pm

mfrasca commented 6 years ago

I might be confusing, but I thought I was reviewing and not willing to accept your technical documentation, because you were interpreting definitions in a way which felt wrong to me, and difficult to integrate with the rest. in the end, I've accepted your contributions and integrated it in the process, and documented it. If we managed not to "alienate users", you can tell. I'm trying to get you to contribute some user documentation. and it's not me who particularly cares for this: whatever remains undefined, I will not know how to keep functional.

btw: I hadn't noticed before, but this is a pull request on 1.0, and I'm only backporting to 1.0.

mfrasca commented 6 years ago

thank you for the examples and XSL templates, I'll see what I can do to pull them into 3.1. unless you want to have a look there and open a pull request on that line?

RoDuth commented 6 years ago

I can't get 3.1 to work on either mac os or windows. The 2 OSes I am currently using. Until that's resolved its of little use to me, by your own admission #419

at the moment, the 3.1 line is not production-ready,

mfrasca commented 6 years ago

hey, are you blaming me for not managing to deliver 3.1? :rofl: without Windows help, there it will stay you know!

RoDuth commented 6 years ago

no, just pointing out that I can't use 3.1 easily right now and the people at MRBG can't use it at all so I'm unlikely to do anything there other than try to get it to actual run right at this moment. You are losing a lot of potential users by not having it run on windows and osx (see here) Adding new features to 3.1 makes little sense to me right now.

You were asking about xsl, if you were to have merged this you could have seen for yourself the ways I have been using it.

mfrasca commented 6 years ago

thank you, I have an idea now, also thanks to the images you provided. as I wrote, I'll have a look at them in the 3.1 line which is where I'm doing any new development. I would organize the templates differently, however. like they were resources, so in a separate directory. cf mako/templates. and although I consider reasonable what you did, putting pictures in separate directories, it has the limitation that you cannot share resources among templates, so I would not do that.

I'm still puzzled about the "lot of potential users" you keep mentioning.

RoDuth commented 6 years ago

Originally I had used absolute paths in the template (and you still can do that) but that made it hard to share templates with the MRBG. I had tried adding a 'add image' FileChooserButton to the 'report options' window but found it annoying to have to remember to add the file each time I changed templates. Then came the day I had a template with a few images on it, I had originally gone with a FileChooserDialog but realised that I was putting all files for each template in one folder (even if they were also used in another template) and selecting them all, that's when I decided to use the folder approach, I no longer had to do anything, it just worked. Plus it was really easy to share templates. I no longer had to use absolute paths or complete any extra steps in the 'report options' window.

This is a paradigm I was used to for a few things including downloaded web pages (i.e. in Firefox when you 'save page as' it save the pages as foo.html and all the other parts in a foo_files directory.)

lot of potential users

anyone who uses windows or osx and has a need to record a collection of plants was my point.

mfrasca commented 6 years ago

they can use 1.0, and if they want 3.1 they can sponsor the project.

mfrasca commented 6 years ago

they can use 1.0, and if they want 3.1 they can sponsor the project.