Fix in AddOns menus
This commit is contained in:
parent
d4ce8a2f35
commit
a072c9bdc3
|
@ -1,3 +1,7 @@
|
|||
v 0.13.0 [14-mar-2020]
|
||||
- Fix: menus in AddOns
|
||||
|
||||
|
||||
v 0.12.0 [29-oct-2019]
|
||||
- Xml addons refactory
|
||||
- Xml shortcuts refactory
|
||||
|
|
|
@ -10,16 +10,16 @@ For Python 3.6+
|
|||
* Ver [documentación](https://gitlab.com/mauriciobaeza/zaz/wikis/inicio)
|
||||
|
||||
|
||||
### Software libre, not gratis
|
||||
### Software libre, no gratis
|
||||
|
||||
|
||||
This extension have a cost of maintenance of 1 euro every year.
|
||||
This extension have a cost of maintenance of 10 euro every year.
|
||||
|
||||
BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
|
||||
|
||||
BTC: `3FhiXcXmAesmQzrNEngjHFnvaJRhU1AGWV`
|
||||
|
||||
PayPal :( donate ATT elmau DOT net
|
||||
You have others cryptos, welcome too!
|
||||
|
||||
|
||||
## Extensions develop with ZAZ
|
||||
|
|
|
@ -129,12 +129,15 @@ DESKTOP = os.environ.get('DESKTOP_SESSION', '')
|
|||
INFO_DEBUG = '{}\n\n{}\n\n{}'.format(sys.version, platform.platform(), '\n'.join(sys.path))
|
||||
|
||||
IS_WIN = OS == 'Windows'
|
||||
IS_MAC = OS == 'Darwin'
|
||||
|
||||
LOG_NAME = 'ZAZ'
|
||||
CLIPBOARD_FORMAT_TEXT = 'text/plain;charset=utf-16'
|
||||
|
||||
PYTHON = 'python'
|
||||
if IS_WIN:
|
||||
PYTHON = 'python.exe'
|
||||
|
||||
CALC = 'calc'
|
||||
WRITER = 'writer'
|
||||
|
||||
|
@ -729,6 +732,9 @@ class LODocument(object):
|
|||
|
||||
return path_pdf
|
||||
|
||||
# ~ If location="document" Then
|
||||
# ~ sp = ThisComponent.getScriptProvider()
|
||||
|
||||
|
||||
class FormControlBase(object):
|
||||
EVENTS = {
|
||||
|
@ -1806,6 +1812,15 @@ class LOCellRange(object):
|
|||
def columns(self):
|
||||
return self._obj.Columns.Count
|
||||
|
||||
@property
|
||||
def row(self):
|
||||
a = self.address
|
||||
if hasattr(a, 'Row'):
|
||||
r = a.Row
|
||||
else:
|
||||
r = a.StartRow
|
||||
return r
|
||||
|
||||
@property
|
||||
def rows(self):
|
||||
return self._obj.Rows.Count
|
||||
|
@ -4135,6 +4150,10 @@ def active_cell():
|
|||
return get_cell()
|
||||
|
||||
|
||||
def active_sheet():
|
||||
return get_document().active
|
||||
|
||||
|
||||
def create_dialog(properties):
|
||||
return LODialog(**properties)
|
||||
|
||||
|
@ -4154,8 +4173,33 @@ def get_config_path(name='Work'):
|
|||
|
||||
|
||||
def get_path_python():
|
||||
path = get_config_path('Module')
|
||||
return join(path, PYTHON)
|
||||
return sys.executable
|
||||
|
||||
# ~ path = get_config_path('Module')
|
||||
# ~ if IS_MAC:
|
||||
# ~ path = join(path, '..', 'Resources', PYTHON)
|
||||
# ~ else:
|
||||
# ~ path = join(path, PYTHON)
|
||||
|
||||
# ~ cmd = '"{}" -V'.format(path)
|
||||
# ~ if run(cmd, True):
|
||||
# ~ return path
|
||||
|
||||
# ~ path = PYTHON
|
||||
# ~ cmd = '"{}" -V'.format(path)
|
||||
# ~ result = run(cmd, True)
|
||||
|
||||
# ~ if 'Python 3' in result:
|
||||
# ~ return path
|
||||
|
||||
# ~ path = PYTHON + '3'
|
||||
# ~ cmd = '"{}" -V'.format(path)
|
||||
# ~ result = run(cmd, True)
|
||||
|
||||
# ~ if 'Python 3' in result:
|
||||
# ~ return path
|
||||
|
||||
# ~ return ''
|
||||
|
||||
|
||||
# ~ Export ok
|
||||
|
@ -4519,8 +4563,8 @@ def run(command, wait=False):
|
|||
stdout=None, stderr=None, close_fds=True)
|
||||
result, er = p.communicate()
|
||||
except subprocess.CalledProcessError as e:
|
||||
msg = ("run [ERROR]: output = %s, error code = %s\n"
|
||||
% (e.output, e.returncode))
|
||||
msg = ("%s\nrun [ERROR]: output = %s, error code = %s\n"
|
||||
% (command, e.output, e.returncode))
|
||||
error(msg)
|
||||
return False
|
||||
|
||||
|
|
|
@ -212,12 +212,16 @@ class LiboXML(object):
|
|||
sn.text = value
|
||||
return
|
||||
|
||||
def _add_menu(self, id_extension, node, index, menu):
|
||||
attr = {
|
||||
'oor:name': index,
|
||||
'oor:op': 'replace',
|
||||
}
|
||||
subnode = ET.SubElement(node, 'node', attr)
|
||||
def _add_menu(self, id_extension, node, index, menu, in_menu_bar=True):
|
||||
if in_menu_bar:
|
||||
attr = {
|
||||
'oor:name': index,
|
||||
'oor:op': 'replace',
|
||||
}
|
||||
subnode = ET.SubElement(node, 'node', attr)
|
||||
else:
|
||||
subnode = node
|
||||
|
||||
attr = {'oor:name': 'Title', 'oor:type': 'xs:string'}
|
||||
sn1 = ET.SubElement(subnode, 'prop', attr)
|
||||
for k, v in menu['title'].items():
|
||||
|
@ -242,6 +246,7 @@ class LiboXML(object):
|
|||
return
|
||||
|
||||
def new_addons(self, id_extension, data):
|
||||
in_menu_bar = data['parent'] == 'OfficeMenuBar'
|
||||
self._path_images = data['images']
|
||||
attr = {
|
||||
'oor:name': 'Addons',
|
||||
|
@ -253,13 +258,13 @@ class LiboXML(object):
|
|||
node = ET.SubElement(parent, 'node', {'oor:name': data['parent']})
|
||||
|
||||
op = 'fuse'
|
||||
if data['parent'] == 'OfficeMenuBar':
|
||||
if in_menu_bar:
|
||||
op = 'replace'
|
||||
|
||||
attr = {'oor:name': id_extension, 'oor:op': op}
|
||||
node = ET.SubElement(node, 'node', attr)
|
||||
|
||||
if data['parent'] == 'OfficeMenuBar':
|
||||
if in_menu_bar:
|
||||
attr = {'oor:name': 'Title', 'oor:type': 'xs:string'}
|
||||
subnode = ET.SubElement(node, 'prop', attr)
|
||||
for k, v in data['main'].items():
|
||||
|
@ -270,7 +275,7 @@ class LiboXML(object):
|
|||
node = ET.SubElement(node, 'node', {'oor:name': 'Submenu'})
|
||||
|
||||
for i, menu in enumerate(data['menus']):
|
||||
self._add_menu(id_extension, node, f'm{i}', menu)
|
||||
self._add_menu(id_extension, node, f'm{i}', menu, in_menu_bar)
|
||||
if menu.get('toolbar', False):
|
||||
self._toolbars.append(menu)
|
||||
|
||||
|
|
Loading…
Reference in New Issue