Extend D-Bus interface to support control of view modes

Bug #1337981 reported by Wayt Gibbs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qpdfview
Fix Released
Wishlist
Adam Reichold

Bug Description

To enable the qpdfview view mode to be controlled by an outside application or script, please add (and document) D-bus objects/messages to include at least
--a way to open a pdf in fullscreen
--a way to select among the available page view modes (two-page facing, toggle continuous on/off, etc/)

For use case details, see question #251188

Thanks!
Wayt

Changed in qpdfview:
status: New → Triaged
importance: Undecided → Wishlist
Changed in qpdfview:
status: Triaged → In Progress
assignee: nobody → Adam Reichold (adamreichold)
Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello Wayt,

I created and linked a branch that extends the D-Bus interface to allow for a rudimentary level of remote control like flipping pages, jumping to labeled bookmarks or controlling the view mode (and of course what can also be done through the command line like opening a file).

Please build the branch and try out if the extended interface already meets your requirements or whether we need to change or add methods or properties. After the interface is finished, we need to write some kind of documentation for it, e.g. a section in manpage or within the online help.

Best regards, Adam.

P.S.: The simplest way to interact with this, is probably to use the "qdbusviewer" tool and trigger the methods manually. Just look for the "local.qpdfview" service and its "MainWindow" object.

Revision history for this message
Wayt Gibbs (waytgibbs) wrote :

Adam:

The new branch builds and installs successfully on the Raspberry Pi.

Using the qdbusviewer, I am able to successfully toggle fullscreen view on and off. I haven't yet figured out how to pass filenames correctly to open a file via D-bus, but am working on that. I'm also going to test activating the qpdfview D-bus via Python scripts, which is how I intend to connect the program to other apps (Calibre and voicecommand).

For my use case, I need a way to close the current PDF via D-Bus. Can you please add interface elements for a) close current document and b) close all documents?

Many thanks,
Wayt

Revision history for this message
Adam Reichold (adamreichold) wrote : Re: [Bug 1337981] Re: Extend D-Bus interface to support control of view modes

Hello Wayt,

Am 28.07.2014 um 22:07 schrieb Wayt Gibbs:
> Adam:
>
> The new branch builds and installs successfully on the Raspberry Pi.
>
> Using the qdbusviewer, I am able to successfully toggle fullscreen view
> on and off. I haven't yet figured out how to pass filenames correctly to
> open a file via D-bus, but am working on that. I'm also going to test
> activating the qpdfview D-bus via Python scripts, which is how I intend
> to connect the program to other apps (Calibre and voicecommand).

What problems do you encounter when trying to open a document? Did you
try calling "jumpToPageOrOpenInNewTab" using only an absolute file path
as an argument?

But actually, I think you should try opening a document from the Python
script by executing "qpdfview --unique <file_path>" since this will also
ensure that there actually is an instance of qpdfview running.
(Executing this will either block if there wasn't or activate the
existing one if it is already running. Maybe you need to wait or poll
for the D-Bus service to become available. Or you try to create a D-Bus
service as e.g. described in [1])

> For my use case, I need a way to close the current PDF via D-Bus. Can
> you please add interface elements for a) close current document and b)
> close all documents?

I added D-Bus wrapper methods to close tabs (current, all, all but
current, by absolute file path) and also made the interface more robust
by actually checking if there is a tab to operate on.

> Many thanks,
> Wayt
>

Best regards, Adam.

[1] http://raphael.slinckx.net/blog/documents/dbus-tutorial

Revision history for this message
Adam Reichold (adamreichold) wrote :

Did the extended interface prove sufficient for your use case? If so, I would merge the branch intro trunk so I can more widespread usage and testing...

Revision history for this message
Adam Reichold (adamreichold) wrote :

Merged since even the original reporter has not responded, the code should do what it is supposed to and the chances of it interrupting other functionality are low.

Changed in qpdfview:
status: In Progress → Fix Committed
milestone: none → 0.4.12
Revision history for this message
Wayt Gibbs (waytgibbs) wrote :

This extension to the D-Bus interface provided the new functionality I needed. Many thanks!

Changed in qpdfview:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.