本文整理汇总了Python中OpenIPMI.init_tcl方法的典型用法代码示例。如果您正苦于以下问题:Python OpenIPMI.init_tcl方法的具体用法?Python OpenIPMI.init_tcl怎么用?Python OpenIPMI.init_tcl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenIPMI
的用法示例。
在下文中一共展示了OpenIPMI.init_tcl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import init_tcl [as 别名]
def run(args):
global verbosity
preffile = os.path.join(os.environ['HOME'], '.openipmigui.startup')
histfile = os.path.join(os.environ['HOME'], '.openipmigui.history')
debug_msg = False
debug_rawmsg = False
debug_mem = False
do_trace = False
read_preffile = True
log_file = None
# Skip program name.
carg = 1
while (carg < len(args)):
arg = args[carg]
carg += 1
if (arg == "--dmsg"):
debug_msg = True
elif (arg == "--drawmsg"):
debug_msg = True
elif (arg == "--dmem"):
debug_mem = True
elif (arg == "--verbose"):
verbosity += 1
elif (arg == "--trace"):
do_trace = True
elif (arg == "--logstderr"):
log_file = sys.stderr
elif (arg == "--logstdout"):
log_file = sys.stdout
elif (arg == "-n"):
read_preffile = False
elif (arg == '-p'):
if (len(args) == 0):
print "No argument given for -p";
return
preffile = args[carg]
carg += 1
else:
print "Unknown argument: " + arg
return
pass
if (debug_mem):
OpenIPMI.enable_debug_malloc()
pass
top = TopHandler(preffile, log_file, histfile)
# Detect if we need a separate OpenIPMI driver thread. See the
# openipmi_driver function above for the reason.
try:
import thread
try:
top.tk.getvar("tcl_platform", "threaded")
# Tcl is threaded, no need for another thread.
need_separate_openipmi_thread = False
except:
# Python is threaded, but Tcl is not. Need to run the
# OpenIPMI event loop in another thread.
need_separate_openipmi_thread = True
pass
pass
except:
# No thread support, can't use another thread.
need_separate_openipmi_thread = False
pass
if (need_separate_openipmi_thread):
if (verbosity >= 1):
print "Creating separate OpenIPMI event driver thread"
pass
OpenIPMI.init()
thread.start_new_thread(openipmi_driver, ())
pass
else:
if (verbosity >= 1):
print "Using TCL event loop, no threads"
pass
OpenIPMI.init_tcl()
pass
if (debug_rawmsg):
OpenIPMI.enable_debug_rawmsg()
pass
if (debug_msg):
OpenIPMI.enable_debug_msg()
pass
if (do_trace):
sys.settrace(trace)
pass
if (read_preffile):
_saveprefs.restore(preffile)
gui_cmdwin._HistoryRestore(histfile)
mainhandler = top
#.........这里部分代码省略.........