Re: Best way to disable an add-on on secure screen

Lukasz Golonka

Thanks for the pretty interesting discussion.
I personally tent to agree with Tyler that the responsibility of
deciding if the given add-on should be used in secure screens should be
on the user, but that is not always possible / practical.
While both the pattern #2 and #3 proposed by Cyrille are valid the
following changes makes them nicer IMO.
For pattern #2 you can easily avoid unnecessary indentation by keeping
the main class of your plugin in a separate file. To use my winWizard
add-on as an example the may look like this:
### Start of example 2 modified:
import globalVars
import globalPluginHandler

GlobalPlugin = globalPluginHandler.GlobalPlugin
from . import winWizard
GlobalPlugin = winWizard.GlobalPlugin

## End of example 2 modified.

For example #3 which is pretty nice as long as your imports don't have
side effects you can easily use class decorator to make this more

## Start of example 3 modified:
def disableInSecureMode(decoratedCls):
return globalPluginHandler.GlobalPlugin
return decoratedCls

# and then before definition of your plugin class:

## end of example 3 modified.


Join to automatically receive all group messages.