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 needed for Inkscape version 1.0 #4

Open
brynnd opened this issue Feb 16, 2020 · 14 comments
Open

update needed for Inkscape version 1.0 #4

brynnd opened this issue Feb 16, 2020 · 14 comments

Comments

@brynnd
Copy link

brynnd commented Feb 16, 2020

Hello,
Thank you for providing this extension for Inkscape users!

This is just to let you know that most 3rd party Inkscape extensions, like this one, probably will not work with the upcoming new Inkscape version, the long-awaited version 1.0.

Here is the info you need to update this extension, so that it will work with 1.0 and future versions.
https://wiki.inkscape.org/wiki/index.php?title=Updating_your_Extension_for_1.0

If you have further questions, you can contact Inkscape developers via mailing lists, forum, or the chatroom.

If you have already updated it, please disregard this message.

All best,
brynn

@mgmax
Copy link

mgmax commented Feb 16, 2020

Actually it would be great to integrate this extension into Inkscape, i.e, in the stock extensions repo https://gitlab.com/inkscape/extensions/. It's almost indispensable when working with DXF export from CAD tools. @jnweiger what do you think?

Main requirements would be:

  • Use pylint to ensure code is written consistantly
  • Have tests so that each line of an extension is covered in the coverage report

@jnweiger
Copy link
Member

Yes! Most of my extensions should go to the stock extensions repo.
Brynn is probably right, this code here was never tested with 1.0, -- no idea, if it would work or not. Probably not.

@LaureFR38
Copy link

This extension is also very useful to me.
I hope it will work with the V1.

Errors on V1:

chain_paths.py:49: DeprecationWarning: inkex.localize was moved to inkex.localization.localize
inkex.localize()
chain_paths.py:86: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar.
self.OptionParser.add_option('-V', '--version',
chain_paths.py:89: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar.
self.OptionParser.add_option('-s', '--snap', action='store', dest='snap_ends', type='inkbool', default=True, help='snap end-points together when connecting')
chain_paths.py:90: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar.
self.OptionParser.add_option('-c', '--close', action='store', dest='close_loops', type='inkbool', default=True, help='close loops (start/end of the same path)')
chain_paths.py:91: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar.
self.OptionParser.add_option('-u', '--units', action='store', dest="units", type="string", default="mm", help="measurement unit for epsilon")
chain_paths.py:92: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar.
self.OptionParser.add_option('-e', '--epsilon', action='store',
chain_paths.py:320: DeprecationWarning: Effect.affect is now Effect.run(). The output argument has changed.
e.affect()
chain_paths.py:55: DeprecationWarning: Effect.uutounit est maintenant une méthode dans le document SVG. Utilisez à la place self.svg.uutounit(value, unit).
return self.uutounit(nn, uu) # inkscape 0.91
chain_paths.py:177: DeprecationWarning: Effect.selected is now a dict in the svg. Use self.svg.selected.
if not len(self.selected.items()):
chain_paths.py:182: DeprecationWarning: Effect.selected is now a dict in the svg. Use self.svg.selected.
for id, node in self.selected.iteritems():
Traceback (most recent call last):
File "chain_paths.py", line 320, in
e.affect()
File "D:\Programmes\inkscape-1.0rc1-x64\inkscape\share\inkscape\extensions\inkex\deprecated.py", line 180, in affect
return self.run(args=args)
File "D:\Programmes\inkscape-1.0rc1-x64\inkscape\share\inkscape\extensions\inkex\base.py", line 123, in run
self.save_raw(self.effect())
File "chain_paths.py", line 182, in effect
for id, node in self.selected.iteritems():
AttributeError: 'collections.OrderedDict' object has no attribute 'iteritems'
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='nul' mode='w' encoding='cp1252'>

@veronika
Copy link
Contributor

I have created pull-requests with the required changes:
#5
#6

@LaureFR38
Copy link

@veronika
I copied / pasted your changes. It is OK for me. Thank you very much !

@Rigoberdo
Copy link

@veronika
Thank you for your work.
I tried your updated release in Inkscape 1.1 (c68e22c387, 2021-05-23) (Windows 10) but I got from Inkscape this message:
Traceback (most recent call last):
File "chain_paths.py", line 312, in
e.run()
File "C:\Program Files\Inkscape\share\inkscape\extensions\inkex\base.py", line 131, in run
self.save_raw(self.effect())
File "chain_paths.py", line 257, in effect
self.set_segment_done(seg['id'], seg['n'], 'appended to ' + id + ' ' + str(cur_idx))
TypeError: can only concatenate str (not "PathElement") to str
_

@veronika
Copy link
Contributor

@Rigoberdo, I just tried it in 1.1 and I get the same error. I will look into it. It seems we can't concat path segments anymore so we probably need to turn the segment into a string first.

veronika added a commit to veronika/inkscape-chain-paths that referenced this issue Jul 15, 2021
Fix for changes from Inkscape 1.0 and 1.1.
See fablabnbg#4
@veronika
Copy link
Contributor

I have created pull-requests with the required changes:
#7

The problem only affected the creation of messages for debug purposes.

@Rigoberdo
Copy link

Rigoberdo commented Jul 16, 2021

Thank you, @veronika!
Now, when I apply "Chain paths" to the four segments in the attached file, I got the following message:
"Traceback (most recent call last):
File "chain_paths.py", line 312, in
e.run()
File "C:\Program Files\Inkscape\share\inkscape\extensions\inkex\base.py", line 131, in run
self.save_raw(self.effect())
File "chain_paths.py", line 292, in effect
node.getparent().remove(node)
AttributeError: 'NoneType' object has no attribute 'remove'
"
disegno.zip

veronika added a commit to veronika/inkscape-chain-paths that referenced this issue Jul 20, 2021
@veronika
Copy link
Contributor

@Rigoberdo, I replaced the old style code of removing a node from the parent to the new style code of calling delete on the node. Please try again.

@Rigoberdo
Copy link

Hi @veronika, it works fine... nearly.
In the attached example, it effectively chains five segment, with slightly detached end points, in a single five node polygon.
But it also leaves - for reasons I cannot suppose - two residual segments of original five ones.
In the attached figure below, the settings I used.
immagine
Anyway, thank you indeed Veronika, you did it!
Mauro
disegno-1.zip

@pocketpixels
Copy link

It is not working for me using Inkscape 1.2 on Mac (using the version of this extension from the master branch).
The extension shows up in the menu, but when selecting it (with multiple paths selected) nothing happens.

@veronika
Copy link
Contributor

In chain_paths.inx on line 6, change "inkex.py" to "inkex". This change is required for version 1.2 of Inkscape.

@pocketpixels
Copy link

Perfect, thank you @veronika!

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

No branches or pull requests

7 participants