Ghini / ghini.desktop

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

Authors missing on some labels #454

Open aauioo opened 5 years ago

aauioo commented 5 years ago

I miss the author names/abbreviations on some labels. For example. (Mako-labels.html) schermafdruk op 2018-10-16 19-50-30

I have no idea how to create or modify a template. But I think for use in a garden it is appropriate to mention the authors.

mfrasca commented 5 years ago

post here your desired result corresponding to your data, and I can have a look.

mfrasca commented 5 years ago

do consider that available templates are examples and that I always hope to convince gardens to hire me, at least for developing templates perfectly matching their needs … :tonga: image the above is a species label, in postscript, on custom sized paper (I think it's measured in inches, like 1"×2"), and this template is called label.ps.mako in ghini-3.1-dev. it is a bit complex, but quite doable, to produce plant labels based on this, possibly on a wider support, say you get precisely this same information, then also a plant code, and the corresponding QR code. and arrange the labels so we fit 6 on a A4 paper. actually, all pieces are already in place in the various examples! anyhow, post a picture of what you wish to get, specifying the desired size, too.

mfrasca commented 5 years ago

if you no-more want to adapt the template so that it includes authorship, this is a possible correction, relative to the 3.1 line (in 1.0 the authorship is in the sp_author field):

diff --git a/bauble/plugins/report/templates/labels.html.mako b/bauble/plugins/report/templates/labels.html.mako
index 7af388ca..d693778b 100644
--- a/bauble/plugins/report/templates/labels.html.mako
+++ b/bauble/plugins/report/templates/labels.html.mako
@@ -61,7 +61,14 @@
     text-align: center;
     font: normal normal 22pt Arial, sans;
     width: 100%;
-    margin-bottom: .5em;
+    margin-bottom: 0.1em;
+  }
+.author {
+    /* border: 1px solid blue; */
+    text-align: center;
+    font: normal normal 14pt Arial, sans;
+    width: 100%;
+    margin-bottom: .4em;
   }
 .vernacular {
     /* border: 1px solid green; */
@@ -103,6 +110,9 @@
    <div class="species">
      ${plant.accession.species_str(markup=True)}
    </div>
+   <div class="author">
+     ${plant.accession.species.author or ''}
+   </div>
    <div class="vernacular">
      <% 
      s = plant.accession.species.default_vernacular_name

(as you can appreciate, totally no programming involved, just copi-pasta and guesswork, really limited to the css part)

and this would be the result: image

note that with html you have limited control on text extension and/or wrapping (think of Casuarina cunninghamiana subsp. cunninghamiana), or you need to learn proper css styling. I prefer using postscript to html to pdf, because postscript is a graphical programming environment, and in combination with the invoking Python, I have a quite precise control on the output. so if a text is about to overflow, I can shrink it horizontally. I can align things right, or left, and I have written small functions that compute the end position of the inserted text, so you can align subsequent parts with the end-point of stuff you inserted before. you can add pictures and logos, obviously, and as said, you can have QR codes, which you know combine with the ghini.pocket and nothing prevents us from adding support for it in ghini.tour, too.

mfrasca commented 5 years ago

I have labelled this as a documentation issue, that is, we could document how to adapt a couple of templates. maybe precisely this one, or a postscript template. and I hope nobody will feel bad if I try to "sell" the issue to a garden, in the sense that I keep it unresolved until a garden finances its solution.