Rev | Line | |
---|
[3275] | 1 | #The name of the main class must match the file name in lowercase |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | class example: |
---|
| 5 | def __init__(self): |
---|
| 6 | self.example='This is an example plugin' |
---|
| 7 | self.dbg=0 |
---|
| 8 | self.progress=0 |
---|
| 9 | #This dict defines wich package_type relies on what action |
---|
| 10 | self.pluginInfo={'example':'*'} |
---|
| 11 | #def __init__ |
---|
| 12 | |
---|
| 13 | def set_debug(self,dbg='1'): |
---|
| 14 | self.dbg=int(dbg) |
---|
| 15 | self.debug ("Debug enabled") |
---|
| 16 | #def set_debug |
---|
| 17 | |
---|
| 18 | def _debug(self,msg=''): |
---|
| 19 | if self.dbg==1: |
---|
| 20 | print ('DEBUG Example: '+msg) |
---|
| 21 | #def debug |
---|
| 22 | |
---|
| 23 | def register(self): |
---|
| 24 | #This function MUST return the dict with the action:package_type pair |
---|
| 25 | #In this example it return nothing |
---|
| 26 | #return(self.pluginInfo) |
---|
| 27 | return({}) |
---|
| 28 | |
---|
| 29 | def execute_action(self,action): |
---|
| 30 | if action=='example': |
---|
| 31 | self._exec_example() |
---|
| 32 | self.progress=100 |
---|
| 33 | return self.example |
---|
| 34 | |
---|
| 35 | def _callback(self): |
---|
| 36 | self.progress=self.progress+1 |
---|
| 37 | |
---|
| 38 | # <---- Put your code ----> # |
---|
| 39 | |
---|
| 40 | def _exec_example(self): |
---|
| 41 | self.example="Example executed" |
---|
| 42 | while (self.progress<100): |
---|
| 43 | self._callback() |
---|
Note: See
TracBrowser
for help on using the repository browser.