當前位置: 首頁>>代碼示例>>Python>>正文


Python HardwareRepository.connect方法代碼示例

本文整理匯總了Python中HardwareRepository.HardwareRepository.connect方法的典型用法代碼示例。如果您正苦於以下問題:Python HardwareRepository.connect方法的具體用法?Python HardwareRepository.connect怎麽用?Python HardwareRepository.connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HardwareRepository.HardwareRepository的用法示例。


在下文中一共展示了HardwareRepository.connect方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setLogFile

# 需要導入模塊: from HardwareRepository import HardwareRepository [as 別名]
# 或者: from HardwareRepository.HardwareRepository import connect [as 別名]
# this line important for socketio msg, otherwise no msg is sent...
socketio.init_app(app)

# the following test prevents Flask from initializing twice
# (because of the Reloader)
if not app.debug or os.environ.get("WERKZEUG_RUN_MAIN") == "true":
    ###Initialization of the HardwareObjects
    # this is to allow Hardware Objects to do
    # 'from HardwareRepository import ...'
    sys.path.insert(0, os.path.dirname(__file__))
    from HardwareRepository import HardwareRepository as hwr, setLogFile
    hwr.addHardwareObjectsDirs([os.path.join(os.path.dirname(__file__), 'HardwareObjects')])

    hwr_directory = cmdline_options.hwr_directory
    hwr = hwr.HardwareRepository(os.path.abspath(os.path.expanduser(hwr_directory)))
    hwr.connect()
    log_file = cmdline_options.log_file
    if log_file:
        setLogFile(log_file)

    # installs logging handler to send messages to clients
    import logging_handler
    root_logger = logging.getLogger()
    root_logger.setLevel(logging.DEBUG)
    custom_log_handler = logging_handler.MX3LoggingHandler()
    custom_log_handler.setLevel(logging.DEBUG)
    root_logger.addHandler(custom_log_handler)
    hwr_logger = logging.getLogger("HWR")
    user_logger = logging.getLogger("user_level_log")
    queue_logger = logging.getLogger("queue_exec")
#    hwr_logger.addHandler(custom_log_handler)
開發者ID:JieNanMAXIV,項目名稱:mxcube3,代碼行數:33,代碼來源:__init__.py


注:本文中的HardwareRepository.HardwareRepository.connect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。