Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
plugin_menu.append limitation
#1
Dan, or someone,

can you explain the use of plugin_map in sip.py, which limits the URL of any button added to plugin_menu to 2-characters plus the leading '/'?

I'm developing a plugin which will add 3 items to the Plugin menu. The URL names are all different, but not the first 2-characters, since they "belong" to the same plugin, the URL names start with the plugin name.

For example, using the proto plugin, if one does the following, the URLs are rejected by the 3-character test in the plugin_map code.


Code:
# Add new URLs to access classes in this plugin.
urls.extend([
    '/proto-sp', 'plugins.proto.settings',
    '/proto-b1', 'plugins.proto.method1',
    '/proto-b2', 'plugins.proto.method2',
    '/proto-save', 'plugins.proto.save_settings'

    ])

# Add this plugin to the PLUGINS menu ['Menu Name', 'URL'], (Optional)
gv.plugin_menu.append(['Proto Plugin', '/proto-sp'])
gv.plugin_menu.append(['Proto B1', '/proto-b1'])
gv.plugin_menu.append(['Proto B2', '/proto-b2'])


Then when you run SIP, you get the error:
Code:
$ pi@raspberrypi:~/SIP $ sudo python ospi.py
...
ERROR - Plugin Conflict: Proto B2; /proto-b2 and  Proto B1; /proto-b1
$

I commented out the plugin_map check code in sip.py, and it did not seem to cause any problems. That is, all three items were added to the menu, and work properly.

Leaving the plugin_map check code in place, I would have to work around this 2-char limitation by renaming my URLS some thing like:
b1-proto, and b2-proto. 

But this goes against my OCD tendencies! ;-) And, then my plugin would conflict, if enabled, with any other plugin that may create a menu item starting with "b1" or "b2".

Any info as to why this 2-char limit is in place? Any other suggestions or workaround?

Thanks
Reply
#2
That "feature" was added by a contributor who is no no longer active in the project. I have planed to remove that limitation but it has slipped through the cracks.

I will remove it and update the SIP repo.

Thanks for the reminder.

Dan
Reply
#3
No worries Dan. Thanks for the update!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)