gotcha

Author Topic: Extension throws error ' no such option'  (Read 1945 times)

September 03, 2017, 12:13:58 PM
Read 1945 times

bnnorman

  • Sr. Newbie

  • Offline
  • **

  • 5
I'm trying to write my first extension. I tried the Hello World example and it worked just fine. So, following it as an example, I created my own BUT it ALWAYS throws an error message saying 'error no such option --gw' (grid width variable). I have trawled the net but haven't found anyone else with this error so I guess I'm doing something wrong but I cannot fathom it out. I've been bashing my head against the wall and internet for two days now.

I have attached a screen shot showing that the UI dialog pops up with the default values. On pressing Apply I get the error dialog.

What the script is doing is irrelevant but, for the curious - I'm using inkscape to design LED panel layouts. My panels are currently 64x64 pixels, after roughly hand placing ellipses for the LEDs I want to ensure they are moved to the nearest exact pixel position before extracting the XY co-ords as a tuple list for use in a python animation script. That script works but it isn't an Inkscape extension.

When the extension runs and tries to access 'self.options.gw' it never gets past that point. I have installed the latest stable release (0.92.2 today and I get the same result).

If anyone could help me solve the problem I'll be eternally grateful.

Many thanks.

September 04, 2017, 03:10:32 AM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Unfortunately, I can't help with writing an extension.  But just in case you haven't seen this, maybe it will help:  https://inkscape.org/en/develop/extensions/

At least one of our members knows something about writing extensions.  So hopefully she'll visit before too long.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

September 04, 2017, 04:50:04 AM
Reply #2

bnnorman

  • Sr. Newbie

  • Offline
  • **

  • 5
Thanks Brynn. Yes I have see the tutorials and I did get the Hello world to work but I have been unable to understand why mine doesn't see the parameters (options) passed in from the GUI dialog.

September 04, 2017, 01:47:32 PM
Reply #3

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Fix the name of the __init__ function.

September 04, 2017, 02:04:29 PM
Reply #4

bnnorman

  • Sr. Newbie

  • Offline
  • **

  • 5
I cannot believe I missed that! Thank you so so much.

I guess it's the old 'can't see the wood for the trees' syndrome - i.e. focussing on the later code.

The parameter passing is now working - now I can get rid of my other bugs.

Thanks again.

September 05, 2017, 01:04:07 PM
Reply #5

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Took me some time to notice it, too... ;-)