예제 #1
0
def construct(path):
    from bowtie import Layout
    layout = Layout(directory=path)
    layout.add_sidebar(freq_slider)
    layout.add(sine_plot)
    layout.subscribe(listener, freq_slider.on_change)
    layout.build()
예제 #2
0
def test_components(chrome_driver, build_path):
    """Tests plotly."""

    layout = Layout(rows=len(visuals), directory=build_path)
    for controller in controllers:
        layout.add_sidebar(controller)

    for vis in visuals:
        layout.add(vis)
    layout.build()

    env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(),
                                       os.environ.get('PYTHONPATH', ''))
    server = subprocess.Popen(os.path.join(build_path, 'src/server.py'),
                              env=env)

    time.sleep(5)

    chrome_driver.get('http://localhost:9991')
    chrome_driver.implicitly_wait(5)

    logs = chrome_driver.get_log('browser')
    for log in logs:
        if log['level'] == 'SEVERE':
            raise Exception(log['message'])

    server.kill()
예제 #3
0
def test_plotly(remove_build):
    """Tests plotly."""
    viz = Plotly()
    ctrl = Nouislider()
    ctrl2 = Button()

    path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'build')
    layout = Layout(directory=path)
    layout.add(viz)
    layout.add_sidebar(ctrl)
    layout.add_sidebar(ctrl2)
    layout.subscribe(callback, ctrl.on_change)
    layout.subscribe(callback, ctrl2.on_click)
    layout.build()

    env = os.environ
    env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(),
                                       os.environ.get('PYTHONPATH', ''))
    server = subprocess.Popen(os.path.join(path, 'src/server.py'), env=env)
    time.sleep(5)

    driver = PhantomJS()
    driver.get('http://localhost:9991')

    assert driver.title == 'Bowtie App'

    server.kill()
예제 #4
0
def test_plotly(chrome_driver, build_path):
    """Tests plotly."""

    layout = Layout(directory=build_path)
    layout.add(viz)
    layout.add_sidebar(ctrl)
    layout.add_sidebar(ctrl2)
    layout.subscribe(callback, ctrl.on_change)
    layout.subscribe(callback, ctrl2.on_click)
    layout.build()

    env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(), os.environ.get('PYTHONPATH', ''))
    server = subprocess.Popen(os.path.join(build_path, 'src/server.py'), env=env)

    time.sleep(5)

    chrome_driver.get('http://localhost:9991')
    chrome_driver.implicitly_wait(5)

    assert chrome_driver.title == 'Bowtie App'

    button = chrome_driver.find_element_by_class_name('ant-btn')
    button.click()

    points = chrome_driver.find_elements_by_class_name('point')

    assert len(points) == 4

    server.kill()
예제 #5
0
def construct():
    from bowtie import Layout
    layout = Layout(debug=True)
    layout.add_sidebar(sigma)
    layout.add(mainplot)
    layout.schedule(0.1, walk)

    layout.build()
예제 #6
0
def build():
    layout = Layout(debug=False)
    layout.add(mark)
    layout.add_sidebar(sidemark)
    layout.add_sidebar(text)

    layout.subscribe(write, text.on_change)

    layout.build()
예제 #7
0
def test_build(remove_build):
    """Tests the build process."""
    ctrl = Nouislider()
    viz = Plotly()

    path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'build')
    layout = Layout(directory=path)
    layout.add_sidebar(ctrl)
    layout.add(viz)
    layout.subscribe(callback, ctrl.on_change)
    layout.build()
예제 #8
0
def test_build(build_path):
    """Tests the build process."""
    reset_uuid()
    ctrl = Nouislider()
    viz = Plotly()

    layout = Layout(directory=build_path)
    layout.add_sidebar(ctrl)
    layout.add(viz)
    layout.subscribe(callback, ctrl.on_change)
    layout.build()
예제 #9
0
def construct(path):
    from bowtie import Layout
    description = """
Iris K-means clustering
===========
 

"""
    layout = Layout(description=description, background_color='LightGrey', debug=False)
    layout.add_sidebar(clslider)
    layout.add_sidebar(xdown)
    layout.add_sidebar(ydown)
    
    layout.add(kplot)

    layout.subscribe(Kplot, xdown.on_change, ydown.on_change, clslider.on_change)
   
    layout.build()
예제 #10
0
def test_markdown(chrome_driver, build_path):
    """Test markdown and text widgets."""
    layout = Layout(directory=build_path)
    layout.add(mark)
    layout.add_sidebar(side)
    layout.add_sidebar(text)
    layout.subscribe(write, text.on_change)
    layout.build()


    env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(), os.environ.get('PYTHONPATH', ''))
    server = subprocess.Popen(os.path.join(build_path, 'src/server.py'), env=env)

    time.sleep(5)

    chrome_driver.get('http://*****:*****@style='grid-area: 1 / 2 / 2 / 3; position: relative;']"
    )

    assert 'top' in output.text
    assert 'middle' in output.text
    assert 'link' in output.text

    txtctrl.send_keys('apple')
    time.sleep(1)

    assert 'apple' in output.text

    txtctrl.send_keys('banana')
    time.sleep(1)

    assert 'apple' in output.text
    assert 'banana' in output.text

    server.kill()