Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.
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.
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.
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.