diff --git a/easymacro.py b/easymacro.py index 97bd577..5c786e4 100644 --- a/easymacro.py +++ b/easymacro.py @@ -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' diff --git a/files/ZAZFavorites_v0.6.0.oxt b/files/ZAZFavorites_v0.6.0.oxt index 303d707..cf7155f 100644 Binary files a/files/ZAZFavorites_v0.6.0.oxt and b/files/ZAZFavorites_v0.6.0.oxt differ diff --git a/source/pythonpath/easymacro.py b/source/pythonpath/easymacro.py index 97bd577..5c786e4 100644 --- a/source/pythonpath/easymacro.py +++ b/source/pythonpath/easymacro.py @@ -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' diff --git a/source/pythonpath/main.py b/source/pythonpath/main.py index 8698af5..afb03f5 100644 --- a/source/pythonpath/main.py +++ b/source/pythonpath/main.py @@ -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 _