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


Python RootTask.build_from_config方法代碼示例

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


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

示例1: build_task_from_config

# 需要導入模塊: from hqc_meas.tasks.api import RootTask [as 別名]
# 或者: from hqc_meas.tasks.api.RootTask import build_from_config [as 別名]
def build_task_from_config(config, dep_source, root=False):
    """ Rebuild a task hierarchy from a Section.

    Parameters
    ----------
    config : Section
        Section representing the task hierarchy.

    dep_source :
        Source of the build dependencies of the hierarchy. This can either
        be the instance of the TaskManager of a dict of dependencies.

    Returns
    -------
    task :
        Newly built task.

    """
    if not isinstance(dep_source, dict):
        core = dep_source.workbench.get_plugin('enaml.workbench.core')
        cmd = 'hqc_meas.dependencies.collect_build_dep_from_config'
        dep_source = core.invoke_command(cmd, {'config': config})
        if isinstance(dep_source, Exception):
            return None

    if root:
        return RootTask.build_from_config(config, dep_source)
    else:
        task_class = dep_source['tasks'][config.pop('task_class')]
        return task_class.build_from_config(config, dep_source)
開發者ID:PhilipVinc,項目名稱:HQCMeas,代碼行數:32,代碼來源:building.py

示例2: test_build_from_config1

# 需要導入模塊: from hqc_meas.tasks.api import RootTask [as 別名]
# 或者: from hqc_meas.tasks.api.RootTask import build_from_config [as 別名]
 def test_build_from_config1(self):
     # Test building a interfaceable task from a config.
     aux = RootTask()
     aux.children_task = [IMixin()]
     bis = RootTask.build_from_config(aux.task_preferences,
                                      {'tasks': {'IMixin': IMixin,
                                                 'RootTask': RootTask}})
     assert_equal(type(bis.children_task[0]).__name__, 'IMixin')
開發者ID:MatthieuDartiailh,項目名稱:HQCMeas,代碼行數:10,代碼來源:test_task_interfaces.py

示例3: build_root

# 需要導入模塊: from hqc_meas.tasks.api import RootTask [as 別名]
# 或者: from hqc_meas.tasks.api.RootTask import build_from_config [as 別名]
def build_root(manager, mode, config=None, parent_ui=None, build_dep=None):
    """ Create a new RootTask.

    Parameters
    ----------
    manager : TaskManagerPlugin
        Instance of the current task manager plugin.

    mode : {'from config', 'from template', 'from file'}
        Whether to use the given config, or look for one in templates or a
        file.

    config : configobj.Section
        Object holding the informations necessary to build the root task.

    parent_ui : optional
        Optional parent widget for the dialog.

    build_dep : optional
        Optionnal dict containing the build dependencies.

    Returns:
    -------
    task : RootTask

    """
    if mode == 'from config':
        pass

    elif mode == 'from file':
        path = FileDialogEx.get_open_file_name(parent=parent_ui,
                                               name_filters=['*.ini'])
        config, _ = load_template(path)

    elif mode == 'from template':
        view = TemplateSelectorView(parent=parent_ui, manager=manager)
        result = view.exec_()
        if result:
            path = view.path
        config, _ = load_template(path)

    if config:
        if build_dep is None:
            core = manager.workbench.get_plugin('enaml.workbench.core')
            cmd = 'hqc_meas.dependencies.collect_build_dep_from_config'
            build_dep = core.invoke_command(cmd, {'config': config})
        if isinstance(build_dep, Exception):
            return None

        config.pop('task_class')
        return RootTask.build_from_config(config, build_dep)
開發者ID:PhilipVinc,項目名稱:HQCMeas,代碼行數:53,代碼來源:building.py


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