comparison frontends/src/primitivus/primitivus @ 2126:2f264f3df280

core (menus): improvments: - use the new convention for bridge names (getMenus ==> menusGet, etc.) - menu now use canonical path, which is the untranslated path with each element stripped and lowercase, it must be unique by menu type - added menuLaunch method to manually launch a menu like an action, canonical path is used instead of id - added SECURITY_LIMIT_MAX constant
author Goffi <goffi@goffi.org>
date Thu, 26 Jan 2017 20:29:48 +0100
parents c42aab22c2c0
children f45250052846
comparison
equal deleted inserted replaced
2125:ca82c97db195 2126:2f264f3df280
512 @param menu_data: data to send with these menus 512 @param menu_data: data to send with these menus
513 513
514 """ 514 """
515 def add_menu_cb(callback_id): 515 def add_menu_cb(callback_id):
516 self.launchAction(callback_id, menu_data, profile=self.current_profile) 516 self.launchAction(callback_id, menu_data, profile=self.current_profile)
517 for id_, type_, path, path_i18n, extra in self.bridge.getMenus("", C.NO_SECURITY_LIMIT ): # TODO: manage extra 517 for id_, type_, path, path_i18n, extra in self.bridge.menusGet("", C.NO_SECURITY_LIMIT ): # TODO: manage extra
518 if type_ != type_filter: 518 if type_ != type_filter:
519 continue 519 continue
520 if len(path) != 2: 520 if len(path) != 2:
521 raise NotImplementedError("Menu with a path != 2 are not implemented yet") 521 raise NotImplementedError("Menu with a path != 2 are not implemented yet")
522 menu.addMenu(path_i18n[0], path_i18n[1], lambda dummy,id_=id_: add_menu_cb(id_)) 522 menu.addMenu(path_i18n[0], path_i18n[1], lambda dummy,id_=id_: add_menu_cb(id_))