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

Support Inkscape 1.0.1 #14

Merged
merged 1 commit into from
Dec 28, 2020
Merged

Conversation

MatthewJohnMorris
Copy link

@MatthewJohnMorris MatthewJohnMorris commented Dec 26, 2020

This version will run in Inkscape 1.0.1's native version of Python3 with no changes required: all you need to do is copy the "inkscape driver" files into the "extensions" directory - or a subdirectory of it (think support for that might be an Inkscape 1.x thing?).

Note that what I don't have is a working Inkscape 0.9.x setup with whatever hacks people commonly use with Python2 versions of PySerial etc. So I don't have 100% confidence that my legacy Python2 code paths don't have an error - they are just cut-and-pasting existing code, but there's always the chance of a typo.

The bulk of the changes are to be found in the new module fourxidraw_compat.py. New behaviour is triggered via the isPython3() check in that module. See https://wiki.inkscape.org/wiki/index.php/Updating_your_Extension_for_1.0 for the kinds of changes that were necessary.

Main points to note:

  1. grbl_serial.py testPort() has code added to cater for serialPort.open() resetting the Arduino. This does happen on my system, but I don't know if it can also happen to systems running older versions of Inkscape. The symptom would be "Error: Unexpected response from GRBL." as a command received an unexpected "Grbl" message. Making it apply to all versions might help others, but would add up to 2 seconds on setups where serialPort.open() did not reset the Arduino.

  2. Also in grbl_serial.py, I've had to fix a number of things up to cater for Python3 strings being unicode, and so no longer directly convertible to and from the byte-arrays sent and received by PySerial.

  3. All deprecation warnings have been fixed, but Python2 code paths have been kept. Note that I haven't actually verified Python2/Inkscape 0.9.x operation as I don't have this set up.

  4. There was a further nasty case where it looks like there was a silent change in behaviour for applyTransformToPath() - in Inkscape 1.x this does not modify the path in place, but the extension code clearly assumes it does do this - so I presume the Inkscape 0.9.x code must have worked in this fashion, otherwise no-one would have been able to plot anything with a size specified in mm rather than inches! Workaround is in fourxidraw_compat.py, compatApplyTransformToPath() method.

This version will run in Inkscape 1.0.1's native version of Python with no changes required.

The bulk of the changes are to be found in the new module fourxidraw_compat.py. New behaviour is triggered via the isPython3() check in that module. See https://wiki.inkscape.org/wiki/index.php/Updating_your_Extension_for_1.0 for the kinds of changes that were necessary.

Main points to note:

1) grbl_serial.py testPort() has code added to cater for serialPort.open() resetting the Arduino. This does happen on my system, but I don't know if it can also happen to systems running older versions of Inkscape. The symptom would be "Error: Unexpected response from GRBL." as a command received an unexpected "Grbl" message.

2) Also in grbl_serial.py, I've had to fix a number of things up to cater for Python3 strings being unicode, and so not directly equivalent to the byte-arrays sent and received by PySerial.

3) all deprecation warnings have been fixed, but Python2 code paths have been kept. Note that I haven't actually verified Python2/Inkscape 0.9.x operation as I don't have this set up.
@bullestock bullestock merged commit 989eb51 into bullestock:master Dec 28, 2020
@bullestock
Copy link
Owner

Applied, thanks.

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.

None yet

2 participants