class TableTest(HasTraits):

    #-------------------------------------------------------------------------
    #  Trait definitions:
    #-------------------------------------------------------------------------

    colors = List(Thingy)

    table_editor = TableEditor(
        columns=[ColorColumn(name='color'), ],
        editable=True,
        deletable=True,
        sortable=True,  #
        sort_model=True,
        show_lines=True,  #
        orientation='vertical',
        show_column_labels=True,  #
        row_factory=Thingy)

    traits_view = View(
        [Item(
            'colors', id='colors', editor=table_editor), '|[]<>'],
        title='Table Editor Test',
        id='traitsui.tests.table_editor_color_test',
        dock='horizontal',
        width=.4,
        height=.3,
        resizable=True,
        kind='live')
Ejemplo n.º 2
0
from traitsui.tests._tools import skip_if_null, store_exceptions_on_all_threads


class MyEntry(HasTraits):
    name = Str()
    value = Int(0)
    color = RGBColor()

    entry_view = View(Group(Item('name'), Item('value'), Item('color')))


my_editor = TableEditor(
    columns=[
        ObjectColumn(name='name'),
        ObjectColumn(name='value'),
        ColorColumn(name='color', style='readonly')
    ],
    orientation='vertical',
    show_toolbar=True,
    row_factory=MyEntry,
)


class MyData(HasTraits):
    data_list = List(MyEntry)

    view = View(Item('data_list', editor=my_editor, show_label=False), )


class TestColorColumn(TestCase):
    @skip_if_null
Ejemplo n.º 3
0
)


class MyEntry(HasTraits):
    name = Str()
    value = Int(0)
    color = RGBColor()

    entry_view = View(Group(Item("name"), Item("value"), Item("color")))


my_editor = TableEditor(
    columns=[
        ObjectColumn(name="name"),
        ObjectColumn(name="value"),
        ColorColumn(name="color", style="readonly"),
    ],
    orientation="vertical",
    show_toolbar=True,
    row_factory=MyEntry,
)


class MyData(HasTraits):
    data_list = List(MyEntry)

    view = View(Item("data_list", editor=my_editor, show_label=False))


class TestColorColumn(BaseTestMixin, TestCase):
    def setUp(self):
Ejemplo n.º 4
0
import numpy as np
from dsi2.volumes.scalar_volume import ScalarVolume
from dsi2.streamlines.track_dataset import TrackDataset

import cPickle as pickle

ltpa_result_table = TableEditor(
    columns=[
        ObjectColumn(name="name"),
        CheckboxColumn(name="visible"),
        ObjectColumn(name="coord_opacity"),
        ObjectColumn(name="tracksA_opacity"),
        CheckboxColumn(name="tracksA_visible"),
        ObjectColumn(name="tracksB_opacity"),
        CheckboxColumn(name="tracksB_visible"),
        ColorColumn(name="colorA", width=5),
        ColorColumn(name="colorB", width=5),
        ObjectColumn(name="coord_shape"),
        ObjectColumn(name="coord_radius"),
    ],
    auto_size=False,
)


class CoordinatesGraphic(HasTraits):
    # Data
    scalars = Array
    indices = Array

    radius = CFloat(0.5)