-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch printer front-end for SecureDrop Workstation #2156
Comments
I have excluded Another option that I think is worth considering, however, is to create a very lightweight wrapper around GTK's printing dialog, in combination with the Poppler PDF library or a PostScript library. I was able to use this example code to print PDFs with the GTK dialogs. Here are the GTK dialogs for comparison with the above front-ends, including an example of a preview: If we used this option, we'd have to "just" find a way to convert every supported file format to PDF prior to printing, but we're already doing some processing to get files to work with |
NB: I would argue that all the above choices, with the possible exception of
I did not find a print quality option in |
We should discuss this soon. The UI of the current |
Update from 2022-08-11 review with @tina-ux @nathandyer @L3th3 @eloquence @zenmonkeykstop:
|
Still an open issue - we have added |
I got the chance to talk to the lead maintainer of OpenPrinting. I found out that XPP as the front-end in fact does very little. All that it does is surface to the user the printer and document options. CUPS does the remaining processing. However, as we know, some formats CUPS cannot understand. That's why we're already converting LibreOffice files to PDF (which is exactly what the LibreOffice print dialogue does before sending it to cups).
I couldn't find any minimally modern-looking print dialogues, so if this dialogue minimally satisfies our needs, it could be a way to go, if we end up going with the "simply replace XPP approach" (which may only be a temporary solution). But it is not as complicated as I was originally thinking since it doesn't actually require implementing non-PDF file converters. (CC @zenmonkeykstop). |
The need for creating a custom prompt lead me down a rabbit hole. The available alternatives ( There had to be something else. Something desktop-environment agnostic which applications can just call and the system deals with tit. The approach I found is to use flatpak portals. In reality, these are "XDG"/ freedesktop specifications (thus not directly tied to flatpak) - they are just GBus calls. And I don't think we have to install anything extra. It should be installed by default. For example, with the following line we can open a dialog: gdbus call --session --dest org.freedesktop.portal.Desktop --object-path=/org/freedesktop/portal/desktop --method org.freedesktop.portal.Print.PreparePrint "program-name" "title" [] [] [] The image on the left is fedora and the image on the right is Debian. As you can see, there are slight differences, but I'm guessing this is because they are using different versions of We can also pass in parameters and a file descriptor, but unfortunately DBus is not very well documented from my experience. I've got some luck learning about how to use it by running After the initial print dialog call, we then need to issue a second call for actually printing. I haven't exactly understood how to make this call, but inspecting the DBus "traffic" from Evince, it looks something like this: Comparison with alternativesAdvantages:
Disadvantages:
References:
|
After much searching, I finally found something which creates a GTK dialog without the need for any code of ours. The program is yad --print --filename ~/QubesIncoming/sd-dev/building-qubes.pdf We get the standard GTK prompt, without the need for digging into DBus or create our own custom GTK print dialog. Furthermore, installing it in Update: I'm having basic issues with |
Hey @deeplow, thank you so much for looking into all these options. (And for the sample qt code). It looks like I think feel more confident with a printer frontend that was already upstreamed into Debian and/or had a little more of a process around it re code review and release, or (I hate to say it) maybe our own tiny qt package if that's really all it takes is the snippet above. What are your thoughts? |
FYI, it is in fact in Debian. We could go the Qt way as well. I would argue it doesn't look as polished compared to the GTK one, but it gets the job done (except for the print quality). |
Cool, thanks for letting me know. It's not exact, but I'm looking for the balance of usability/ease of inclusion vs rough dependency addition heuristics (even in an untrusted vm). With the limited activity, no security policy/ci/code-signing/etc in the repo, if there are no other suitable alternatives, I'm personally leaning towards the Qt or GTK way, whatever is easiest, because they are all an improvement over the current, and because ideally this will be the state only until we (eventually?) rework the print workflow to print from viewer, where we'll be able to use the print dialogs of whatever application is opening the file. But open to others' thoughts. |
That's true. This is a temporary solution. So as long as it is an improvement and satisfies the requirements, we should be fine. |
I just came across a limitation of the Qt dialog compared to the GTK one:
Depending on how we go about handling driverless printining, printer status information and printer status could be delegated to the printer itself instead of the client needing a back-and-forth to communicate this information to the user. CC @nathandyer, I can imagine this being helpful. Don't know if you have oppinions on the GTK / Qt dialog options. |
Thanks @deeplow! Although I'm generally a fan of the GTK way of doing things, for this purpose and in this environment, I don't have any strong feelings in preferring one toolkit over another. I agree that showing status information next to the printer, and being able to handle disconnects more elegantly, makes the GTK dialog a stronger option. I also think the layout is a little more straightforward (fewer collapsable panels and additional windows/dialog boxes for viewing properties and setting print options). That being said, I don't think those benefits are make-or-break, and if Qt is easier to implement or works better in our existing Qt-based world, it probably makes sense to go with that option instead. |
Thanks for taking a look. Sadly I spoke too soon about the Qt implementation. For some reason I forgot to test if it actually printed correctly. It turns out that I was just setting up the dialog and the print actually does nothing. It's just a blank dialog. So we also need document rendering-code. I have found this example which does that, but it was something I was kind of avoiding because CUPS can already handle printing. I would have expected for there to be a way to have Qt / GTK dialogs using the CUPS back-end and not having to make a rendered for any kind of file we print. This is disappointing and the documentation it not being very helpful. There may be a way to do it, but I am not finding any reference to it. Supposedly GTK already has the CUPS Common Printing Dialog Backend in version 4.0 (which I don't know how well it runs on Qubes). But I have seen no docs on how to take advantage of it in python at least. I am guessing this should be automatic and not really a concern for us. On the Qt front from what I can see, it still hasn't been merged. |
The current proof-of-concept printing implementation in freedomofpress/securedrop-workstation#277 uses
xpp
as a printer front-end. We should compare this with other front-end options in terms of:and then make a final decision about what front-end to use for the beta.
The text was updated successfully, but these errors were encountered: