libreoffice-extensions-by-e.../source/custom_path/main.py

32 lines
664 B
Python

import sys
import unohelper
from com.sun.star.task import XJobExecutor
from pathlib import Path
path = str(Path(__file__).parent / 'src')
sys.path.insert(0, path)
import mymodule
ID_EXTENSION = 'org.examples.zaz.custompath'
SERVICE = ('com.sun.star.task.Job',)
class CustomPath(unohelper.Base, XJobExecutor):
def __init__(self, ctx):
self.ctx = ctx
# ~ XJobExecutor
def trigger(self, event):
print(event)
msg = 'MsgBox from custom module'
mymodule.msgbox(msg)
return
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(CustomPath, ID_EXTENSION, SERVICE)