JTechPhotonics / J-Tech-Photonics-Laser-Tool

MIT License
172 stars 74 forks source link

Fix type mismatch (bool) #54

Closed odaki closed 3 years ago

odaki commented 3 years ago

Thank you for allowing me to use your software.

I'm using Inkscape 1.1. The error occurs when I use the latest code from the latest master branch. I've made a small patch to fix the problem, and it seems that the type specification is not correct.

It is now working without error in my environment.

If you have any problems, please merge.

PadLex commented 3 years ago

How odd. As far as I can tell the docs state that boolean is deprecated and we should be using bool instead. What error do you get when you use bool?

odaki commented 3 years ago

Thank you for your comment.

error messege:

Traceback (most recent call last):
  File "laser.py", line 295, in <module>
    effect = GcodeExtension()
  File "laser.py", line 41, in __init__
    EffectExtension.__init__(self)
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/base.py", line 304, in __init__
    super().__init__()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/base.py", line 64, in __init__
    self.add_arguments(self.arg_parser)
  File "laser.py", line 261, in add_arguments
    arguments = self.read_arguments()
  File "laser.py", line 286, in read_arguments
    arguments.append({"name": name, "type": types[arg_type]})
KeyError: 'bool'

I am testing with official Inkscape 1.1 release (for macOS).

Inkscape 1.1 (c4e8f9e, 2021-05-24)
odaki commented 3 years ago

I checked the standard provided extension, and it seems to use "bool" as you said. I will try to find out more about why I am getting the error.

odaki@macmini(arm64) extensions % pwd

/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions
odaki@macmini(arm64) extensions % grep bool *.inx

color_HSL_adjust.inx:            <param name="random_h" type="bool" gui-text="Random hue">false</param>
color_HSL_adjust.inx:            <param name="random_s" type="bool" gui-text="Random saturation">false</param>
color_HSL_adjust.inx:            <param name="random_l" type="bool" gui-text="Random lightness">false</param>
draw_from_triangle.inx:            <param name="circumcircle"    type="bool" gui-text="Circumcircle">false</param>
draw_from_triangle.inx:            <param name="circumcentre"    type="bool" gui-text="Circumcentre">false</param>
draw_from_triangle.inx:            <param name="incircle"        type="bool" gui-text="Incircle">false</param>
draw_from_triangle.inx:            <param name="incentre"        type="bool" gui-text="Incentre">false</param>
draw_from_triangle.inx:            <param name="contact_tri"     type="bool" gui-text="Contact Triangle">false</param>
draw_from_triangle.inx:            <param name="excircles"       type="bool" gui-text="Excircles">false</param>
draw_from_triangle.inx:            <param name="excentres"       type="bool" gui-text="Excentres">false</param>
(snip)
odaki commented 3 years ago

I understood the problem. Since laser.inx and laser.py were inconsistent in whether they use 'bool' or 'boolean', I unified them by making the laser.py one a 'bool'.

PadLex commented 3 years ago

That makes perfect sense now. Thank you for helping out!