예제 #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_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()
예제 #3
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()
예제 #4
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()
예제 #5
0
def test_build(remove_build):
    ctrl = Nouislider()
    viz = Plotly()

    layout = Layout()
    layout.add_controller(ctrl)
    layout.add_visual(viz)
    layout.subscribe(ctrl.on_change, callback)
    layout.build()
예제 #6
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()
예제 #7
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()
예제 #8
0
def build():
    layout = Layout(rows=2, columns=2, sidebar=False, debug=False)

    layout.columns[1].pixels(100)
    layout.rows[0].pixels(40)

    layout.add(talk, row_start=0, column_start=0)
    layout.add(click, row_start=0, column_start=1)
    layout.add(chat, row_start=1, column_start=0, row_end=1, column_end=1)

    layout.load(update_chat)

    layout.subscribe(entered, talk.on_enter)
    layout.subscribe(clicked, click.on_click)
    layout.schedule(5, update_chat)

    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()
예제 #11
0
def construct(path):
    from bowtie import Layout
    description = """
Bowtie Demo
===========

Demonstrates interactive elements with the iris dataset.
Select some attributes to plot and select some data on the 2d plot.
Change the alpha parameter to see how that affects the model.
"""
    layout = Layout(description=description,
                    background_color='PaleTurquoise',
                    debug=False)
    layout.add_controller(xdown)
    layout.add_controller(ydown)
    layout.add_controller(zdown)
    layout.add_controller(alphaslider)
    layout.add_visual(mainplot)
    layout.add_visual(mplot3)
    layout.add_visual(linear, next_row=True)
    layout.add_visual(table1)

    layout.subscribe(pairplot, xdown.on_change, ydown.on_change)
    layout.subscribe(threeplot, xdown.on_change, ydown.on_change,
                     zdown.on_change)
    layout.subscribe(mainregress, mainplot.on_select, alphaslider.on_change)

    layout.build()