本文整理汇总了Python中OpenIPMI.pefconfig_enum_val方法的典型用法代码示例。如果您正苦于以下问题:Python OpenIPMI.pefconfig_enum_val方法的具体用法?Python OpenIPMI.pefconfig_enum_val怎么用?Python OpenIPMI.pefconfig_enum_val使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenIPMI
的用法示例。
在下文中一共展示了OpenIPMI.pefconfig_enum_val方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setenum
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import pefconfig_enum_val [as 别名]
def setenum(self, val):
rv = self.pefc.set_val(self.parm, self.aidx, "integer", str(val))
if (rv != 0):
self.glist.SetError("Could not set value to " + str(val) + ": "
+ OpenIPMI.get_error_string(rv))
return
self.currval = val
nval = [ 0 ]
sval = [ "" ]
OpenIPMI.pefconfig_enum_val(self.parm, val, nval, sval)
self.glib.SetColumn(self.idx, 1, sval[0])
return
示例2: HandleMenu
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import pefconfig_enum_val [as 别名]
def HandleMenu(self, event, idx, point):
if (self.ptype == "bool"):
menul = [ ("Toggle Value", self.togglevalue) ]
elif (self.ptype == "enum"):
menul = [ ]
nval = [ 0 ]
sval = [ "" ]
val = 0;
while (val != -1):
rv = OpenIPMI.pefconfig_enum_val(self.parm, val, nval, sval)
if (rv == 0):
menul.append( (sval[0] + " (" + str(val) + ")",
self.setenum,
val) )
pass
val = nval[0];
pass
pass
else:
menul = [ ("Set Value", self.setvalue) ]
pass
gui_popup.popup(self.glist, event, menul, point)
return
示例3: __init__
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import pefconfig_enum_val [as 别名]
def __init__(self, m, pef, pefc):
gui_list.List.__init__(self,
"PEFPARMS for " + m.name,
[ ("Name", 250), ("Value", 250) ])
self.pef = pef
self.pefc = pefc
i = 0
j = 0
rv = True
v = [ 0 ]
while (rv):
lastv = v[0]
rv = pefc.get_val(i, v)
if (rv):
vals = rv.split(" ", 2)
if (len(vals) == 3):
# Valid parm
if (vals[1] == "integer"):
w = [ 0 ]
x = [ "" ]
err = OpenIPMI.pefconfig_enum_val(i, 0, w, x)
if (err != OpenIPMI.enosys):
vals[1] = "enum"
pass
pass
data = MCPEFData(self, pefc, i, lastv,
vals[0], vals[1], vals[2])
if (v[0] == 0):
title = vals[0]
else:
x = [ "" ]
err = OpenIPMI.pefconfig_enum_idx(i, lastv, x)
if (err):
title = vals[0] + "[" + str(lastv) + "]"
else:
title = vals[0] + "[" + x[0] + "]"
pass
pass
if (vals[1] == "enum"):
nval = [ 0 ]
sval = [ "" ]
OpenIPMI.pefconfig_enum_val(data.parm, int(vals[2]),
nval, sval)
value = sval[0]
pass
else:
value = vals[2]
pass
self.add_data(title, [ value ], data)
j += 1
if (v[0] == 0):
i += 1
pass
if (v[0] == -1):
i += 1
v[0] = 0
pass
pass
else:
v[0] = 0
i += 1
pass
pass
pass
self.AfterDone()
return