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: if MENUS[index.lower()] == cmd:
self._menu = menu self._menu = menu
break break
line = self._menu.get('CommandURL', '') # ~ line = self._menu.get('CommandURL', '')
line += self._get_submenus(self._menu['ItemDescriptorContainer']) # ~ line += self._get_submenus(self._menu['ItemDescriptorContainer'])
return line return self._menu
def _get_menus(self): def _get_menus(self):
instance = 'com.sun.star.ui.ModuleUIConfigurationManagerSupplier' instance = 'com.sun.star.ui.ModuleUIConfigurationManagerSupplier'

Binary file not shown.

View File

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

View File

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