zaz/source/source/TestMacro.py

34 lines
748 B
Python

import gettext
import uno
import unohelper
from com.sun.star.task import XJobExecutor
import easymacro as app
ID_EXTENSION = 'org.myextension.test'
SERVICE = ('com.sun.star.task.Job',)
p, *_ = app.get_info_path(__file__)
path_locales = app.join(p, 'locales')
try:
lang = gettext.translation('base', path_locales, languages=[app.LANG])
lang.install()
_ = lang.gettext
except Exception as e:
app.error(e)
class TestMacro(unohelper.Base, XJobExecutor):
def __init__(self, ctx):
self.ctx = ctx
def trigger(self, args='pyUNO'):
print('Hello World', args)
return
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(TestMacro, ID_EXTENSION, SERVICE)