本文整理汇总了Python中navigation.api.register_top_menu函数的典型用法代码示例。如果您正苦于以下问题:Python register_top_menu函数的具体用法?Python register_top_menu怎么用?Python register_top_menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register_top_menu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register
def register(cls, app_name):
logger.debug('Trying to import: %s' % app_name)
try:
app_module = import_module(app_name)
except ImportError:
logger.debug('Unable to import app: %s' % app_name)
else:
logger.debug('Trying to import registry from: %s' % app_name)
try:
registration = import_module('%s.registry' % app_name)
except ImportError:
logger.debug('Unable to import registry for app: %s' % app_name)
else:
if not getattr(registration, 'disabled', False):
app = App()
app.name=app_name
# If there are not error go ahead with the stored app instance
app.label = getattr(registration, 'label', app_name)
app.description = getattr(registration, 'description', u'')
for link in getattr(registration, 'setup_links', []):
logger.debug('setup link: %s' % link)
register_setup(link)
for link in getattr(registration, 'tool_links', []):
logger.debug('tool link: %s' % link)
register_tool(link)
for index, link in enumerate(getattr(registration, 'menu_links', [])):
logger.debug('menu_link: %s' % link)
register_top_menu(name='%s.%s' % (app_name, index), link=link)
示例2: register
def register(cls, app_name):
logger.debug('Trying to import: %s' % app_name)
try:
app_module = import_module(app_name)
except ImportError:
logger.debug('Unable to import app: %s' % app_name)
else:
logger.debug('Trying to import registry from: %s' % app_name)
try:
registration = import_module('%s.registry' % app_name)
except ImportError as e:
logger.debug('Unable to import registry for app: %s; %s' % (app_name, e))
else:
if not getattr(registration, 'disabled', False):
app = App()
app.name = app_name
# If there are not error go ahead with the stored app instance
app.label = getattr(registration, 'label', app_name)
app.description = getattr(registration, 'description', u'')
for link in getattr(registration, 'setup_links', []):
logger.debug('setup link: %s' % link)
register_setup(link)
for link in getattr(registration, 'tool_links', []):
logger.debug('tool link: %s' % link)
register_tool(link)
for index, link in enumerate(getattr(registration, 'menu_links', [])):
logger.debug('menu_link: %s' % link)
register_top_menu(name='%s.%s' % (app_name, index), link=link)
for cleanup_function in getattr(registration, 'cleanup_functions', []):
logger.debug('cleanup_function: %s' % cleanup_function)
Cleanup(cleanup_function)
for bootstrap_model in getattr(registration, 'bootstrap_models', []):
logger.debug('bootstrap_model: %s' % bootstrap_model)
BootstrapModel(model_name=bootstrap_model.get('name'), app_name=app_name, sanitize=bootstrap_model.get('sanitize', True), dependencies=bootstrap_model.get('dependencies'))
version_0_api_services = getattr(registration, 'version_0_api_services', [])
logger.debug('version_0_api_services: %s' % version_0_api_services)
if version_0_api_services:
api_endpoint = APIEndPoint(app_name)
for service in version_0_api_services:
api_endpoint.add_service(**service)
示例3: register_top_menu
__version_info__ = {
'major': 0,
'minor': 7,
'micro': 6,
'releaselevel': 'final',
'serial': 0
}
#setup_views = []
#setup_views.extend(permission_views)
#setup_views.extend(user_management_views)
#setup_views.extend(['setting_list'])
if not DISABLE_HOME_VIEW:
register_top_menu('home', link={'text': _(u'home'), 'view': 'home', 'famfam': 'house'}, position=0)
if not SIDE_BAR_SEARCH:
register_top_menu('search', link={'text': _(u'search'), 'view': 'search', 'famfam': 'zoom'}, children_path_regex=[r'^search/'])
register_top_menu('tools', link=tools_menu, children_views=['statistics', 'history_list', 'formats_list'])
#register_top_menu('setup_menu', link={'text': _(u'setup'), 'view': 'setting_list', 'famfam': 'cog'}, children=setup_views)
register_top_menu('setup_menu', link={'text': _(u'setup'), 'view': 'setting_list', 'famfam': 'cog'}, children_path_regex=[r'^settings/', r'^user_management/', r'^permissions', r'^documents/type', r'^metadata/setup'])
register_top_menu('about', link={'text': _(u'about'), 'view': 'about', 'famfam': 'information'})
register_links(['tools_menu', 'statistics', 'history_list', 'history_view', 'formats_list'], [tools_menu, statistics, history_list, formats_list, sentry], menu_name='secondary_menu')
setup_links = [check_settings, role_list, user_list, group_list, document_types, setup_metadata_type_list, setup_metadata_set_list, admin_site]
register_links(['setting_list'], setup_links, menu_name='secondary_menu')
register_links(permission_views, setup_links, menu_name='secondary_menu')
register_links(user_management_views, setup_links, menu_name='secondary_menu')
register_links(document_type_views, setup_links, menu_name='secondary_menu')
示例4: import
folder_document_multiple_remove, folder_view, folder_add_document,
folder_add_multiple_documents, document_folder_list, folder_acl_list,
folders_main_menu_link)
from .models import Folder
from .permissions import (PERMISSION_FOLDER_CREATE,
PERMISSION_FOLDER_EDIT, PERMISSION_FOLDER_DELETE,
PERMISSION_FOLDER_REMOVE_DOCUMENT, PERMISSION_FOLDER_VIEW,
PERMISSION_FOLDER_ADD_DOCUMENT)
register_multi_item_links(['folder_view'], [folder_document_multiple_remove])
register_links(Folder, [folder_view, folder_edit, folder_delete, folder_acl_list])
register_links([Folder, 'folder_list', 'folder_create'], [folder_list, folder_create], menu_name='secondary_menu')
register_top_menu(name='folders', link=folders_main_menu_link, children_views=['folder_list', 'folder_create', 'folder_edit', 'folder_delete', 'folder_view', 'folder_document_multiple_remove'])
register_links(Document, [document_folder_list], menu_name='form_header')
register_sidebar_template(['folder_list'], 'folders_help.html')
register_links(['document_folder_list', 'folder_add_document'], [folder_add_document], menu_name="sidebar")
register_multi_item_links(['document_find_duplicates', 'folder_view', 'index_instance_node_view', 'document_type_document_list', 'search', 'results', 'document_group_view', 'document_list', 'document_list_recent', 'tag_tagged_item_list'], [folder_add_multiple_documents])
class_permissions(Folder, [
PERMISSION_FOLDER_EDIT,
PERMISSION_FOLDER_DELETE,
PERMISSION_FOLDER_VIEW,
ACLS_EDIT_ACL,
ACLS_VIEW_ACL
示例5: is_superuser
'releaselevel': 'beta',
'serial': 0
}
def is_superuser(context):
return context['request'].user.is_staff or context['request'].user.is_superuser
maintenance_menu = {'text': _(u'maintenance'), 'view': 'maintenance_menu', 'famfam': 'wrench', 'icon': 'wrench.png'}
statistics = {'text': _(u'statistics'), 'view': 'statistics', 'famfam': 'table', 'icon': 'blackboard_sum.png', 'condition': is_superuser, 'children_view_regex': [r'statistics']}
diagnostics = {'text': _(u'diagnostics'), 'view': 'diagnostics', 'famfam': 'pill', 'icon': 'pill.png'}
sentry = {'text': _(u'sentry'), 'view': 'sentry', 'famfam': 'bug', 'icon': 'bug.png', 'condition': is_superuser}
admin_site = {'text': _(u'admin site'), 'view': 'admin:index', 'famfam': 'keyboard', 'icon': 'keyboard.png', 'condition': is_superuser}
if not DISABLE_HOME_VIEW:
register_top_menu('home', link={'text': _(u'home'), 'view': 'home', 'famfam': 'house'}, position=0)
if not SIDE_BAR_SEARCH:
register_top_menu('search', link={'text': _(u'search'), 'view': 'search', 'famfam': 'zoom'}, children_path_regex=[r'^search/'])
def get_version():
'''
Return the formatted version information
'''
vers = ['%(major)i.%(minor)i' % __version_info__, ]
if __version_info__['micro']:
vers.append('.%(micro)i' % __version_info__)
if __version_info__['releaselevel'] != 'final':
vers.append('%(releaselevel)s%(serial)i' % __version_info__)
return ''.join(vers)
示例6: register_top_menu
from django.utils.translation import ugettext_lazy as _
from navigation.api import register_top_menu
#TODO: FIXME dynamic children_path_regext on api register_setup
register_top_menu('tools', link={'text': _(u'tools'), 'view': 'tools_list', 'famfam': 'wrench'}, children_views=['statistics', 'history_list', 'formats_list'], position=-3)
示例7: register_top_menu
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from navigation.api import register_top_menu
from project_setup.api import register_setup
from project_tools.api import register_tool
from .links import admin_site, maintenance_menu
from .classes import FrontPageButton # NOQA
register_top_menu('home', link={'text': _('Home'), 'view': 'main:home', 'famfam': 'house'}, position=0)
register_setup(admin_site)
register_tool(maintenance_menu)
示例8: register_model_list_columns
except Exception, exc:
return exc
register_model_list_columns(Document, [
{'name':_(u'thumbnail'), 'attribute':
lambda x: document_thumbnail(x)
},
{'name':_(u'tags'), 'attribute':
lambda x: get_tags_inline_widget_simple(x)
},
{'name':_(u'metadata'), 'attribute':
lambda x: get_metadata_string(x)
},
])
register_top_menu(
'documents',
link={'famfam': 'page', 'text': _(u'documents'), 'view': 'document_list_recent'},
children_path_regex=[
r'^documents/[^t]', r'^metadata/[^s]', r'comments', r'tags/document', r'grouping/[^s]', r'history/list/for_object/documents'
],
position=0
)
register_sidebar_template(['document_list_recent'], 'recent_document_list_help.html')
register_sidebar_template(['document_type_list'], 'document_types_help.html')
register_links(Document, [document_view_simple], menu_name='form_header', position=0)
register_links(Document, [document_view_advanced], menu_name='form_header', position=1)
register_links(Document, [document_history_view], menu_name='form_header')
示例9: _
index_setup_list = {'text': _(u'index list'), 'view': 'index_setup_list', 'famfam': 'tab', 'permissions': [PERMISSION_DOCUMENT_INDEXING_SETUP]}
index_setup_create = {'text': _(u'create index'), 'view': 'index_setup_create', 'famfam': 'tab_add', 'permissions': [PERMISSION_DOCUMENT_INDEXING_CREATE]}
index_setup_edit = {'text': _(u'edit'), 'view': 'index_setup_edit', 'args': 'index.pk', 'famfam': 'tab_edit', 'permissions': [PERMISSION_DOCUMENT_INDEXING_EDIT]}
index_setup_delete = {'text': _(u'delete'), 'view': 'index_setup_delete', 'args': 'index.pk', 'famfam': 'tab_delete', 'permissions': [PERMISSION_DOCUMENT_INDEXING_DELETE]}
index_setup_view = {'text': _(u'tree template'), 'view': 'index_setup_view', 'args': 'index.pk', 'famfam': 'textfield', 'permissions': [PERMISSION_DOCUMENT_INDEXING_SETUP]}
template_node_create = {'text': _(u'new child node'), 'view': 'template_node_create', 'args': 'node.pk', 'famfam': 'textfield_add', 'permissions': [PERMISSION_DOCUMENT_INDEXING_SETUP]}
template_node_edit = {'text': _(u'edit'), 'view': 'template_node_edit', 'args': 'node.pk', 'famfam': 'textfield', 'permissions': [PERMISSION_DOCUMENT_INDEXING_SETUP], 'conditional_disable': is_root_node}
template_node_delete = {'text': _(u'delete'), 'view': 'template_node_delete', 'args': 'node.pk', 'famfam': 'textfield_delete', 'permissions': [PERMISSION_DOCUMENT_INDEXING_SETUP], 'conditional_disable': is_root_node}
index_list = {'text': _(u'index list'), 'view': 'index_list', 'famfam': 'tab', 'permissions': [PERMISSION_DOCUMENT_INDEXING_VIEW]}
index_parent = {'text': _(u'go up one level'), 'view': 'index_instance_node_view', 'args': 'object.parent.pk', 'famfam': 'arrow_up', 'permissions': [PERMISSION_DOCUMENT_INDEXING_VIEW], 'dont_mark_active': True, 'condition': is_not_instance_root_node}
document_index_list = {'text': _(u'indexes'), 'view': 'document_index_list', 'args': 'object.pk', 'famfam': 'folder_page', 'permissions': [PERMISSION_DOCUMENT_INDEXING_VIEW, PERMISSION_DOCUMENT_VIEW]}
register_top_menu('indexes', link={'text': _('indexes'), 'famfam': 'tab', 'view': 'index_list', 'children_view_regex': [r'^index_[i,l]']})
rebuild_index_instances = {'text': _('rebuild indexes'), 'view': 'rebuild_index_instances', 'famfam': 'folder_page', 'permissions': [PERMISSION_DOCUMENT_INDEXING_REBUILD_INDEXES], 'description': _(u'Deletes and creates from scratch all the document indexes.')}
register_maintenance_links([rebuild_index_instances], namespace='document_indexing', title=_(u'Indexes'))
register_sidebar_template(['index_instance_list'], 'indexing_help.html')
register_links(IndexInstanceNode, [index_parent])
register_links(Document, [document_index_list], menu_name='form_header')
register_setup(index_setup)
register_links([Index, 'index_setup_list', 'index_setup_create', 'template_node_edit', 'template_node_delete'], [index_setup_list, index_setup_create], menu_name='secondary_menu')
示例10: _
from django.utils.translation import ugettext_lazy as _
from navigation.api import register_top_menu
#TODO: FIXME dynamic children_path_regext on api register_setup
#register_top_menu('setup_menu', link={'text': _(u'setup'), 'view': 'setup_list', 'famfam': 'cog'}, children_path_regex=[r'^settings/', r'^user_management/', r'^permissions'], position=-2)
register_top_menu('setup_menu', link={'text': _(u'setup'), 'view': 'setup_list'}, children_path_regex=[r'^settings/', r'^user_management/', r'^permissions'], position=-2)
示例11: _
folder_delete = {'text': _('delete'), 'view': 'folder_delete', 'args': 'object.pk', 'famfam': 'folder_delete', 'permissions': [PERMISSION_FOLDER_DELETE]}
folder_document_multiple_remove = {'text': _('remove from folder'), 'view': 'folder_document_multiple_remove', 'args': 'object.pk', 'famfam': 'folder_delete', 'permissions': [PERMISSION_FOLDER_REMOVE_DOCUMENT]}
folder_view = {'text': _(u'folder documents'), 'view': 'folder_view', 'args': 'object.pk', 'famfam': 'folder_go', 'permissions': [PERMISSION_FOLDER_VIEW]}
folder_add_document = {'text': _('add to a folder'), 'view': 'folder_add_document', 'args': 'object.pk', 'famfam': 'folder_add', 'permissions': [PERMISSION_FOLDER_ADD_DOCUMENT]}
folder_add_multiple_documents = {'text': _('add to folder'), 'view': 'folder_add_multiple_documents', 'famfam': 'folder_add', 'permissions': [PERMISSION_FOLDER_ADD_DOCUMENT]}
document_folder_list = {'text': _(u'folders'), 'view': 'document_folder_list', 'args': 'object.pk', 'famfam': 'folder_user', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'children_view_regex': [r'folder']}
folder_acl_list = {'text': _(u'ACLs'), 'view': 'folder_acl_list', 'args': 'object.pk', 'famfam': 'lock', 'permissions': [ACLS_VIEW_ACL]}
register_multi_item_links(['folder_view'], [folder_document_multiple_remove])
register_links(Folder, [folder_view, folder_edit, folder_delete, folder_acl_list])
register_links([Folder, 'folder_list', 'folder_create'], [folder_list, folder_create], menu_name='secondary_menu')
register_top_menu(name='folders', link={'text': _('folders'), 'famfam': 'folder_user', 'view': 'folder_list'}, children_views=['folder_list', 'folder_create', 'folder_edit', 'folder_delete', 'folder_view', 'folder_document_multiple_remove'])
register_links(Document, [document_folder_list], menu_name='form_header')
register_sidebar_template(['folder_list'], 'folders_help.html')
register_links(['document_folder_list', 'folder_add_document'], [folder_add_document], menu_name="sidebar")
register_multi_item_links(['document_find_duplicates', 'folder_view', 'index_instance_node_view', 'document_type_document_list', 'search', 'results', 'document_group_view', 'document_list', 'document_list_recent', 'tag_tagged_item_list'], [folder_add_multiple_documents])
class_permissions(Folder, [
PERMISSION_FOLDER_EDIT,
PERMISSION_FOLDER_DELETE,
PERMISSION_FOLDER_VIEW,
ACLS_EDIT_ACL,
ACLS_VIEW_ACL
示例12: register_top_menu
from django.utils.translation import ugettext_lazy as _
from navigation.api import register_top_menu
tool_link = register_top_menu('tools', link={'text': _(u'tools'), 'view': 'tools_list', 'famfam': 'wrench'}, position=-3)
示例13: register_top_menu
from django.utils.translation import ugettext_lazy as _
from navigation.api import register_top_menu
#TODO: FIXME dynamic children_path_regext on api register_setup
register_top_menu('setup_menu', link={'text': _(u'setup'), 'view': 'setup_list', 'famfam': 'cog'}, children_path_regex=[r'^settings/', r'^user_management/', r'^permissions', r'^documents/type', r'^metadata/setup', r'sources/setup'], position=-2)
示例14: _
queue_document_list = {'text': _(u'queue document list'), 'view': 'queue_document_list', 'famfam': 'hourglass', 'permissions': [PERMISSION_OCR_DOCUMENT]}
node_active_list = {'text': _(u'active tasks'), 'view': 'node_active_list', 'famfam': 'server_chart', 'permissions': [PERMISSION_OCR_DOCUMENT]}
register_links(Document, [submit_document])
register_links(DocumentQueue, [document_queue_disable, document_queue_enable])
register_multi_item_links(['queue_document_list'], [re_queue_multiple_document, queue_document_multiple_delete])
register_links(['queue_document_list', 'node_active_list'], [queue_document_list, node_active_list], menu_name='secondary_menu')
register_tool(all_document_ocr_cleanup, namespace='ocr', title=_(u'OCR'))
#Menus
register_top_menu('ocr', link={'text': _('OCR'), 'famfam': 'hourglass', 'view': 'queue_document_list'}, children_path_regex=[r'^ocr/'])
try:
default_queue, created = DocumentQueue.objects.get_or_create(name='default')
if created:
default_queue.label = ugettext(u'Default')
default_queue.save()
except DatabaseError:
#syncdb
pass
def document_post_save(sender, instance, **kwargs):
if kwargs.get('created', False):
if AUTOMATIC_OCR:
DocumentQueue.objects.queue_document(instance)
示例15: register_top_menu
from __future__ import absolute_import
from navigation.api import register_top_menu
from .links import link_tools_menu
tool_menu = register_top_menu('tools', link=link_tools_menu, position=-3)