You are here

Can Inkscape Portable support Dia Portable?

13 posts / 0 new
Last post
Bart.S
Offline
Last seen: 7 months 2 weeks ago
Developer
Joined: 2008-07-23 07:56
Can Inkscape Portable support Dia Portable?

Is there a chance to get the Dia input extension working in Inkscape Portable?

Extension "Dia Input" failed to load because a dependency was not met.
Dependency:
  type: executable
  location: path
  string: dia
  description: In order to import Dia files, Dia itself must be installed.  You can get Dia at http://live.gnome.org/Dia

It would be nice if it would recognize Dia Portable when found.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Needs work upstream; try this

The relevant lines I see from share/extensions/dia.inx are:

    <dependency type="executable" location="extensions" _description="The dia2svg.sh script should be installed with your Inkscape distribution.  If you do not have it, there is likely to be something wrong with your Inkscape installation.">dia2svg.sh</dependency>
    <dependency type="executable" _description="In order to import Dia files, Dia itself must be installed.  You can get Dia at http://live.gnome.org/Dia">dia</dependency>

dia2svg.sh exists in the source repository, but not in Windows (because sh files have no value on Windows, so they're not included).

#! /bin/sh

rc=0

# dia version 0.93 (the only version I've tested) allows `--export=-', but then
# ruins it by writing other cruft to stdout.  So we'll have to use a temp file.
# dia 0.95 removes --export-to-format but still allows -t.
TMPDIR="${TMPDIR-/tmp}"
TEMPFILENAME=`mktemp 2>/dev/null || echo "$TMPDIR/tmpdia$$.svg"`
dia -n --export="${TEMPFILENAME}" -t svg "$1" > /dev/null 2>&1 || rc=1

cat 

This should be converted to a Python file so it can work cross-platform. Can you comment on their usage of dia? Check if this works: put the following code in dia2svg.py in InkscapePortable\App\Inkscape\share\extensions and change dia.inx to reference it instead of dia2svg.sh. You'll also need to put DiaPortable\App\Dia\bin in the PATH (edit Inkscape's launcher.ini if that's easiest for you).

import sys
from run_command import run

run('dia -n --export="%%s" -t svg "%s"' % sys.argv[-1].replace('%', '%%'), 'dia')

[Updated from original: swapped %s and %%s]

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bart.S
Offline
Last seen: 7 months 2 weeks ago
Developer
Joined: 2008-07-23 07:56
Umm,

Chris MorganCan you comment on their usage of dia?

Pardon I don't understand.

Seems like they just export the *.dia to *.svg and open that. Well, guess I could do that on my own using the Dia GUI.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Command line call

I mean the -n, --export="...", -t svg.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bart.S
Offline
Last seen: 7 months 2 weeks ago
Developer
Joined: 2008-07-23 07:56
Ah,

Dia synopsis:

dia [ -c ] [ --credits ] [ -e OUTPUT ] [ --export=OUTPUT ] [ -L LAYER,LAYER,... ] [ --show-layers=LAYER,LAYER,... ] [ -h ] [ --help ] [ -n ] [ --nosplash ] [ -s WxH ] [ --size=WxH ] [ -t FORMAT ] [ --filter=FORMAT ] [ -v ] [ --version ] [file ...]
Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Test it?

It just occurred to me that I have dia installed and so could check it myself, the usage looks to be correct. Could you test my suggestion? If it works, I'll proceed with updating it in the Inkscape repository (probably next weekend).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bart.S
Offline
Last seen: 7 months 2 weeks ago
Developer
Joined: 2008-07-23 07:56
Sorry,

but I have no clue how to configure PAL.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Easy

All you need to do is append the dia/bin directory to the PATH. You can do that by putting a line PATH=%PATH%;X:\PortableApps\DiaPortable\DiaPortable\App\Dia\bin in the [Environment] section of App\AppInfo\Launcher\InkscapePortable.ini, or you can just set it in a console and then run InkscapePortable from it.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bart.S
Offline
Last seen: 7 months 2 weeks ago
Developer
Joined: 2008-07-23 07:56
...

Chris Morgandia2svg.sh exists in the source repository, but not in Windows

dia2svg.sh is included in Inkscape Portable, other *.sh as well.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
?

No it doesn't. No they don't.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 4 months 6 days ago
DeveloperModerator
Joined: 2008-07-24 18:46
Confirmed

This file, and other *.sh files, are included at X:\PortableApps\InkscapePortable\App\Inkscape\share\extensions

However, that doesn't mean they are used.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Left over

Ah, I've found out why now. They're not in the current release of Inkscape Portable, but presumably they were in a previous release; App\Inkscape\share\extensions is one of the directories which is preserved on upgrade.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bart.S
Offline
Last seen: 7 months 2 weeks ago
Developer
Joined: 2008-07-23 07:56
Doesn't work

It still complains about missing local Dia install.

Log in or register to post comments