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 Post-process Traced Bitmap extension for Inkscape 1.0 #149

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

scottvr
Copy link

@scottvr scottvr commented Jan 9, 2021

Hi. Don't know if you still have any interest in maintaining this Post-process Traced Bitmap extension, but I have updated it to work with Inkscape 1.0. If you're like me, every time you run a Path -> Trace Bitmap, you follow it with an eggbot ->contributed -> post process trace bitmap to get an SVG outlined (or not) but filled with colors, each on their own layer (or not.) This is a simple yet powerful extension, and is well worth using now the Inkscape has reached 1.0 release. This version probably won't work with older version; this was made for Inkscape v1.0. Functionality is exactly the same as the older version.

@scottvr scottvr changed the title Update for Inkscape 1.0 Update Post-process Traced Bitmap extension for Inkscape 1.0 Jan 24, 2021
@oskay
Copy link
Contributor

oskay commented Aug 8, 2021

It seems reasonable to update this extension, but this PR is a little awkward. It will be the only script in the branch that's compatible with Inkscape 1.0+.

Also, testing on Inkscape 1.1, I'm getting this error:

Traceback (most recent call last):
  File "/Users/oskay/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions/eggbot_pptb.py", line 119, in <module>
    e.run()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/base.py", line 147, in run
    self.save_raw(self.effect())
  File "/Users/oskay/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions/eggbot_pptb.py", line 82, in effect
    path.set('style', inkex.Style.to_str(style))
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/styles.py", line 132, in to_str
    return sep.join([self.get_store(key).declaration for key in self])
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/styles.py", line 132, in <listcomp>
    return sep.join([self.get_store(key).declaration for key in self])
AttributeError: 'dict' object has no attribute 'get_store'

@scottvr
Copy link
Author

scottvr commented Sep 1, 2021

You can see from the error that it's not actually the pptb extension that's causing the error, but the inkex/styles.py calling get_store(). I'm guessing that is related to the version of Python being used. That also relates to your point about being the only script in the branch compatible with Inkscape 1.0+. Maybe you can create a new branch for 1.x updates?

To that point... I'll shoot for updating at least all of the inkex libraries so that all scripts that use those methods can be compatible with Inkscape 1.x (and python 3) while still maintaining compatibility with Inkscape 0.9. I notice that even 0.92.5 has been updated to work with Python 3; I will download that version and work on ensuring all Eggbot extensions in your repo are compatible with the latest 0.9 as well as the latest 1.1, barring you creating a 1.x feature branch.

It seems reasonable to update this extension, but this PR is a little awkward. It will be the only script in the branch that's compatible with Inkscape 1.0+.

Also, testing on Inkscape 1.1, I'm getting this error:

Traceback (most recent call last):
  File "/Users/oskay/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions/eggbot_pptb.py", line 119, in <module>
    e.run()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/base.py", line 147, in run
    self.save_raw(self.effect())
  File "/Users/oskay/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions/eggbot_pptb.py", line 82, in effect
    path.set('style', inkex.Style.to_str(style))
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/styles.py", line 132, in to_str
    return sep.join([self.get_store(key).declaration for key in self])
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/styles.py", line 132, in <listcomp>
    return sep.join([self.get_store(key).declaration for key in self])
AttributeError: 'dict' object has no attribute 'get_store'

@oskay
Copy link
Contributor

oskay commented Sep 1, 2021

I will download that version and work on ensuring all Eggbot extensions in your repo are compatible with the latest 0.9 as well as the latest 1.1, barring you creating a 1.x feature branch.

I can't really recommend that as an approach; we're planning to migrate the current master branch to an "archived" branch -- not in main development but not deleted -- at some point and merge the https://github.com/evil-mad/EggBot/tree/Inkscape_v1 branch to master.

@scottvr
Copy link
Author

scottvr commented Sep 2, 2021

Oh that's good to hear. I guess I could've checked to see what branches you had in development before assuming you were just not yet wanting to support Inkscape 1.x. Thanks for the response. I'll checkout the Inkscape_v1 branch before I do any more work.

[edit] I did a fresh install of Inkscape 1.1 and copied over the Eggbot extensions from my 1.0 installation and it worked fine for me on my Windows 10 machine. Attached is a screenshot of the extension having completed successfully under Inkscape 1.1. I also fetched the v1 branch of the EggBot repo and copied that into my extensions directory, then copied my version of the pptb extension and it worked perfectly. Curious why yours behaves differently.

pptb_v1 1

@oskay
Copy link
Contributor

oskay commented Sep 2, 2021

Curious why yours behaves differently.

Can you clarify what difference you are observing?

@scottvr
Copy link
Author

scottvr commented Sep 3, 2021

The difference being the code from my PR threw an error for you under Inkscape 1.1, while it works perfectly well for me. Sorry that wasn't clear.

That said... when I pull the v1 EggBot repo and run the eggbot_pptb.py extension, it works (while it didn't for me under 1.0) but it throws a bunch of DeprecationWarnings. Installing the EggBot extension in my Inkscape user extensions directory, copying the version of eggbot_pptb.py from my repo in place of the one in your repo eliminates the DeprecationWarnings and works perfectly for me under Windows. I will test on a Mac; perhaps somehow that is the source of the different behavior for you and for me.

I've attached a screenshot of the warnings thrown by the current version from EggBot/master that my PR eliminates under 1.1.

I am curious, have you tried running the eggbot_pptb.py extension from your repo under 1.1? I wonder if you get the same stacktrace about dict not having a get_store() method like it did when you tried to use the one in my PR. That code that threw the error wasn't touched by my changes so I'm inclined to think there is something about your system that the pptb extension doesn't like. From the error, it looks like you file /Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/styles.py differs from any copy I have on my machine because I don't have the get_store() on line 132 that yours apparently does. Can you test the one from master?

pptb-master-warnings

@oskay
Copy link
Contributor

oskay commented Sep 3, 2021

This extension has not been updated against the same API as the "base" extensions that are included in the installer.

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.

2 participants