Fullscreen option per script?

Asked by Alfred Pichler on 2021-01-27

Corona does not require any contact surfaces or requires permanent cleaning.
 Therefore, no mouse or keyboard is possible for public traffic.
Demonstrations are only possible through script control via 1 foot switch and this is already used for other purposes..
Questions: is there a full-screen option via parameter input or a specification in qpdfview.conf?
 is there a possibility of automatic termination after the end of a presentation?

Original
Corona fordert keine Kontaktflächen oder erzwingt permanenten Reinigungsaufwand.
Für Puplikumsverkehr ist deshalb keine Maus und keine Tastatur möglich.
Vorführungenen sind nur durch scriptsteuerung per 1 Fußtaste möglich und die ist bereits belegt .
Fragen:
gibt es eine Fullscreen-Option per Parametereingabe oder eine Vorgabe in qpdfview.conf?
gibt es eine Möglichkeit der automatischen Beendigung nach Ablauf einer Präsentation?

Vielen Dank

Question information

Language:
English Edit question
Status:
Solved
For:
qpdfview Edit question
Assignee:
No assignee Edit question
Solved by:
Adam Reichold
Solved:
2021-02-01
Last query:
2021-02-01
Last reply:
2021-01-30
Adam Reichold (adamreichold) said : #1

Hello Alfred,

the intended way for qpdfview to be scripted is via its D-Bus [1] interface. Sadly, this is not properly documented but I the names are rather self explanatory. You should be able to explore and test this way of controlling qpdfview by starting "qpdfview --unique" (this is the default when started via a desktop environment) and then running qdbusviewer.

If you search for "qpdfview" on the session bus, you should find a "local.qpdfview" service which provides "MainWindow/" object that implements the "local.qpdfview.MainWindow" interface which includes both "fullscreen" and "presentation" methods.

The answers to question [2] include an example of how to automate access to this interface via a Python script but the general principle should be the same in your preferred scripting/programming language.

As another caveat, while this can be used to trigger the presentation view, controlling the presentation view is not yet implemented (basically just because nobody asked for it). There is also currently no method to end the application itself (this can be achieved by sending SIGTERM via the kill command), but that should be easy to add.

Best regards,
Adam

[1] https://en.wikipedia.org/wiki/D-Bus

[2] https://answers.launchpad.net/qpdfview/+question/404154

Adam Reichold (adamreichold) said : #2

I just added an "exit" method to the D-Bus interface in trunk which should be available soon in the daily debs [1] or by building from source.

[1] https://code.launchpad.net/~adamreichold/+archive/ubuntu/qpdfview-dailydeb

Thank you Adam,

for the quick and comprehensive answer.So far I have implemented a mix
of hardware solutions and software control via bash, as I have only
limited programming knowledge. (I'm 75 years old and object-oriented
languages are no longer my strength)

The Python approach fascinated me because of its possibilities.This
makes it possible to solve everything via software.
A RaspberryPi is used. With it I can control everything from the TTL
signal of the button in the GPIO to the end of the show.

I have now tested the Python pattern and a lot works, but I still have
some problems.

Exiting the program:

when trying to install version 0.4.18.99 ~ 2116 ~ 64 ~ ubuntu20.10.1
the following error occurred: and opening with a specific page:
ERROR: Breaks the existing package "qpdfview-djvu-plugin"

and opening with a specific page:

bus = dbus.SessionBus()
proxy = bus.get_object('local.qpdfview', '/MainWindow')
iface = dbus.Interface(proxy, 'local.qpdfview.MainWindow')

#method bool local.qpdfview.MainWindow.open(QString absoluteFilePath,
int page)
file_path ="/home/alfred/v64b1-169-test.pdf"
n = int(3)
iface.open(file_path, n)
#ERROR:dbus.connection:Unable to set arguments
('/home/alfred/v64b1-169-test.pdf', 3) according to signature 's':
<class 'TypeError'>: Fewer items found in D-Bus signature than in Python
arguments

Best regards,
Alfred

original:

Vielen Dank Adam,

für die rasche und umfängliche Antwort.
Ich habe bisher einen Mix aus Hardware-Lösungen und Softwaresteuerung
per bash realisiert, da ich nur bescheidene Programmierkenntnisse habe.
(Ich bin 75 Jahre und objektorientierte Sprachen sind nicht mehr meine
Stärke)
Der Ansatz per Python hat mich aber fasziniert von seinen Möglichkeiten her.
Damit ist es möglich alles per Software zu lösen.

Eingesetzt wird ein RaspberryPi. Damit kann ich alles steuern vom
TTL-Signal des Tasters im GPIO bis zum Ablauf der Show.

Ich habe nun das Pythonmuster getestet und vieles geht aber einige
Probleme habe ich noch.

Das Beenden des Programms
beim Versuch die Version 0.4.18.99~2116~64~ubuntu20.10.1 zu
installieren  trat folgender Fehler auf:
ERROR: Breaks the existing package "qpdfview-djvu-plugin"

und das öffnen mit einer bestimmten Seite
#method bool local.qpdfview.MainWindow.open(QString absoluteFilePath,
int page)
file_path ="/home/alfred/v64b1-169-test.pdf"
n = int(3)
iface.open(file_path, n)
#ERROR:dbus.connection:Unable to set arguments
('/home/alfred/v64b1-169-test.pdf', 3) according to signature 's':
<class 'TypeError'>: Fewer items found in D-Bus signature than in Python
arguments

Herzlichen Dank und viele Grüße aus München

Alfred Pichler

Am 27.01.21 um 19:05 schrieb Adam Reichold:
> Your question #695206 on qpdfview changed:
> https://answers.launchpad.net/qpdfview/+question/695206
>
> Status: Open => Answered
>
> Adam Reichold proposed the following answer:
> Hello Alfred,
>
> the intended way for qpdfview to be scripted is via its D-Bus [1]
> interface. Sadly, this is not properly documented but I the names are
> rather self explanatory. You should be able to explore and test this way
> of controlling qpdfview by starting "qpdfview --unique" (this is the
> default when started via a desktop environment) and then running
> qdbusviewer.
>
> If you search for "qpdfview" on the session bus, you should find a
> "local.qpdfview" service which provides "MainWindow/" object that
> implements the "local.qpdfview.MainWindow" interface which includes both
> "fullscreen" and "presentation" methods.
>
> The answers to question [2] include an example of how to automate access
> to this interface via a Python script but the general principle should
> be the same in your preferred scripting/programming language.
>
> As another caveat, while this can be used to trigger the presentation
> view, controlling the presentation view is not yet implemented
> (basically just because nobody asked for it). There is also currently
> no method to end the application itself (this can be achieved by sending
> SIGTERM via the kill command), but that should be easy to add.
>
> Best regards,
> Adam
>
> [1] https://en.wikipedia.org/wiki/D-Bus
>
> [2] https://answers.launchpad.net/qpdfview/+question/404154
>

Adam Reichold (adamreichold) said : #4

> ERROR: Breaks the existing package "qpdfview-djvu-plugin"

qpdfview is split into multiple packages: The main program and packages to support the different formats like PDF, DjVu, etc. So you need to either upgrade all of them at once or completely uninstall first and then install the new ones. (But since you are using a Raspberry Pi, I guess you also need ARM builds. You might be better off building from source then, or at least building from the source package from the dailydebs.)

> <class 'TypeError'>: Fewer items found in D-Bus signature than in Python
arguments

The interface provides multiple overloads for each method to avoid providing default values for all parameters but python-dbus by default seems to choose the first one without the additional arguments. You have to resolve this ambiguity by explicitly specifying the signature using an additional keyword argument, e.g.

iface.open(file_path, n, signature='si')

where the procedure to build the signature string is given here: https://dbus.freedesktop.org/doc/dbus-python/tutorial.html#data-types

Please also note that "open" will only work if there is already an existing tab. If you do not care whether a new tab needs to be created, or an existing one made current, the "jumpToPageOrOpenInNewTab" method is generally the first choice.

Best regards,
Adam

Hallo Adam,

i tryed again, but

Error while installing package: trying to overwrite
'/usr/share/qpdfview/help/_az.html', which is also in package
qpdfview-translations 0.4.18-1build1

best regards

Alfred

Am 27.01.21 um 19:15 schrieb Adam Reichold:
> Your question #695206 on qpdfview changed:
> https://answers.launchpad.net/qpdfview/+question/695206
>
> Adam Reichold posted a new comment:
> I just added an "exit" method to the D-Bus interface in trunk which
> should be available soon in the daily debs [1] or by building from
> source.
>
> [1] https://code.launchpad.net/~adamreichold/+archive/ubuntu/qpdfview-
> dailydeb
>

Adam Reichold (adamreichold) said : #6

> Error while installing package: trying to overwrite '/usr/share/qpdfview/help/_az.html', which is also in package

The official Debian/Ubuntu packages also have split out the translations which I did not do for the dailydebs. It really is probably easiest to uninstall anything called qpdfview-* and only then install the dailydebs.

Hello Adam,

Great. It run!

alfred@MAX-KUB20:~$ qdbus  local.qpdfview /MainWindow
...
method Q_NOREPLY void local.qpdfview.MainWindow.exit()

...

How can I spend a coffee ??

You saved me a lot of hardware development. The project is for our
church and will be finished in Lent.

Best regards and many thanks

Alfred

Am 30.01.21 um 19:05 schrieb Adam Reichold:
> Your question #695206 on qpdfview changed:
> https://answers.launchpad.net/qpdfview/+question/695206
>
> Status: Open => Answered
>
> Adam Reichold proposed the following answer:
>> Error while installing package: trying to overwrite
> '/usr/share/qpdfview/help/_az.html', which is also in package
>
> The official Debian/Ubuntu packages also have split out the translations
> which I did not do for the dailydebs. It really is probably easiest to
> uninstall anything called qpdfview-* and only then install the
> dailydebs.
>

Best Adam Reichold (adamreichold) said : #8

Hello again,

Thank you! No need for even more coffee, but I am very glad that the program in general and the D-Bus interface in particular are useful to you. I also hope your project will work out as intended.

From your message, I also understand that you do not need an extension of the D-Bus for controlling the presentation view independently of the main view? (You can enable the "synchronize presentation" setting so navigating via D-Bus and hence the main view should also navigate the presentation view.)

Best regards,
Adam

Thanks Adam Reichold, that solved my question.