Separate main
This commit is contained in:
parent
04aa7eea7c
commit
f410bf3d19
2
conf.py
2
conf.py
|
@ -111,7 +111,7 @@ MENU_MAIN = {
|
|||
MENUS = (
|
||||
{
|
||||
'title': {'en': 'Insert BarCode', 'es': 'Insertar Código'},
|
||||
'argument': 'ask',
|
||||
'argument': 'used_dialog',
|
||||
'context': 'calc,writer,impress,draw',
|
||||
'icon': 'barcode',
|
||||
'toolbar': False,
|
||||
|
|
Binary file not shown.
|
@ -20,7 +20,7 @@
|
|||
<value>com.sun.star.sheet.SpreadsheetDocument,com.sun.star.text.TextDocument,com.sun.star.presentation.PresentationDocument,com.sun.star.drawing.DrawingDocument</value>
|
||||
</prop>
|
||||
<prop oor:name="URL" oor:type="xs:string">
|
||||
<value>service:net.elmau.zaz.BarCode?ask</value>
|
||||
<value>service:net.elmau.zaz.BarCode?used_dialog</value>
|
||||
</prop>
|
||||
<prop oor:name="Target" oor:type="xs:string">
|
||||
<value>_self</value>
|
||||
|
|
|
@ -5,28 +5,28 @@
|
|||
<node oor:name="com.sun.star.sheet.SpreadsheetDocument">
|
||||
<node oor:name="I_SHIFT_MOD1_MOD2" oor:op="fuse">
|
||||
<prop oor:name="Command">
|
||||
<value xml:lang="en-US">service:net.elmau.zaz.BarCode?ask</value>
|
||||
<value xml:lang="en-US">service:net.elmau.zaz.BarCode?used_dialog</value>
|
||||
</prop>
|
||||
</node>
|
||||
</node>
|
||||
<node oor:name="com.sun.star.text.TextDocument">
|
||||
<node oor:name="I_SHIFT_MOD1_MOD2" oor:op="fuse">
|
||||
<prop oor:name="Command">
|
||||
<value xml:lang="en-US">service:net.elmau.zaz.BarCode?ask</value>
|
||||
<value xml:lang="en-US">service:net.elmau.zaz.BarCode?used_dialog</value>
|
||||
</prop>
|
||||
</node>
|
||||
</node>
|
||||
<node oor:name="com.sun.star.presentation.PresentationDocument">
|
||||
<node oor:name="I_SHIFT_MOD1_MOD2" oor:op="fuse">
|
||||
<prop oor:name="Command">
|
||||
<value xml:lang="en-US">service:net.elmau.zaz.BarCode?ask</value>
|
||||
<value xml:lang="en-US">service:net.elmau.zaz.BarCode?used_dialog</value>
|
||||
</prop>
|
||||
</node>
|
||||
</node>
|
||||
<node oor:name="com.sun.star.drawing.DrawingDocument">
|
||||
<node oor:name="I_SHIFT_MOD1_MOD2" oor:op="fuse">
|
||||
<prop oor:name="Command">
|
||||
<value xml:lang="en-US">service:net.elmau.zaz.BarCode?ask</value>
|
||||
<value xml:lang="en-US">service:net.elmau.zaz.BarCode?used_dialog</value>
|
||||
</prop>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
@ -2,6 +2,9 @@ import gettext
|
|||
import uno
|
||||
import unohelper
|
||||
from com.sun.star.task import XJobExecutor, XJob
|
||||
import main
|
||||
|
||||
|
||||
import easymacro as app
|
||||
|
||||
import qrcode
|
||||
|
@ -15,8 +18,6 @@ TITLE = 'ZAZ BarCode'
|
|||
QR = 'qrcode'
|
||||
|
||||
|
||||
_ = app.install_locales(__file__)
|
||||
|
||||
|
||||
class Controllers(object):
|
||||
|
||||
|
@ -72,13 +73,15 @@ class ZAZBarCode(unohelper.Base, XJob, XJobExecutor):
|
|||
return self._path
|
||||
|
||||
def trigger(self, args):
|
||||
self._type = args
|
||||
if args == 'ask' and not self._get_values():
|
||||
return
|
||||
main.ID_EXTENSION = ID_EXTENSION
|
||||
main.run(args, __file__)
|
||||
# ~ self._type = args
|
||||
# ~ if args == 'ask' and not self._get_values():
|
||||
# ~ return
|
||||
|
||||
doc = app.get_document()
|
||||
getattr(self, '_insert_in_{}'.format(doc.type))(doc)
|
||||
app.kill(self._path)
|
||||
# ~ doc = app.get_document()
|
||||
# ~ getattr(self, '_insert_in_{}'.format(doc.type))(doc)
|
||||
# ~ app.kill(self._path)
|
||||
return
|
||||
|
||||
def _create_code(self, path=''):
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import easymacro as app
|
||||
|
||||
|
||||
ID_EXTENSION = ''
|
||||
_ = None
|
||||
|
||||
|
||||
def _use_dialog():
|
||||
print('dialog')
|
||||
return
|
||||
|
||||
|
||||
def _insert_code(type_code):
|
||||
print(type_code)
|
||||
return
|
||||
|
||||
|
||||
@app.catch_exception
|
||||
def run(args, path_locales):
|
||||
global _
|
||||
|
||||
_ = app.install_locales(path_locales)
|
||||
|
||||
if args == 'used_dialog':
|
||||
_use_dialog()
|
||||
else:
|
||||
_insert_code(args)
|
||||
|
||||
return
|
Loading…
Reference in New Issue