本文整理汇总了Python中tactic.ui.container.MenuItem.set_submenu_tag_suffix方法的典型用法代码示例。如果您正苦于以下问题:Python MenuItem.set_submenu_tag_suffix方法的具体用法?Python MenuItem.set_submenu_tag_suffix怎么用?Python MenuItem.set_submenu_tag_suffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tactic.ui.container.MenuItem
的用法示例。
在下文中一共展示了MenuItem.set_submenu_tag_suffix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from tactic.ui.container import MenuItem [as 别名]
# 或者: from tactic.ui.container.MenuItem import set_submenu_tag_suffix [as 别名]
#.........这里部分代码省略.........
'project_code': project_code,
'cbjs_action': '''
spt.app_busy.show("Jumping to Project ["+bvr.project_code+"]", "");
document.location = '/tactic/%s/';
''' % project_code
} )
menu.add(menu_item)
search = Search("sthpw/project")
search.add_column("category", distinct=True)
categories = [x.get_value("category") for x in search.get_sobjects() ]
for category in categories:
if category == '':
continue
# FIXME: a little inefficient, but should be ok for now
category_projects = []
for project in projects:
if project.get_value("category") != category:
continue
project_code = project.get_code()
if not security.check_access("project", project_code, "view"):
continue
category_projects.append(project)
if category_projects:
suffix = Common.get_filesystem_name(category)
label = "%s (%s)" % (category, len(category_projects))
menu_item = MenuItem(type='submenu', label=label)
menu_item.set_submenu_tag_suffix(suffix)
menu.add(menu_item)
submenu = Menu(width=200, menu_tag_suffix=suffix)
menus.append(submenu)
for project in category_projects:
add_project_menu(submenu, project)
from pyasm.security import get_security_version
security_version = get_security_version()
for project in projects:
if project.get_value("category") != "":
continue
project_code = project.get_code()
if security_version >= 2:
key = { "code": project_code }
key2 = { "code": "*" }
keys = [key, key2]
default = "deny"
if not security.check_access("project", keys, "allow", default=default):
continue
else:
if not security.check_access("project", project_code, "view", default="allow"):
continue
add_project_menu(menu, project)
if not projects: