pycrossword  0.3
Pure-Python implementation of a crossword puzzle generator and editor
Classes | Functions
pycross.utils.pluginbase Namespace Reference

Classes

class  PxPluginBase
 Base class for category-specific user plugins (extensions) written in Python. More...
 
class  PxPluginGeneral
 Base class General user plugins (placed in the 'general' category). More...
 

Functions

def before (func)
 Decorator adds the wraptype attribute set to 'before' to a given function. More...
 
def after (func)
 Decorator adds the wraptype attribute set to 'after' to a given function. More...
 
def replace (func)
 Decorator adds the wraptype attribute set to 'replace' to a given function. More...
 

Function Documentation

◆ after()

def pycross.utils.pluginbase.after (   func)

Decorator adds the wraptype attribute set to 'after' to a given function.

Contrary to before(), it will call the wrapped plugin method after the original one.

See also
before(), replace()

◆ before()

def pycross.utils.pluginbase.before (   func)

Decorator adds the wraptype attribute set to 'before' to a given function.

Use this decorator for plugin methods that override those of pycross::gui::MainWindow. The before decorator will make the app first call the plugin method, then the original one. For example:

class MyPlugin(PxPluginGeneral):
@before
def on_act_new(self, checked):
print('hey!')

With this code (provided that the plugin is active), when the user triggers the act_new action of the main window, the app will first call the plugin method and print 'hey!', then proceed with the original method handler (on_act_new).

Note that when using before, the result returned will be that of the original function, since it will be called last.

See also
after(), replace()

◆ replace()

def pycross.utils.pluginbase.replace (   func)

Decorator adds the wraptype attribute set to 'replace' to a given function.

Contrary to before() and after(), it will call the wrapped plugin method instead of the original one, that is, the original method will not be called at all, and will be replaced by the corresponding plugin method.

See also
before(), after()