• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python _tools.store_exceptions_on_all_threads函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_progress_column

def test_progress_column():
    from traitsui.extras.progress_column import ProgressColumn
    progress_view = View(
        Item(
            'values',
            show_label=False,
            editor=TableEditor(
                columns=[
                    ObjectColumn(name='value'),
                    ProgressColumn(name='other_value'),
                ],
            )
        ),
        buttons=['OK'],
    )
    gui = GUI()
    object_list = ObjectList(
        values=[ListItem(value=str(i**2)) for i in range(10)]
    )

    with store_exceptions_on_all_threads():
        ui = object_list.edit_traits(view=progress_view)
        gui.process_events()
        press_ok_button(ui)
        gui.process_events()
开发者ID:bergtholdt,项目名称:traitsui,代码行数:25,代码来源:test_table_editor.py


示例2: test_data_frame_editor_multi_select

def test_data_frame_editor_multi_select():
    view = View(Item('data', editor=DataFrameEditor(multi_select=True),
                width=400))
    viewer = sample_data()
    with store_exceptions_on_all_threads():
        ui = viewer.edit_traits(view=view)
        ui.dispose()
开发者ID:bergtholdt,项目名称:traitsui,代码行数:7,代码来源:test_data_frame_editor.py


示例3: test_selection_listener_disconnected

def test_selection_listener_disconnected():
    """ Check that selection listeners get correctly disconnected """
    from pyface.api import GUI
    from pyface.qt.QtGui import QApplication, QItemSelectionModel
    from pyface.ui.qt4.util.event_loop_helper import EventLoopHelper
    from pyface.ui.qt4.util.testing import event_loop

    obj = ListStrEditorWithSelectedIndex(values=['value1', 'value2'])

    with store_exceptions_on_all_threads():
        qt_app = QApplication.instance()
        if qt_app is None:
            qt_app = QApplication([])
        helper = EventLoopHelper(gui=GUI(), qt_app=qt_app)

        # open the UI and run until the dialog is closed
        ui = obj.edit_traits(view=single_select_item_view)
        with helper.delete_widget(ui.control):
            press_ok_button(ui)

        # now run again and change the selection
        ui = obj.edit_traits(view=single_select_item_view)
        with event_loop():
            editor = ui.get_editors('values')[0]

            list_view = editor.list_view
            mi = editor.model.index(1)
            list_view.selectionModel().select(mi, QItemSelectionModel.ClearAndSelect)

    obj.selected = 'value2'
开发者ID:jonathanrocher,项目名称:traitsui,代码行数:30,代码来源:test_liststr_editor_selection.py


示例4: test_table_editor_select_cells

def test_table_editor_select_cells():
    gui = GUI()
    object_list = ObjectListWithSelection(
        values=[ListItem(value=str(i**2)) for i in range(10)]
    )
    object_list.selected_cells = [
        (object_list.values[5], 'value'),
        (object_list.values[6], 'other value'),
        (object_list.values[8], 'value'),
    ]

    with store_exceptions_on_all_threads():
        ui = object_list.edit_traits(view=select_cells_view)
        editor = ui.get_editors('values')[0]
        gui.process_events()
        if is_current_backend_qt4():
            selected = editor.selected
        elif is_current_backend_wx():
            selected = editor.selected_cells

        press_ok_button(ui)
        gui.process_events()

    assert selected == [
        (object_list.values[5], 'value'),
        (object_list.values[6], 'other value'),
        (object_list.values[8], 'value'),
    ]
开发者ID:enthought,项目名称:traitsui,代码行数:28,代码来源:test_table_editor.py


示例5: _test_tree_node_object_releases_listeners

    def _test_tree_node_object_releases_listeners(self, hide_root, nodes=None,
                                                  trait='bogus_list',
                                                  expected_listeners=1):
        """ The TreeEditor should release the listener to the root node's children
        when it's disposed of.
        """

        with store_exceptions_on_all_threads():
            bogus = BogusTreeNodeObject(bogus_list=[BogusTreeNodeObject()])
            tree_editor_view = BogusTreeNodeObjectView(
                bogus=bogus,
                hide_root=hide_root,
                nodes=nodes,
            )
            ui = tree_editor_view.edit_traits()

            # The TreeEditor sets a listener on the bogus object's
            # children list
            notifiers_list = bogus.trait(trait)._notifiers(False)
            self.assertEqual(expected_listeners, len(notifiers_list))

            # Manually close the UI
            press_ok_button(ui)

            # The listener should be removed after the UI has been closed
            notifiers_list = bogus.trait(trait)._notifiers(False)
            self.assertEqual(0, len(notifiers_list))
开发者ID:enthought,项目名称:traitsui,代码行数:27,代码来源:test_tree_editor.py


示例6: test_styles

 def test_styles(self):
     # simple smoke test of buttons
     gui = GUI()
     button_text_edit = ButtonTextEdit()
     with store_exceptions_on_all_threads():
         ui = button_text_edit.edit_traits()
         self.addCleanup(ui.dispose)
         gui.process_events()
开发者ID:bergtholdt,项目名称:traitsui,代码行数:8,代码来源:test_button_editor.py


示例7: test_table_editor

def test_table_editor():
    gui = GUI()
    object_list = ObjectList(values=[ListItem(value=str(i ** 2)) for i in range(10)])

    with store_exceptions_on_all_threads():
        ui = object_list.edit_traits(view=simple_view)
        gui.process_events()
        press_ok_button(ui)
        gui.process_events()
开发者ID:bergtholdt,项目名称:traitsui,代码行数:9,代码来源:test_table_editor.py


示例8: test_simple_editor_parent_closed

def test_simple_editor_parent_closed():
    with store_exceptions_on_all_threads():
        obj = NonmodalInstanceEditor()
        ui = obj.edit_traits()
        editor = ui.get_editors('inst')[0]

        # make the dialog appear
        editor._button.click()

        # close the main ui
        press_ok_button(ui)
开发者ID:bergtholdt,项目名称:traitsui,代码行数:11,代码来源:test_instance_editor.py


示例9: test_color_column

    def test_color_column(self):
        # Behaviour: column ui should display without error

        with store_exceptions_on_all_threads():
            d1 = MyEntry(name='a', value=2, color=(1.0, 0.3, 0.1))
            d2 = MyEntry(name='b', value=3, color=(0.1, 0.0, 0.9))
            data = MyData(data_list=[d1, d2])

            ui = data.edit_traits()

            ui.dispose()
开发者ID:robmcmullen,项目名称:traitsui,代码行数:11,代码来源:test_color_column.py


示例10: test_data_frame_editor_alternate_adapter

def test_data_frame_editor_alternate_adapter():
    class AlternateAdapter(DataFrameAdapter):
        pass

    alternate_adapter_view = View(
        Item('data', editor=DataFrameEditor(adapter=AlternateAdapter()),
                width=400)
    )
    viewer = sample_data()
    with store_exceptions_on_all_threads():
        ui = viewer.edit_traits(view=alternate_adapter_view)
        ui.dispose()
开发者ID:robmcmullen,项目名称:traitsui,代码行数:12,代码来源:test_data_frame_editor.py


示例11: test_data_frame_editor_with_refresh

def test_data_frame_editor_with_refresh():
    class DataFrameViewer(HasTraits):
        data = Instance(DataFrame)
        df_updated = Event
        view = View(
            Item('data', editor=DataFrameEditor())
        )

    df = DataFrame(DATA, index=['one', 'two', 'three', 'four'],
                   columns=['X', 'Y', 'Z'])
    viewer = DataFrameViewer(data=df)
    with store_exceptions_on_all_threads():
        ui = viewer.edit_traits()
        viewer.df_updated = True
        ui.dispose()
开发者ID:robmcmullen,项目名称:traitsui,代码行数:15,代码来源:test_data_frame_editor.py


示例12: check_button_text_update

    def check_button_text_update(self, view):
        gui = GUI()
        button_text_edit = ButtonTextEdit()

        with store_exceptions_on_all_threads():
            ui = button_text_edit.edit_traits(view=view)
            self.addCleanup(ui.dispose)

            gui.process_events()
            editor, = ui.get_editors("play_button")
            button = editor.control

            self.assertEqual(get_button_text(button), "I'm a play button")

            button_text_edit.play_button_label = "New Label"
            self.assertEqual(get_button_text(button), "New Label")
开发者ID:bergtholdt,项目名称:traitsui,代码行数:16,代码来源:test_button_editor.py


示例13: test_filtered_table_editor

def test_filtered_table_editor():
    gui = GUI()
    object_list = ObjectListWithSelection(
        values=[ListItem(value=str(i**2)) for i in range(10)]
    )

    with store_exceptions_on_all_threads():
        ui = object_list.edit_traits(view=filtered_view)
        gui.process_events()

        filter = ui.get_editors('values')[0].filter

        press_ok_button(ui)
        gui.process_events()

    assert filter is not None
开发者ID:enthought,项目名称:traitsui,代码行数:16,代码来源:test_table_editor.py


示例14: check_enum_text_update

    def check_enum_text_update(self, view):
        gui = GUI()
        enum_edit = EnumModel()

        with store_exceptions_on_all_threads():
            ui = enum_edit.edit_traits(view=view)
            self.addCleanup(ui.dispose)

            gui.process_events()
            editor = ui.get_editors("value")[0]
            combobox = editor.control

            self.assertEqual(get_combobox_text(combobox), "one")

            enum_edit.value = "two"
            gui.process_events()

            self.assertEqual(get_combobox_text(combobox), "two")
开发者ID:enthought,项目名称:traitsui,代码行数:18,代码来源:test_enum_editor.py


示例15: test_table_editor_select_column_index

def test_table_editor_select_column_index():
    gui = GUI()
    object_list = ObjectListWithSelection(
        values=[ListItem(value=str(i**2)) for i in range(10)]
    )
    object_list.selected_index = 1

    with store_exceptions_on_all_threads():
        ui = object_list.edit_traits(view=select_column_index_view)
        editor = ui.get_editors('values')[0]
        gui.process_events()
        if is_current_backend_qt4():
            selected = editor.selected_indices
        elif is_current_backend_wx():
            selected = editor.selected_column_index

        press_ok_button(ui)
        gui.process_events()

    assert selected == 1
开发者ID:enthought,项目名称:traitsui,代码行数:20,代码来源:test_table_editor.py


示例16: test_wx_list_str_selected_index

def test_wx_list_str_selected_index():
    # behavior: when starting up, the

    with store_exceptions_on_all_threads():
        obj = ListStrEditorWithSelectedIndex(
            values=['value1', 'value2'],
            selected_index=1)
        ui = obj.edit_traits(view=single_select_view)

        # the following is equivalent to setting the text in the text control,
        # then pressing OK

        liststrctrl = ui.control.FindWindowByName('listCtrl')
        selected_1 = get_selected(liststrctrl)

        obj.selected_index = 0
        selected_2 = get_selected(liststrctrl)

        # press the OK button and close the dialog
        press_ok_button(ui)

    # the number traits should be between 3 and 8
    assert selected_1 == [1]
    assert selected_2 == [0]
开发者ID:jonathanrocher,项目名称:traitsui,代码行数:24,代码来源:test_liststr_editor_selection.py


示例17: test_data_frame_editor_numerical_index

def test_data_frame_editor_numerical_index():
    viewer = sample_data_numerical_index()
    with store_exceptions_on_all_threads():
        ui = viewer.edit_traits()
        ui.dispose()
开发者ID:robmcmullen,项目名称:traitsui,代码行数:5,代码来源:test_data_frame_editor.py


示例18: test_data_frame_editor_font_mapping

def test_data_frame_editor_font_mapping():
    viewer = sample_data()
    with store_exceptions_on_all_threads():
        ui = viewer.edit_traits(view=font_mapping_view)
        ui.dispose()
开发者ID:robmcmullen,项目名称:traitsui,代码行数:5,代码来源:test_data_frame_editor.py


示例19: test_data_frame_editor_columns

def test_data_frame_editor_columns():
    viewer = sample_data()
    with store_exceptions_on_all_threads():
        ui = viewer.edit_traits(view=columns_view)
        ui.dispose()
开发者ID:robmcmullen,项目名称:traitsui,代码行数:5,代码来源:test_data_frame_editor.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python data_frame_editor.DataFrameAdapter类代码示例发布时间:2022-05-27
下一篇:
Python clipboard.PyMimeData类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap