print layout

Tomaz Canabrava tcanabrava at kde.org
Thu Oct 17 17:48:34 UTC 2013


Heya




On Thu, Oct 17, 2013 at 9:19 PM, Lubomir I. Ivanov <neolit123 at gmail.com>wrote:

> On 18 October 2013 01:32, Dirk Hohndel <dirk at hohndel.org> wrote:
> > On Thu, 2013-10-17 at 16:04 +0200, Robert Helling wrote:
> >> On 16.10.2013, at 17:59, Dirk Hohndel <dirk at hohndel.org> wrote:
> >>
> >> Hi everyone,
> >>
> >> > I can look into it myself if I find time, but my todo list is rather
> long right now...
> >>
> >> Regarding print templates:
> >>
> >> I know you said this will not happen for version 4.x but I think I had
> some revelation this morning under the shower.
> >>
> >> Our problem was that we cannot quite have html templates as the qt
> routines don't treat proper html and anything else would require us to
> write some non-trivial parser.
>

We can try using QWebKit, one of the problems of the old system that tried
to use HTML was that we regenerated the *entire* document for each dive
added, instead of incrementially adding
something to the DOM.


> >>
> >> Well, there is a perfectly fine way to to describe page layouts for
> print in professional typesetting quality. It's called TeX. And of course
> we do not want to bundle subsurface with the myriad of files that a proper
> TeX system requires, so we don't want to use TeX for printing.
> >>
> >> But what we could to is export dives in TeX format (since that's a
> simple text file). So this could be used by the many users that already
> have a TeX system running (I consider it like divelogs.de or the webapp:
> to make use of this feature you need additional things like a divelogs.deaccount or an android smartphone).
> >>
> >> Here are two patch files for a proof of concept:
> >>
> >> This adds an entry to the dive list context menu to export a dive as
> TeX. Right now it always exports to a file named dive.tex in the pwd (as
> well as writing the profile picture to profile.png).
> >>
> >> If the user has a TeX system installed she can then run
> >>
> >> pdftex dive
> >>
> >> to obtain a nice (I know, tastes differ…) printable file dive.pdf.
> >>
> >> The cute thing is that this is realized as a template: In dive.tex the
> data only goes into a number of macro definitions, and then logbook
> style.tex is imported. The latter contains the actual layout. So we could
> have several such template files (according to personal taste) and this
> export works with each of them.
> >>
> >> Obviously, this is only a proof of concept and far from complete
> (things like hard coded file names and only some of the fields of struct
> dive are represented since I stole this form my old dive log software). But
> please let me know what you think.
> >
> > We briefly talked about this on IRC but I'll repeat it here - I admire
> > the spirit of it (and vaguely remember having used TeX 20 years ago in
> > university), but this is completely missing our target audience. 70% of
> > our users are on Windows, 15% on a Mac. Very few (if any) of them will
> > know how to get from TeX output to something that they can print. And
> > even the remaining 15% who appear to be on Linux - I would bet no more
> > than half of them would know what to do. If I go by the quality of end
> > user questions that we are getting, that may even be optimistic.
> >
> > What we REALLY need (for Subsurface 7.8) is a visual layout editor so
> > people can just point and click to get the layout they want. For
> > Subsurface 4.0 I think we'll give them a fixed layout that does a
> > somewhat better job than what we have.
> >
> > One idea that I pondered is to give them a menu that allows them to pair
> > down what they get - which allows for more Notes and less clutter.
> >
> > Under the "1 / 2 / 6 dives per page" selection there's an "Advanced
> > Configuration" button that opens another menu. That menu offers
> > something like this (envision this done in a visually attractive manner)
> >
> > "The following information is listed below the profile - the more
> > elements you pick, the less space will be left for the Notes"
> >
> > x Location
> > x Date / Time
> > x Duration
> > x Max Depth
> > x Avg Depth
> > o Tank used
> > o Gas mix
> > o Gas used
> > o SAC rate
> > o Max CNS
> > o Fresh/saltwater
> > o Total weight
> > x Divemaster
> > x Buddy
> > o Suit
> > x Viz
> > x Rating
> > o Tags
> > x Notes
> >
> > I'd suggest the x ones to be on my default, the others off.
> > And then we need our algorithm to try and fill these reasonably
> > intelligently into the space provided. Maybe we give an minimum width
> > for each of them and write an NP-complete algorithm that packs them
> > together in an ideal way. Or alternatively we could just group them
> > logically into lines and say we'll drop a line if none of the members
> > are there and we merge two lines if their combined minimum length is
> > still less than the space available in a line. That still means we could
> > get several lines that are only 2/3 used, but it's a start.
> >
> > What do people think about that?
> >
>
> i've been hoping for a hardcoded template that all users agree upon
> and while this is not realistic i think we should do exactly that for
> 4.0.
>
> from what i have seen in Qt so far (not to bash the framework as it is
> quite potent), it seems if we target performance and standard Qt
> practices, things are not easy to accomplish in terms of table
> user-level customization, unless a magical third party template
> library appears (or a wild tomaz appears with ideas :), but let's hope
> such a thing is portable on all OS!
>

Grantlee. a good template based system. :D


>
> fast tables in Qt are low-level (read: closer to the CPU) and
> currently we track a cell col+row index and then pretty much either
> draw lines for it (model delegate) or return data for it (model).
> please, have a look at the end of these files modeldelages.cpp,
> models.cpp - there we handle the profile table printing, and it's not
> that pretty and easy to read.
>

It can be improved a bit, I already cleaned up some of the code.


>
> now, as you can probably imagine from the programming perspective the
> checkbox ideas can be quite hard to accomplish. not having a set of,
> lets say 2 fixed templates for a 6-per-page layout and instead
> allowing any configuration of sorts - "i would like to select this
> feature to be rendered on a table for me" would be a massive task
> programming wise.
>
> if someone asks me "well is it possible?", i would say "yes", but this
> could take 3-4 weeks for someone working full time to make this work
> or if this person is me.
>
> mind that:
> - i'm not that experienced in Qt
> - there could be libraries that do that, but if they are not portable
> to Qt5, win32 or all OS they receive a "-1" from me
> - i like robert's idea for an external high-level "tool" that does the
> heavy lifting and layouting for us
>
> 2c
> lubomir
> --
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20131017/2ac4ffb0/attachment-0001.html>


More information about the subsurface mailing list