本文整理汇总了Python中freenasUI.freeadmin.tree.TreeNode.gname方法的典型用法代码示例。如果您正苦于以下问题:Python TreeNode.gname方法的具体用法?Python TreeNode.gname怎么用?Python TreeNode.gname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类freenasUI.freeadmin.tree.TreeNode
的用法示例。
在下文中一共展示了TreeNode.gname方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_jail_node
# 需要导入模块: from freenasUI.freeadmin.tree import TreeNode [as 别名]
# 或者: from freenasUI.freeadmin.tree.TreeNode import gname [as 别名]
def new_jail_node(self, jail, icon=u'JailIcon'):
jail_node = TreeNode()
jail_node.gname = jail.jail_host
jail_node.name = jail.jail_host
jail_node.icon = icon
return jail_node
示例2: new_storage_node
# 需要导入模块: from freenasUI.freeadmin.tree import TreeNode [as 别名]
# 或者: from freenasUI.freeadmin.tree.TreeNode import gname [as 别名]
def new_storage_node(self, jail):
storage_node = TreeNode()
storage_node.gname = 'Storage'
storage_node.name = _(u'Storage')
storage_node.icon = u'JailStorageIcon'
return storage_node
示例3: __init__
# 需要导入模块: from freenasUI.freeadmin.tree import TreeNode [as 别名]
# 或者: from freenasUI.freeadmin.tree.TreeNode import gname [as 别名]
def __init__(self, *args, **kwargs):
super(Linkss, self).__init__(*args, **kwargs)
laggadd = TreeNode('Add')
laggadd.name = _(u'Create Link Aggregation')
laggadd.view = 'freeadmin_network_lagginterface_add'
laggadd.type = 'object'
laggadd.icon = u'AddLAGGIcon'
laggadd.model = 'LAGGInterface'
laggadd.app_name = 'network'
laggview = TreeNode('View')
laggview.gname = 'View'
laggview.name = _(u'View Link Aggregations')
laggview.type = 'opennetwork'
laggview.icon = u'ViewAllLAGGsIcon'
laggview.model = 'LAGGInterface'
laggview.app_name = 'network'
self.append_children([laggadd, laggview])
for value, name in LAGGType:
laggs = models.LAGGInterface.objects.filter(lagg_protocol__exact=value)
if laggs.count() > 0:
nav = TreeNode()
nav.name = name
nav.icon = u'LAGGIcon'
nav._children = []
self.append_child(nav)
for lagg in laggs:
subnav = TreeNode()
subnav.name = lagg.lagg_interface.int_name
subnav.icon = u'LAGGIcon'
subnav._children = []
nav.append_child(subnav)
laggm = models.LAGGInterfaceMembers.objects.filter(
lagg_interfacegroup__exact=lagg.id
).order_by('lagg_ordernum')
for member in laggm:
subsubnav = TreeNode()
subsubnav.name = member.lagg_physnic
subsubnav.type = 'editobject'
subsubnav.icon = u'LAGGIcon'
subsubnav.view = 'freeadmin_network_lagginterfacemembers_edit'
subsubnav.app_name = 'network'
subsubnav.model = 'LAGGInterfaceMembers' + lagg.lagg_interface.int_name
subsubnav.kwargs = {'oid': member.id}
subsubnav.append_url = '?deletable=false'
subsubnav._children = []
subnav.append_child(subsubnav)
示例4: __init__
# 需要导入模块: from freenasUI.freeadmin.tree import TreeNode [as 别名]
# 或者: from freenasUI.freeadmin.tree.TreeNode import gname [as 别名]
def __init__(self, *args, **kwargs):
super(Linkss, self).__init__(*args, **kwargs)
laggadd = TreeNode("Add")
laggadd.name = _(u"Create Link Aggregation")
laggadd.view = "freeadmin_network_lagginterface_add"
laggadd.type = "object"
laggadd.icon = u"AddLAGGIcon"
laggadd.model = "LAGGInterface"
laggadd.app_name = "network"
laggview = TreeNode("View")
laggview.gname = "View"
laggview.name = _(u"View Link Aggregations")
laggview.type = "opennetwork"
laggview.icon = u"ViewAllLAGGsIcon"
laggview.model = "LAGGInterface"
laggview.app_name = "network"
self.append_children([laggadd, laggview])
for value, name in LAGGType:
laggs = models.LAGGInterface.objects.filter(lagg_protocol__exact=value)
if laggs.count() > 0:
nav = TreeNode()
nav.name = name
nav.icon = u"LAGGIcon"
nav._children = []
self.append_child(nav)
for lagg in laggs:
subnav = TreeNode()
subnav.name = lagg.lagg_interface.int_name
subnav.icon = u"LAGGIcon"
subnav._children = []
nav.append_child(subnav)
laggm = models.LAGGInterfaceMembers.objects.filter(lagg_interfacegroup__exact=lagg.id).order_by(
"lagg_ordernum"
)
for member in laggm:
subsubnav = TreeNode()
subsubnav.name = member.lagg_physnic
subsubnav.type = "editobject"
subsubnav.icon = u"LAGGIcon"
subsubnav.view = "freeadmin_network_lagginterfacemembers_edit"
subsubnav.app_name = "network"
subsubnav.model = "LAGGInterfaceMembers" + lagg.lagg_interface.int_name
subsubnav.kwargs = {"oid": member.id}
subsubnav.append_url = "?deletable=false"
subsubnav._children = []
subnav.append_child(subsubnav)
示例5: new_storage_node_add
# 需要导入模块: from freenasUI.freeadmin.tree import TreeNode [as 别名]
# 或者: from freenasUI.freeadmin.tree.TreeNode import gname [as 别名]
def new_storage_node_add(self, jail):
storage_node_add = TreeNode()
storage_node_add.name = _('Add Storage')
storage_node_add.gname = 'Add'
storage_node_add.type = 'editobject'
storage_node_add.view = 'jail_storage_add'
storage_node_add.kwargs = {'jail_id': jail.id}
storage_node_add.model = 'JailMountPoint'
storage_node_add.icon = u'JailStorageIcon'
storage_node_add.app_name = 'jails'
return storage_node_add
示例6: new_storage_node_view
# 需要导入模块: from freenasUI.freeadmin.tree import TreeNode [as 别名]
# 或者: from freenasUI.freeadmin.tree.TreeNode import gname [as 别名]
def new_storage_node_view(self, nmp):
storage_node_view = TreeNode()
storage_node_view.name = nmp.destination
storage_node_view.gname = nmp.id
storage_node_view.type = 'editobject'
storage_node_view.view = 'freeadmin_jails_jailmountpoint_edit'
storage_node_view.kwargs = {'oid': nmp.id}
storage_node_view.model = 'JailMountPoint'
storage_node_view.icon = u'SettingsIcon'
storage_node_view.app_name = 'jails'
return storage_node_view
示例7: new_jail_node_view
# 需要导入模块: from freenasUI.freeadmin.tree import TreeNode [as 别名]
# 或者: from freenasUI.freeadmin.tree.TreeNode import gname [as 别名]
def new_jail_node_view(self, jail):
jail_node_view = TreeNode()
jail_node_view.name = _('Edit')
jail_node_view.gname = 'Edit'
jail_node_view.type = 'editobject'
jail_node_view.view = 'jail_edit'
jail_node_view.kwargs = {'id': jail.id}
jail_node_view.model = 'Jails'
jail_node_view.icon = u'SettingsIcon'
jail_node_view.app_name = 'jails'
return jail_node_view
示例8: _generate_app
# 需要导入模块: from freenasUI.freeadmin.tree import TreeNode [as 别名]
# 或者: from freenasUI.freeadmin.tree.TreeNode import gname [as 别名]
def _generate_app(self, app, request, tree_roots, childs_of):
# Thats the root node for the app tree menu
nav = TreeRoot(app.split(".")[-1])
modnav = self._get_module(app, 'nav')
if hasattr(modnav, 'BLACKLIST'):
BLACKLIST = modnav.BLACKLIST
else:
BLACKLIST = []
if hasattr(modnav, 'ICON'):
nav.icon = modnav.ICON
if hasattr(modnav, 'NAME'):
nav.name = modnav.NAME
else:
nav.name = self.titlecase(app)
if hasattr(modnav, 'TYPE'):
nav.type = modnav.TYPE
if hasattr(modnav, 'HIDE'):
nav.skip = modnav.HIDE
if hasattr(modnav, 'URL'):
nav.url = reverse(modnav.URL)
if modnav:
modname = "%s.nav" % app
for c in dir(modnav):
navc = getattr(modnav, c)
try:
subclass = issubclass(navc, TreeNode)
except TypeError:
continue
if navc.__module__ == modname and subclass:
obj = navc(request=request)
if obj.skip is True:
continue
if not obj.append_to:
self.register_option(obj, nav, replace=True)
else:
self._navs[obj.append_to + '.' + obj.gname] = obj
tree_roots.register(nav) # We register it to the tree root
if hasattr(modnav, 'init'):
modnav.init(tree_roots, nav, request)
appPool.hook_nav_init(nav.gname, tree_roots, nav, request)
else:
log.debug("App %s has no nav.py module, skipping", app)
return
modmodels = self._get_module(app, 'models')
if modmodels:
modname = '%s.models' % app
for c in dir(modmodels):
model = getattr(modmodels, c)
try:
if issubclass(model, models.Model):
if model._meta.app_label == app:
continue
else:
continue
except TypeError, e:
continue
if c in BLACKLIST:
log.debug(
"Model %s from app %s blacklisted, skipping",
c,
app,
)
continue
if not (
model.__module__ in (
modname,
'freenasUI.' + modname,
)
and
model in self._modelforms
):
log.debug("Model %s does not have a ModelForm", model)
continue
if model._admin.deletable is False:
navopt = TreeNode(
str(model._meta.object_name),
name=model._meta.verbose_name,
model=c, app_name=app, type='dialog')
try:
navopt.kwargs = {
'oid': model.objects.order_by("-id")[0].id,
}
navopt.view = 'freeadmin_%s_%s_edit' % (
#.........这里部分代码省略.........