Skip to content

Set or Transmit Atrributes generates an error when used with "Replace" existing code

Summary:

When I use Set_Atrributes extension, if I choose to replace an existing Javascript code linked to an event the extension generates an error.

Steps to reproduce:

  • Start Inkscape.
  • Create two shapes then select them both.
  • Go to Extensions>Web>JavaScript>Set_Attributes.
  • In Options tab set "When should the set be done" to "on click", then set "Compatibility with previous code to this event" to "Run it after", then click apply.
  • In "value to set" change the color (e.g green), then set "Compatibility with previous code to this event" to "Replace", then click on Apply.

What happened?

The following error is shown:

Traceback (most recent call last):
  File "web_set_att.py", line 69, in <module>
    SetAttribute().run()
  File "/usr/share/inkscape/extensions/inkex/base.py", line 123, in run
    self.save_raw(self.effect())
  File "web_set_att.py", line 66, in effect
    elem.set(self.options.when, el_ev_code)
UnboundLocalError: local variable 'el_ev_code' referenced before assignment

What should have happened?

New color should be set without error.

NB:

The same bug exists with Extensions>Web>JavaScript>Transmit_Attributes extension.

Attachments:

Screenshot_20200710_153725 Screenshot_20200710_155800

Version Info:

Inkscape Version: 1.0 (4035a4fb49, 2020-05-01)
Operating System: Manjaro Linux 
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0
Kernel Version: 5.7.0-3-MANJARO
OS Type: 64-bit
Edited by Nathan Lee
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information