Insert menus

This commit is contained in:
Mauricio Baeza 2020-12-27 19:25:32 -06:00
parent 60409ceeb3
commit 25733e81cf
4 changed files with 26 additions and 36 deletions

View File

@ -5407,9 +5407,9 @@ class LOMenu(object):
if MENUS[index.lower()] == cmd:
self._menu = menu
break
line = self._menu.get('CommandURL', '')
line += self._get_submenus(self._menu['ItemDescriptorContainer'])
return line
# ~ line = self._menu.get('CommandURL', '')
# ~ line += self._get_submenus(self._menu['ItemDescriptorContainer'])
return self._menu
def _get_menus(self):
instance = 'com.sun.star.ui.ModuleUIConfigurationManagerSupplier'

Binary file not shown.

View File

@ -5407,9 +5407,9 @@ class LOMenu(object):
if MENUS[index.lower()] == cmd:
self._menu = menu
break
line = self._menu.get('CommandURL', '')
line += self._get_submenus(self._menu['ItemDescriptorContainer'])
return line
# ~ line = self._menu.get('CommandURL', '')
# ~ line += self._get_submenus(self._menu['ItemDescriptorContainer'])
return self._menu
def _get_menus(self):
instance = 'com.sun.star.ui.ModuleUIConfigurationManagerSupplier'

View File

@ -34,43 +34,33 @@ class Controllers(object):
self.d.grid.sort(0)
return
@app.catch_exception
def button_save_action(self, event):
msg = _('Want you save your favorites files?')
if not app.question(msg, self.TITLE):
return
# ~ cmd = 'service:' + ID_EXTENSION + '?'
base = f'service:{ID_EXTENSION}?{{}}'
# ~ paths = []
submenus = []
for path in self.paths:
pass
# ~ for row in range(self.d.grid.row_count):
# ~ name = self.d.grid[0, row]
# ~ path = self.d.grid[2, row]
for i, path in enumerate(self.paths):
p = app.paths(path)
label = f'{i+1}. {p.file_name}'
url = app.paths.to_url(path)
sm = {'Label': label, 'CommandURL': base.format(url)}
submenus.append(sm)
sm = {'Label': '-'}
submenus.append(sm)
sm = {'Label': _('Favorites...'), 'CommandURL': base.format('config')}
submenus.append(sm)
# ~ label = '{}. {}'.format(row + 1, name)
# ~ paths.append(path)
# ~ path = app._path_url(path)
# ~ sm = {'Label': label, 'CommandURL': base.format(path)}
# ~ submenus.append(sm)
# ~ sm = {'Label': '-'}
# ~ submenus.append(sm)
# ~ sm = {'Label': _('Favorites...'), 'CommandURL': base.format('config')}
# ~ submenus.append(sm)
# ~ command = 'menu.zaz.favorites'
# ~ data = {
# ~ 'Label': 'Favorites',
# ~ 'CommandURL': command,
# ~ 'After': '.uno:RecentFileList',
# ~ 'Submenu': submenus,
# ~ }
# ~ for doc_type in ('main', 'calc', 'writer'):
# ~ app.remove_menu(doc_type, 'File', command)
# ~ app.insert_menu(doc_type, 'File', **data)
command = 'menu.zaz.favorites'
data = {
'Label': 'Favorites',
'CommandURL': command,
'After': '.uno:RecentFileList',
'Submenu': submenus,
}
for application in ('main', 'calc', 'writer'):
app.menus[application].insert('file', data)
app.set_config('paths', self.paths, PREFIX)
@ -187,7 +177,7 @@ def _create_dialog():
return dlg
@app.catch_exception
def run(args, path_locales):
global _