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


Python util.startup函数代码示例

本文整理汇总了Python中util.startup函数的典型用法代码示例。如果您正苦于以下问题:Python startup函数的具体用法?Python startup怎么用?Python startup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _test_addfiles

def _test_addfiles(browser):
    # Adds multiple files to the project.
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # Get path to  paraboloid file.
    paraboloidPath = pkg_resources.resource_filename("openmdao.examples.simple", "paraboloid.py")

    # Get path to optimization_unconstrained file.
    optPath = pkg_resources.resource_filename("openmdao.examples.simple", "optimization_unconstrained.py")

    # Add the files
    # would like to test adding multiple files but Selenium doesn't support it
    # workspace_page.add_files(paraboloidPath, optPath)
    workspace_page.add_file(paraboloidPath)
    workspace_page.add_file(optPath)

    # Check to make sure the files were added.
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    expected_file_names = ["optimization_unconstrained.py", "paraboloid.py"]
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'" % (expected_file_names, file_names)
        )

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:27,代码来源:test_workspace.py

示例2: _test_editfile

def _test_editfile(browser):
    # Check ability to open code editor by double clicking on file in workspace.
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # create a couple of files
    file1 = "test1.py"
    workspace_page.new_file(file1)
    file2 = "test2.py"
    workspace_page.new_file(file2)

    # verify file is opened in code editor by double clicking
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.edit_file(file1)
    eq(str(editor_page.get_tab_label()), "/" + file1)

    # verify different file is opened in code editor by double clicking
    browser.switch_to_window(workspace_window)
    editor_page = workspace_page.edit_file(file2)
    eq(str(editor_page.get_tab_label()), "/" + file2)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # verify code editor can be re-opened by double clicking on file
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.edit_file(file1)
    eq(str(editor_page.get_tab_label()), "/" + file1)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:35,代码来源:test_codeeditor.py

示例3: _test_drop_on_grid

def _test_drop_on_grid(browser):
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    #other tests also need to put an assembly on the grid, so put in seperate method
    put_assembly_on_grid(workspace_page)

    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:7,代码来源:test_dragdrop.py

示例4: _test_objtree

def _test_objtree(browser):
    # Toggles maxmimize/minimize button on assemblies.
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # Add maxmin.py to project
    file_path = pkg_resources.resource_filename("openmdao.gui.test.functional", "maxmin.py")
    workspace_page.add_file(file_path)

    # Add MaxMin to 'top'.
    workspace_page.show_dataflow("top")
    workspace_page.add_library_item_to_dataflow("maxmin.MaxMin", "maxmin")

    # Maximize 'top' and 'top.maxmin'
    visible = workspace_page.get_objects_attribute("path", True)
    eq(visible, ["top"])
    workspace_page.expand_object("top")
    time.sleep(0.5)
    visible = workspace_page.get_objects_attribute("path", True)
    eq(visible, ["top", "top.driver", "top.maxmin"])
    workspace_page.expand_object("top.maxmin")
    time.sleep(0.5)
    visible = workspace_page.get_objects_attribute("path", True)
    eq(visible, ["top", "top.driver", "top.maxmin", "top.maxmin.driver", "top.maxmin.sub"])

    workspace_page.add_library_item_to_dataflow("maxmin.MaxMin", "maxmin2")
    visible = workspace_page.get_objects_attribute("path", True)
    eq(visible, ["top", "top.driver", "top.maxmin", "top.maxmin.driver", "top.maxmin.sub", "top.maxmin2"])

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:30,代码来源:test_workspace.py

示例5: _test_remove_tla

def _test_remove_tla(browser):
    # verify that adding, removing, and adding a top level assembly works.
    project_dict, workspace_page = startup(browser)
    eq(len(workspace_page.get_dataflow_figures()), 1)

    # create a top assembly and check number of figures
    workspace_page.add_library_item_to_dataflow(
        'openmdao.main.assembly.Assembly', 'top1')
    eq(len(workspace_page.get_dataflow_figures()), 3)

    # add component to top assembly and check for additional figure
    workspace_page.add_library_item_to_dataflow(
                    'openmdao.lib.components.external_code.ExternalCode', 'ext',
                    target_name='top1')
    eq(len(workspace_page.get_dataflow_figures()), 4)

    # remove top and check that it and it's child figures are gone
    top = workspace_page.get_dataflow_figure('top1')
    top.remove()
    eq(len(workspace_page.get_dataflow_figures()), 1)

    # add a new top, verify on screen.
    workspace_page.add_library_item_to_dataflow(
        'openmdao.main.assembly.Assembly', 'top2')
    eq(len(workspace_page.get_dataflow_figures()), 3)

    # clean up
    closeout(project_dict, workspace_page)
开发者ID:hitej,项目名称:meta-core,代码行数:28,代码来源:test_dataflow.py

示例6: _test_crlf

def _test_crlf(browser):
    # Test ability to handle a file with Windows-style CR/LF line terminations
    project_dict, workspace_page = startup(browser)

    # add a Windows notepad generated python file
    filename = 'notepad.py'
    filepath = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                               'files/notepad.py')
    workspace_page.add_file(filepath)

    # open file in code editor
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.edit_file(filename)
    eq(str(editor_page.get_tab_label()), '/' + filename)

    # add a comment and save
    comment = '# a comment'
    editor_page.append_text_to_file(comment)
    editor_page.save_document()

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # re-open file and verify comment was successfully added
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.edit_file(filename)
    assert editor_page.get_code().endswith(comment)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:hitej,项目名称:meta-core,代码行数:35,代码来源:test_codeeditor.py

示例7: _test_remove

def _test_remove(browser):
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # Show assembly information.
    workspace_page.select_object("top")
    top = workspace_page.get_dataflow_figure("top", "")
    editor = top.editor_page(double_click=False)
    editor.move(-100, 100)  # Move it away from context menu.
    connections = top.connections_page()
    properties = top.properties_page()

    eq(editor.is_visible, True)
    eq(connections.is_visible, True)
    eq(properties.is_visible, True)

    # Remove component.
    top.remove()

    time.sleep(1)
    eq(editor.is_visible, False)
    eq(connections.is_visible, False)
    eq(properties.is_visible, False)

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:25,代码来源:test_workspace.py

示例8: _test_remove

def _test_remove(browser):
    project_dict, workspace_page = startup(browser)

    # Show assembly information.
    top = workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    workspace_page.select_object('top')
    workspace_page.show_dataflow('top')
    workspace_page.hide_left()

    # open various views on the top assembly
    top = workspace_page.get_dataflow_figure('top', '')
    editor = top.editor_page(double_click=False)
    editor.move(100, 200)
    connections = top.connections_page()
    properties = top.properties_page()

    eq(editor.is_visible, True)
    eq(connections.is_visible, True)
    eq(properties.is_visible, True)

    # Remove component.
    top.remove()

    # make sure all the views on the top assembly go away
    time.sleep(1)
    eq(editor.is_visible, False)
    eq(connections.is_visible, False)
    eq(properties.is_visible, False)

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:31,代码来源:test_workspace.py

示例9: _test_ordering

def _test_ordering(browser):
    # Verify that adding parameter to driver moves it ahead of target.
    project_dict, workspace_page = startup(browser)

    workspace_page.add_library_item_to_dataflow("openmdao.main.assembly.Assembly", "top")
    # Add ExternalCode and SLSQP.
    workspace_page.show_dataflow("top")
    ext = workspace_page.add_library_item_to_dataflow(
        "openmdao.lib.components.external_code.ExternalCode", "ext", prefix="top"
    )
    opt = workspace_page.add_library_item_to_dataflow(
        "openmdao.lib.drivers.slsqpdriver.SLSQPdriver", "opt", prefix="top"
    )

    # Add parameter to SLSQP.
    editor = opt.editor_page(base_type="Driver")
    editor("parameters_tab").click()
    editor.move(-100, -100)
    dialog = editor.new_parameter()
    dialog.target = "ext.timeout"
    dialog.low = "0"
    dialog.high = "1"
    dialog.name = "tmo"
    dialog("ok").click()

    # Check that SLSQP is above and to the left of ExternalCode
    ext = workspace_page.get_dataflow_figure("ext", "top")
    opt = workspace_page.get_dataflow_figure("opt", "top")
    assert ext.coords[0] > opt.coords[0]
    assert ext.coords[1] > opt.coords[1]

    # Clean up.
    editor.close()
    closeout(project_dict, workspace_page)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:34,代码来源:test_dataflow.py

示例10: _test_component_tree

def _test_component_tree(browser):
    project_dict, workspace_page = startup(browser)

    workspace_page.select_objects_view('Components')

    # Add maxmin.py to project
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/maxmin.py')
    workspace_page.add_file(file_path)

    # Add MaxMin to 'top'.
    workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    workspace_page.show_dataflow('top')
    workspace_page.add_library_item_to_dataflow('maxmin.MaxMin', 'maxmin')

    # Maximize 'top' and 'top.maxmin'
    visible = workspace_page.get_objects_attribute('path', True)
    eq(visible, ['top'])
    workspace_page.expand_object('top')
    time.sleep(0.5)
    visible = workspace_page.get_objects_attribute('path', True)
    eq(visible, ['top', 'top.driver', 'top.maxmin'])
    workspace_page.expand_object('top.maxmin')
    time.sleep(0.5)
    visible = workspace_page.get_objects_attribute('path', True)
    eq(visible, ['top', 'top.driver', 'top.maxmin',
                 'top.maxmin.driver', 'top.maxmin.sub'])

    workspace_page.add_library_item_to_dataflow('maxmin.MaxMin', 'maxmin2')
    visible = workspace_page.get_objects_attribute('path', True)
    eq(visible, ['top', 'top.driver', 'top.maxmin',
                 'top.maxmin.driver', 'top.maxmin.sub', 'top.maxmin2'])

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:35,代码来源:test_workspace.py

示例11: _test_parameter_auto

def _test_parameter_auto(browser):
    # Test auto-filling the min and max for a parameter.
    project_dict, workspace_page = startup(browser)

    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/connect.py')
    workspace_page.add_file(file_path)

    workspace_page.add_library_item_to_dataflow('connect.Conn_Assy',
                                                'top')
    # Add parameter to driver.
    driver = workspace_page.get_dataflow_figure('driver', 'top')
    editor = driver.editor_page(base_type='Driver')
    editor('parameters_tab').click()
    dialog = editor.new_parameter()
    dialog.target = 'comp.x'
    dialog('ok').click()

    parameters = editor.get_parameters()
    expected = [['', 'comp.x', '0', '299', '1', '0', '', 'comp.x']]
    eq(len(parameters.value), len(expected))
    for i, row in enumerate(parameters.value):
        eq(row, expected[i])

    editor.close()

    closeout(project_dict, workspace_page)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:27,代码来源:test_workflow.py

示例12: _test_loading_docs

def _test_loading_docs(browser):
    project_dict, workspace_page = startup(browser)

    # Check that the docs are viewable
    workspace_page('help_menu').click()
    time.sleep(0.5)
    eq(workspace_page('doc_button').get_attribute('id'), 'help-doc')

    workspace_window = browser.current_window_handle
    current_windows = set(browser.window_handles)
    workspace_page('doc_button').click()
    new_windows = set(browser.window_handles) - current_windows
    docs_window = list(new_windows)[0]
    browser.switch_to_window(docs_window)
    time.sleep(0.5)
    eq("OpenMDAO User Guide" in browser.title, True)
    eq("OpenMDAO Documentation" in browser.title, True)

    browser.close()
    browser.switch_to_window(workspace_window)
    workspace_page.show_library()
    browser.switch_to_window(workspace_page.view_library_item_docs("openmdao.main.assembly.Assembly"))

    # Just check to see if a Traceback 404 message was sent.
    try:
        browser.find_element((By.XPATH, "/html/head/body/pre[1]"))
        assert False
    except:
        pass
    browser.close()
    browser.switch_to_window(workspace_window)
    closeout(project_dict, workspace_page)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:32,代码来源:test_workspace.py

示例13: _test_drop_on_component_editor_grid

def _test_drop_on_component_editor_grid(browser):
    project_dict, workspace_page = startup(browser)

    workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    top = workspace_page.get_dataflow_figure('top', '')

    workspace_page.set_library_filter('Assembly')   # put Assembly at top of lib
    assembly = workspace_page.find_library_button('Assembly')

    editor = top.editor_page(double_click=False, base_type='Assembly')
    editor.show_dataflow()

    editor_top = workspace_page.get_dataflow_fig_in_globals('top')

    # sort through these to find the correct 'top'

    chain = ActionChains(browser)
    chain.click_and_hold(assembly)
    chain.move_to_element(editor_top('header').find_element_by_xpath("..")).perform()
    chain.move_by_offset(200, 1).perform()
    chain.release(None).perform()

    # don't bother checking to see if it appeared,
    # the UI box will appear and screw the test if it did

    closeout(project_dict, workspace_page)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:26,代码来源:test_dragdrop.py

示例14: _test_update

def _test_update(browser):
    # Adding a parameter to a driver should update the driver's workflow.
    project_dict, workspace_page = startup(browser)

    # Create model with CONMIN and ExecComp.
    workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    workspace_page.show_dataflow('top')
    workspace_page.replace_driver('top', 'CONMINdriver')
    workspace_page.add_library_item_to_dataflow(
        'openmdao.test.execcomp.ExecComp', 'exe', args=["('z = x * y',)"])

    # Add parameter to CONMIN.
    driver = workspace_page.get_dataflow_figure('driver', 'top')
    editor = driver.editor_page(base_type='Driver')
    editor('parameters_tab').click()
    dialog = editor.new_parameter()
    dialog.target = 'exe.x'
    dialog.low = '-1'
    dialog.high = '1'
    dialog('ok').click()
    editor.close()

    # Verify workflow contains ExecComp.
    workspace_page('workflow_tab').click()
    eq(len(workspace_page.get_workflow_figures()), 1)
    eq(len(workspace_page.get_workflow_component_figures()), 2)

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:29,代码来源:test_workflow.py

示例15: _test_remove

def _test_remove(browser):
    #projects_page, project_info_page, project_dict, workspace_page = startup(browser)
    project_dict, workspace_page = startup(browser)

    # Show assembly information.
    # Lots of futzing here to handle short screens (EC2 Windows).
    workspace_page.select_object('top')
    workspace_page.show_dataflow('top')
    workspace_page.hide_left()
    top = workspace_page.get_dataflow_figure('top', '')
    editor = top.editor_page(double_click=False)
    editor.move(100, 200)
    connections = top.connections_page()
    properties = top.properties_page()

    eq(editor.is_visible, True)
    eq(connections.is_visible, True)
    eq(properties.is_visible, True)

    # Remove component.
    top.remove()

    time.sleep(1)
    eq(editor.is_visible, False)
    eq(connections.is_visible, False)
    eq(properties.is_visible, False)

    # Clean up.
    # closeout(projects_page, project_info_page, project_dict, workspace_page)
    closeout(project_dict, workspace_page)
开发者ID:akhi28,项目名称:OpenMDAO-Framework,代码行数:30,代码来源:test_workspace.py


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