Skip to content
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

Update Inkscape 1.0 and Python3 #27

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

seignovert
Copy link

Hi,

After upgrading to Inkscape 1.0 on macOS, I was running into the same issue as #24.

This PR includes:

  • Changes to match the latest inkex requirements
  • Change OptionParser to ArgumentParser dependency.
  • Fixes some depreciation warnings.
  • Add macOS paths to find PDF2SVG_PATH
  • Change from Mac OS to Darwin for the platform name on macOS.
  • Add Python3 check on SvgTransformer for multiplication matrix function (instead of comment/uncomment function).

I tried to keep Python 2 and Python 3 compatibility but with the recent changes in Inkscape 1.0 it might not work for older versions. Additional tests may be required before merging it.
And it might be relevant to update install.sh as well based on the version of Inkscape installed.

Moreover, the location of the extension folder on macOS is now at
/Users/<USERNAME>/Library/Application\ Support/org.inkscape.Inkscape/config/inkscape/extensions/ and no longer in ~/.config/inkscape/extensions/ (cf. Edit > Preferences > System: User extensions).

I hope this would help to re-enable this great plug-in for Inkscape users who migrated to 1.0.

@seebk
Copy link
Owner

seebk commented Jan 25, 2020

Your changes look good to me. Have you tried if it still works with Inkscape 0.92.4? I would prefer if we could have the same code base at least for inkscape 0.92.3, 0.92.4 and 1.0 for a little time until everyone has updated.

@gasteigerjo
Copy link

Are there any updates on this, now that Inskscape 1.0 has been released?

@marlasca23
Copy link

For those on Linux: substituting you latextext.py with this pull request is (almost) enough to fix it. If it still doesn't work, try to find manually where you have pf2svg on your machine and fix the python script accordingly. It doesn't sound ideal, but this "dirty" fix has allowed me to have latextext.

@@ -587,8 +586,18 @@ def render(self, latex_code, preamble_file=None, package_list="", fontsize=10, s
# Convert PDF to SVG
if PLATFORM == WINDOWS:
PDF2SVG_PATH = os.path.join(os.path.realpath(EXT_PATH), 'pdf2svg')
if PLATFORM == MAC:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if PLATFORM == MAC:
elif PLATFORM == MAC:

unless you hate windows users (which is unfair, they already go through enough as it is :P)

zip_b = zip(*b)
# uncomment next line if python 3 :
# zip_b = list(zip_b)
zip_b = list(zip(*b)) if PY3 else zip(*b)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a redundant use of list(...) but this works just fine on Python 2, no need to make it conditional.

@wyphan wyphan mentioned this pull request Mar 26, 2021
@matthuszagh
Copy link

I've tested out this PR and it has worked well so far for me. Thanks for your work on this @seignovert!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants