当前位置: 首页>>代码示例>>Python>>正文


Python OpenIPMI.add_domain_change_handler方法代码示例

本文整理汇总了Python中OpenIPMI.add_domain_change_handler方法的典型用法代码示例。如果您正苦于以下问题:Python OpenIPMI.add_domain_change_handler方法的具体用法?Python OpenIPMI.add_domain_change_handler怎么用?Python OpenIPMI.add_domain_change_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenIPMI的用法示例。


在下文中一共展示了OpenIPMI.add_domain_change_handler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import add_domain_change_handler [as 别名]

#.........这里部分代码省略.........
        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

    OpenIPMI.add_domain_change_handler(_domain.DomainWatcher(mainhandler))

    mainhandler.debug_mem = debug_mem
    top.title('OpenIPMI GUI')

    ui = gui.IPMIGUI(top, mainhandler)
    mainhandler.SetUI(ui)

    OpenIPMI.add_domain_change_handler(mainhandler)
    OpenIPMI.set_log_handler(mainhandler)

    _domain.RestoreDomains(mainhandler)

    OpenIPMI.set_cmdlang_event_handler(CmdlangEventHandler(mainhandler))

    top.mainloop()

    mainhandler.quit()
开发者ID:sharkconi,项目名称:openipmi,代码行数:104,代码来源:openipmigui.py


注:本文中的OpenIPMI.add_domain_change_handler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。