Inkscape remains open when running commands from terminal

Discussion about writing code for Inkscape.
bradpitcher
Posts: 2
Joined: Mon May 25, 2015 12:31 pm
Location: Eugene, OR

Inkscape remains open when running commands from terminal

Postby bradpitcher » Mon May 25, 2015 1:44 pm

Hi all,

I'm posting to ask about a new behavior introduced in the 0.91 version of Inkscape. When I invoke certain Inkscape commands from the command-line, the GUI window remains open forever and doesn't return focus to the terminal. When I run the same commands with version 0.48, the Inkscape window opens and then quickly shuts again, returning control to the terminal. The latter is the behavior I want. I'm trying to run the command from Python in an extension(https://github.com/brad/Inkscape-OpenSCAD-DXF-Export/tree/travis) that I maintain and I would rather the user doesn't have to close that window manually. I'm also using Travis to run a test suite and the only workaround I've found to get it working in 0.91 is to use a timeout and force kill Inkscape after the timeout.

Is there a way to get Inkscape to close automatically when finished, as it did in version 0.48?

An example of the command I use follows:

Code: Select all

inkscape --file=circle.svg --select=path2983 --verb=ObjectToPath --verb=FileSave --verb=FileClose


and you can get the svg from here(https://raw.githubusercontent.com/brad/Inkscape-OpenSCAD-DXF-Export/ed5be3ee717fd8a7e4821f319e8bf735fc95ac27/tests/files/circle.svg)

Any help in this matter is much appreciated. Thank you!!

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Inkscape remains open when running commands from termina

Postby ~suv » Mon May 25, 2015 2:49 pm

use the verb 'FileQuit' instead of 'FileClose'.

The behavior in Inkscape 0.91 when closing the last opened document window was changed (bug #170550) to not quit the application anymore - Inkscape now opens a new empty document instead of quitting. To really quit the application, the user has to use 'File > Quit' (Ctrl+Q). This changed behavior is also noticeable when using verbs via command line. 'FileClose' closes the current document window, but no longer quits like prior versions if this was the last (or only) document window. 'FileQuit' will always quit (closing all open document windows).

bradpitcher
Posts: 2
Joined: Mon May 25, 2015 12:31 pm
Location: Eugene, OR

Re: Inkscape remains open when running commands from termina

Postby bradpitcher » Tue May 26, 2015 4:24 am

That was exactly what I needed, it worked perfectly! Thank you so much for taking the time to respond.


Return to “Programming”