├── .coveragerc ├── .flake8 ├── .gitattributes ├── .github ├── actions │ └── install-qt-support │ │ ├── README.md │ │ └── action.yml ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── basic-tests.yml │ ├── bleeding-edge-tests.yml │ ├── full-qt-tests.yml │ ├── full-wx-tests.yml │ ├── integration-tests.yml │ ├── minimal-deps-tests.yml │ ├── publish-on-pypi.yml │ ├── style-checks.yml │ ├── test-build-documentation.yml │ ├── test-etsdemo.yml │ ├── test-with-edm.yml │ └── test-with-pip-wx.yml ├── .gitignore ├── .readthedocs.yaml ├── CHANGES.txt ├── LICENSE.txt ├── MANIFEST.in ├── README.rst ├── README_example.png ├── ci-src-requirements.txt ├── doc-requirements.txt ├── docs ├── Makefile ├── README.rst ├── api.css ├── make.bat ├── releases │ └── README.rst ├── source │ ├── _static │ │ ├── default.css │ │ ├── e-logo-rev.jpg │ │ └── et.png │ ├── _templates │ │ ├── layout.html │ │ └── search.html │ ├── api │ │ └── index.rst │ ├── changelog.rst │ ├── conf.py │ ├── demos │ │ └── index.rst │ ├── e-logo-rev.png │ ├── index.rst │ ├── traitsui_dev_guide │ │ ├── index.rst │ │ └── testing.rst │ ├── traitsui_user_manual │ │ ├── adapters.rst │ │ ├── advanced_view.rst │ │ ├── custom_view.rst │ │ ├── examples │ │ │ ├── configure_traits_view.py │ │ │ ├── configure_traits_view_buttons.py │ │ │ ├── configure_traits_view_group.py │ │ │ ├── default_trait_editors.py │ │ │ ├── default_traits_view.py │ │ │ ├── default_traits_view2.py │ │ │ ├── enum_editor.py │ │ │ ├── handler_override.py │ │ │ ├── instance_editor_selection.py │ │ │ ├── key_bindings.py │ │ │ ├── mixed_styles.py │ │ │ ├── multi_object_view.py │ │ │ ├── multiple_views.py │ │ │ ├── tree_editor.py │ │ │ └── wizard.py │ │ ├── factories_advanced_extra.rst │ │ ├── factories_basic.rst │ │ ├── factory_intro.rst │ │ ├── glossary.rst │ │ ├── handler.rst │ │ ├── images │ │ │ ├── ArrayEditor_demo.png │ │ │ ├── Auto_update_TabularEditor_demo.png │ │ │ ├── BooleanEditor_demo.png │ │ │ ├── ButtonEditor_demo.png │ │ │ ├── CSVListEditor_demo.png │ │ │ ├── CheckListEditor_demo.png │ │ │ ├── CodeEditor_demo.png │ │ │ ├── ColorEditor_demo.png │ │ │ ├── CompoundEditor_demo.png │ │ │ ├── DataFrameEditor_demo.png │ │ │ ├── DatetimeEditor_demo.png │ │ │ ├── DirectoryEditor_demo.png │ │ │ ├── Dynamic_EnumEditor_demo.png │ │ │ ├── EnumEditor_demo.png │ │ │ ├── FileEditor_demo.png │ │ │ ├── FontEditor_demo.png │ │ │ ├── HTMLEditor_demo.png │ │ │ ├── HTML_editor.png │ │ │ ├── ImageEnumEditor_demo.png │ │ │ ├── InstanceEditor_demo.png │ │ │ ├── ListEditor_demo.png │ │ │ ├── ListStrEditor_demo.png │ │ │ ├── RGBColorEditor_demo.png │ │ │ ├── RangeEditor_demo.png │ │ │ ├── SetEditor_demo.png │ │ │ ├── TableEditor_demo.png │ │ │ ├── TextEditor_demo.png │ │ │ ├── TitleEditor_demo.png │ │ │ ├── TreeEditor_demo.png │ │ │ ├── TupleEditor_demo.png │ │ │ ├── alter_title_after.png │ │ │ ├── alter_title_before.png │ │ │ ├── array_view_editor.jpg │ │ │ ├── color_picker_windows.jpg │ │ │ ├── custom_enum_editor.jpg │ │ │ ├── default_text_editor.png │ │ │ ├── delete_item_icon.png │ │ │ ├── font_dialog_windows.jpg │ │ │ ├── html_code_editor.png │ │ │ ├── insert_item_icon.png │ │ │ ├── key_binding_editor.jpg │ │ │ ├── led_editor.png │ │ │ ├── list_with_context_menu.png │ │ │ ├── move_down_icon.png │ │ │ ├── move_up_icon.png │ │ │ ├── no_sort_icon.png │ │ │ ├── notebook_list_editor.jpg │ │ │ ├── read_only_editor.jpg │ │ │ ├── search_table_icon.png │ │ │ ├── shell_editor.jpg │ │ │ ├── simple_enum_editor_closed.jpg │ │ │ ├── simple_enum_editor_open.jpg │ │ │ ├── table_column_selection.jpg │ │ │ ├── table_prefs.png │ │ │ ├── tabular_editor.jpg │ │ │ ├── text_editor.jpg │ │ │ ├── text_editor_integers.png │ │ │ ├── text_editor_strings.png │ │ │ ├── text_editors_passwords.png │ │ │ ├── ui_for_ex1.jpg │ │ │ ├── ui_for_ex12.jpg │ │ │ ├── ui_for_ex13.jpg │ │ │ ├── ui_for_ex16.png │ │ │ ├── ui_for_ex2.jpg │ │ │ ├── ui_for_ex3.jpg │ │ │ ├── ui_for_ex4.jpg │ │ │ ├── ui_for_ex7.jpg │ │ │ ├── value_editor.png │ │ │ ├── wizard_dialog_1.png │ │ │ └── wizard_dialog_2.png │ │ ├── index.rst │ │ ├── intro.rst │ │ ├── predefined_traits.rst │ │ ├── scripts │ │ │ └── regenerate_example_screenshots.py │ │ ├── testing.rst │ │ ├── testing │ │ │ ├── discussions │ │ │ │ ├── automated_vs_manual_test.rst │ │ │ │ ├── compatibility_pyface_testing.rst │ │ │ │ ├── debugging-gui-tests-at-runtime.rst │ │ │ │ ├── event_loop_and_exceptions.rst │ │ │ │ ├── target_interaction_location.rst │ │ │ │ └── working_of_extensions.rst │ │ │ ├── howtos │ │ │ │ ├── add_new_interaction.rst │ │ │ │ └── add_new_location.rst │ │ │ ├── references │ │ │ │ └── examples.rst │ │ │ ├── substitutions.rst │ │ │ └── tutorials │ │ │ │ ├── first_test.rst │ │ │ │ ├── images │ │ │ │ ├── first_test │ │ │ │ │ ├── init-app.png │ │ │ │ │ └── modified-fields.png │ │ │ │ └── test_with_nested_object │ │ │ │ │ └── init-app.png │ │ │ │ └── test_with_nested_object.rst │ │ ├── tips.rst │ │ └── view.rst │ └── tutorials │ │ ├── code_snippets │ │ ├── code_block0.py │ │ ├── code_block1.py │ │ ├── container.py │ │ ├── echo_box.py │ │ ├── event_loop.py │ │ ├── event_loop_qt.py │ │ ├── event_loop_wx.py │ │ ├── interactive.py │ │ ├── mpl_figure_editor.py │ │ ├── thread_example.py │ │ └── traits_thread.py │ │ ├── images │ │ ├── application1.png │ │ ├── application2.png │ │ ├── application3.png │ │ ├── code_block1.png │ │ ├── container.png │ │ ├── interactive.png │ │ ├── mpl_figure_editor.png │ │ └── traits_thread.png │ │ ├── index.rst │ │ └── traits_ui_scientific_app.rst ├── traits_ui.ppt ├── traits_ui_slides.pdf └── traitsuidocreadme.txt ├── edm.yaml ├── ets-demo ├── .gitignore ├── CHANGES.txt ├── LICENSE.txt ├── MANIFEST.in ├── README.rst ├── etsdemo │ ├── __init__.py │ ├── app.py │ ├── images │ │ ├── enthought-icon.png │ │ ├── image_LICENSE.txt │ │ ├── next.png │ │ ├── parent.png │ │ ├── previous.png │ │ ├── reload.png │ │ └── run.png │ ├── info.py │ ├── loader.py │ ├── main.py │ └── tests │ │ ├── __init__.py │ │ ├── test_app.py │ │ ├── test_info.py │ │ ├── test_loader.py │ │ ├── test_main.py │ │ └── testing.py ├── etstool.py ├── image_LICENSE_Nuvola.txt └── setup.py ├── etstool.py ├── examples ├── README.rst ├── demo └── tutorials │ ├── default.css │ ├── doc_examples │ ├── default.css │ ├── doc_examples.rst │ ├── examples │ │ ├── include_extra.py │ │ ├── lesson.desc │ │ ├── override_editor.py │ │ ├── view_attributes.py │ │ ├── view_multi_object.py │ │ └── view_standalone.py │ └── lesson.desc │ ├── traitsui_4.0 │ ├── buttons.py │ ├── default.css │ ├── deferred.py │ ├── editors │ │ ├── animated_gif.py │ │ ├── flash.py │ │ ├── ie_html.py │ │ ├── led.py │ │ ├── tabular_editor │ │ │ ├── numpy_array.py │ │ │ ├── python_source_browser.py │ │ │ ├── sm_person_example.py │ │ │ ├── tabular_editor.htm │ │ │ ├── tabular_editor.rst │ │ │ └── tutorial.desc │ │ └── tutorial.desc │ ├── items.py │ ├── model_view.py │ └── tutorial.desc │ └── tutor.py ├── flake8_strict.cfg ├── image_LICENSE.txt ├── image_LICENSE_Eclipse.txt ├── image_LICENSE_Nuvola.txt ├── image_LICENSE_OOo.txt ├── integrationtests ├── styled_date_editor_test.py ├── test_all_examples.py └── ui │ ├── array_editor_test.py │ ├── buttons_test.py │ ├── check_list_editor_test.py │ ├── check_list_editor_test2.py │ ├── code_editor_test.py │ ├── enum_dynamic_test.py │ ├── enum_editor_test.py │ ├── html_editor_test.py │ ├── images │ ├── bottom_left_origin.gif │ ├── bottom_right_origin.gif │ ├── top_left_origin.gif │ └── top_right_origin.gif │ ├── instance_drag_test.py │ ├── instance_editor_test.py │ ├── instance_editor_test2.py │ ├── instance_editor_test3.py │ ├── instance_editor_test4.py │ ├── instance_editor_test5.py │ ├── instance_editor_test6.py │ ├── large_range_editor.py │ ├── list_traits_ui_test.py │ ├── set_dynamic_test.py │ ├── shell_editor_test.py │ ├── table_editor_focus_bug.py │ ├── table_editor_test.py │ ├── table_editor_test2.py │ ├── table_list_editor_test.py │ ├── test_ui.py │ ├── test_ui3.py │ ├── test_ui4.py │ ├── test_ui5.py │ ├── text_editor_invalid.py │ └── tree_editor_test.py ├── pyproject.toml └── traitsui ├── __init__.py ├── api.py ├── base_panel.py ├── basic_editor_factory.py ├── color_column.py ├── context_value.py ├── default_dock_window_theme.py ├── delegating_handler.py ├── dock_window_theme.py ├── dockable_view_element.py ├── editor.py ├── editor_factory.py ├── editors ├── __init__.py ├── api.py ├── array_editor.py ├── boolean_editor.py ├── button_editor.py ├── check_list_editor.py ├── code_editor.py ├── color_editor.py ├── compound_editor.py ├── csv_list_editor.py ├── custom_editor.py ├── date_editor.py ├── date_range_editor.py ├── datetime_editor.py ├── default_override.py ├── directory_editor.py ├── dnd_editor.py ├── drop_editor.py ├── enum_editor.py ├── file_editor.py ├── font_editor.py ├── history_editor.py ├── html_editor.py ├── image_editor.py ├── image_enum_editor.py ├── instance_editor.py ├── key_binding_editor.py ├── list_editor.py ├── list_str_editor.py ├── null_editor.py ├── popup_editor.py ├── progress_editor.py ├── range_editor.py ├── rgb_color_editor.py ├── scrubber_editor.py ├── search_editor.py ├── set_editor.py ├── shell_editor.py ├── styled_date_editor.py ├── table_editor.py ├── tabular_editor.py ├── text_editor.py ├── time_editor.py ├── title_editor.py ├── tree_editor.py ├── tuple_editor.py ├── value_editor.py └── video_editor.py ├── examples └── demo │ ├── Advanced │ ├── Adapted_tree_editor_demo.py │ ├── Apply_Revert_handler_demo.py │ ├── Auto_editable_readonly_table_cells.py │ ├── Auto_update_TabularEditor_demo.py │ ├── Date_editor_demo.py │ ├── Date_range_editor_demo.py │ ├── Dynamic_EnumEditor_demo.py │ ├── Dynamic_range_trait_and_editor.py │ ├── Dynamic_views_demo.py │ ├── Dynamically_changing_buttons_demo.py │ ├── HDF5_tree_demo.py │ ├── HDF5_tree_demo2.py │ ├── History_demo.py │ ├── Invalid_state_handling.py │ ├── ListStrAdapter_demo.py │ ├── ListStrEditor_demo.py │ ├── List_editor_notebook_selection_demo.py │ ├── List_editors_demo.py │ ├── MVC_demo.py │ ├── Multi_select_string_list.py │ ├── Multi_thread_demo.py │ ├── Multi_thread_demo_2.py │ ├── NumPy_array_tabular_editor_demo.py │ ├── NumPy_array_view_editor_demo.py │ ├── Popup_Dialog_demo.py │ ├── Property_List_demo.py │ ├── Scrubber_editor_demo.py │ ├── Settable_cached_property.py │ ├── Statusbar_demo.py │ ├── String_list_ui_editor.py │ ├── Table_editor_with_checkbox_column.py │ ├── Table_editor_with_context_menu_demo.py │ ├── Table_editor_with_live_search_and_cell_editor.py │ ├── Table_editor_with_progress_column.py │ ├── Tabular_editor_demo.py │ ├── Tabular_editor_with_context_menu_demo.py │ ├── Time_editor_demo.py │ ├── Tree_editor_required_traits_demo.py │ ├── index.rst │ ├── test_fixed.h5 │ ├── test_fixed_compressed.h5 │ ├── test_h5pydata.h5 │ ├── test_table_dc.h5 │ ├── test_table_no_dc.h5 │ └── tests │ │ └── test_List_editor_notebook_selection_demo.py │ ├── Applications │ ├── Python_source_browser.py │ ├── converter.py │ ├── images │ │ ├── GG5.png │ │ ├── TFB.png │ │ ├── blue_ball.png │ │ ├── header.png │ │ ├── notebook_close.png │ │ ├── notebook_open.png │ │ └── red_ball.png │ ├── index.rst │ └── tests │ │ └── test_converter.py │ ├── Dynamic_Forms │ ├── dynamic_form_using_instances.py │ ├── dynamic_range_editor.py │ ├── dynamic_selector.py │ ├── enabled_when.py │ ├── index.rst │ ├── tests │ │ └── test_visible_when.py │ └── visible_when.py │ ├── Extras │ ├── Image_editor_demo.py │ ├── LED_display.py │ ├── Tree_editor_with_TreeNodeRenderer.py │ ├── animated_GIF.py │ ├── images │ │ ├── info.png │ │ ├── logo_32x32.gif │ │ ├── logo_48x48.gif │ │ ├── logo_64x64.gif │ │ └── python-logo.png │ ├── index.rst │ ├── tests │ │ ├── __init__.py │ │ └── test_Image_editor_demo.py │ └── windows │ │ ├── flash.py │ │ └── internet_explorer.py │ ├── Misc │ ├── demo_group_size.py │ ├── index.rst │ └── using_springs.py │ ├── Standard_Editors │ ├── ArrayEditor_demo.py │ ├── BooleanEditor_demo.py │ ├── BooleanEditor_simple_demo.py │ ├── ButtonEditor_demo.py │ ├── ButtonEditor_simple_demo.py │ ├── CSVListEditor_demo.py │ ├── CheckListEditor_demo.py │ ├── CheckListEditor_simple_demo.py │ ├── CodeEditor_demo.py │ ├── ColorEditor_demo.py │ ├── CompoundEditor_demo.py │ ├── DataFrameEditor_demo.py │ ├── DatetimeEditor_demo.py │ ├── DirectoryEditor_demo.py │ ├── EnumEditor_demo.py │ ├── FileEditor_demo.py │ ├── File_Dialog │ │ ├── File_Open.py │ │ ├── File_Open_with_Custom_Extension.py │ │ ├── File_Open_with_FileInfo_Extension.py │ │ ├── File_Open_with_ImageInfo_Extension.py │ │ ├── File_Open_with_Multiple_Extensions.py │ │ └── File_Open_with_TextInfo_Extension.py │ ├── FontEditor_demo.py │ ├── HTMLEditor_demo.py │ ├── ImageEnumEditor_demo.py │ ├── InstanceEditor_demo.py │ ├── ListEditor_demo.py │ ├── RGBColorEditor_demo.py │ ├── RangeEditor_demo.py │ ├── SetEditor_demo.py │ ├── TableEditor_demo.py │ ├── TextEditor_demo.py │ ├── TitleEditor_demo.py │ ├── TreeEditor_demo.py │ ├── TupleEditor_demo.py │ ├── VideoEditor_demo.py │ ├── index.rst │ └── tests │ │ ├── test_BooleanEditor_demo.py │ │ ├── test_BooleanEditor_simple_demo.py │ │ ├── test_ButtonEditor_demo.py │ │ ├── test_ButtonEditor_simple_demo.py │ │ ├── test_CheckListEditor_simple_demo.py │ │ ├── test_EnumEditor_demo.py │ │ ├── test_FileEditor_demo.py │ │ ├── test_InstanceEditor_demo.py │ │ ├── test_ListEditor_demo.py │ │ ├── test_RangeEditor_demo.py │ │ ├── test_TableEditor_demo.py │ │ └── test_TextEditor_demo.py │ ├── examples.cfg │ ├── index.rst │ └── traits_ui_demo.jpg ├── extras ├── __init__.py ├── _demo_info.py ├── _demo_legacy.py ├── api.py ├── checkbox_column.py ├── demo.py ├── edit_column.py ├── has_dynamic_views.py ├── images │ ├── next.png │ ├── parent.png │ ├── previous.png │ ├── reload.png │ └── run.png ├── progress_column.py └── saving.py ├── file_dialog.py ├── group.py ├── handler.py ├── help.py ├── help_template.py ├── helper.py ├── images └── frame.png ├── include.py ├── instance_choice.py ├── item.py ├── key_bindings.py ├── list_str_adapter.py ├── menu.py ├── message.py ├── mimedata.py ├── null ├── __init__.py ├── color_trait.py ├── font_trait.py ├── rgb_color_trait.py └── toolkit.py ├── qt ├── __init__.py ├── array_editor.py ├── array_view_editor.py ├── boolean_editor.py ├── button_editor.py ├── check_list_editor.py ├── clipboard.py ├── code_editor.py ├── color_editor.py ├── color_trait.py ├── compound_editor.py ├── constants.py ├── csv_list_editor.py ├── custom_editor.py ├── data_frame_editor.py ├── date_editor.py ├── date_range_editor.py ├── datetime_editor.py ├── directory_editor.py ├── drop_editor.py ├── editor.py ├── editor_factory.py ├── enum_editor.py ├── extra │ ├── __init__.py │ ├── bounds_editor.py │ ├── checkbox_renderer.py │ ├── led_editor.py │ ├── progress_renderer.py │ ├── qt_view.py │ ├── range_slider.py │ └── table_image_renderer.py ├── file_editor.py ├── font_editor.py ├── font_trait.py ├── helper.py ├── history_editor.py ├── html_editor.py ├── image_editor.py ├── image_enum_editor.py ├── images │ ├── closetab.png │ ├── frame.png │ ├── list_editor.png │ ├── next.png │ └── previous.png ├── instance_editor.py ├── key_binding_editor.py ├── key_event_to_name.py ├── list_editor.py ├── list_str_editor.py ├── list_str_model.py ├── menu.py ├── null_editor.py ├── progress_editor.py ├── range_editor.py ├── rgb_color_editor.py ├── rgb_color_trait.py ├── search_editor.py ├── set_editor.py ├── shell_editor.py ├── styled_date_editor.py ├── table_editor.py ├── table_model.py ├── tabular_editor.py ├── tabular_model.py ├── tests │ ├── __init__.py │ ├── test_color_trait.py │ ├── test_font_trait.py │ ├── test_helper.py │ ├── test_tabular_model.py │ ├── test_ui_base.py │ └── test_ui_panel.py ├── text_editor.py ├── time_editor.py ├── title_editor.py ├── toolkit.py ├── tree_editor.py ├── tree_node_renderers.py ├── tuple_editor.py ├── ui_base.py ├── ui_editor.py ├── ui_live.py ├── ui_modal.py ├── ui_panel.py ├── value_editor.py ├── video_editor.py └── view_application.py ├── qt4 └── __init__.py ├── table_column.py ├── table_filter.py ├── tabular_adapter.py ├── testing ├── README.txt ├── __init__.py ├── _exception_handling.py ├── _gui.py ├── api.py ├── data │ └── test.mp4 ├── tester │ ├── README.txt │ ├── __init__.py │ ├── _abstract_target_registry.py │ ├── _dynamic_target_registry.py │ ├── _ui_tester_registry │ │ ├── README.txt │ │ ├── __init__.py │ │ ├── _common_ui_targets.py │ │ ├── _compat.py │ │ ├── _layout.py │ │ ├── _traitsui_ui.py │ │ ├── default_registry.py │ │ ├── qt │ │ │ ├── README.txt │ │ │ ├── __init__.py │ │ │ ├── _control_widget_registry.py │ │ │ ├── _interaction_helpers.py │ │ │ ├── _registry_helper.py │ │ │ ├── _traitsui │ │ │ │ ├── README.txt │ │ │ │ ├── __init__.py │ │ │ │ ├── boolean_editor.py │ │ │ │ ├── button_editor.py │ │ │ │ ├── check_list_editor.py │ │ │ │ ├── directory_editor.py │ │ │ │ ├── editor_factory.py │ │ │ │ ├── enum_editor.py │ │ │ │ ├── file_editor.py │ │ │ │ ├── font_editor.py │ │ │ │ ├── instance_editor.py │ │ │ │ ├── list_editor.py │ │ │ │ ├── range_editor.py │ │ │ │ ├── table_editor.py │ │ │ │ ├── text_editor.py │ │ │ │ └── ui_base.py │ │ │ ├── default_registry.py │ │ │ └── tests │ │ │ │ ├── __init__.py │ │ │ │ ├── test_control_widget_registry.py │ │ │ │ └── test_interaction_helpers.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ ├── test_default_registry.py │ │ │ └── test_layout.py │ │ └── wx │ │ │ ├── README.txt │ │ │ ├── __init__.py │ │ │ ├── _control_widget_registry.py │ │ │ ├── _interaction_helpers.py │ │ │ ├── _registry_helper.py │ │ │ ├── _traitsui │ │ │ ├── README.txt │ │ │ ├── __init__.py │ │ │ ├── boolean_editor.py │ │ │ ├── button_editor.py │ │ │ ├── check_list_editor.py │ │ │ ├── directory_editor.py │ │ │ ├── editor_factory.py │ │ │ ├── enum_editor.py │ │ │ ├── file_editor.py │ │ │ ├── font_editor.py │ │ │ ├── instance_editor.py │ │ │ ├── list_editor.py │ │ │ ├── range_editor.py │ │ │ ├── text_editor.py │ │ │ └── ui_base.py │ │ │ ├── default_registry.py │ │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── test_control_widget_registry.py │ │ │ └── test_interaction_helpers.py │ ├── command.py │ ├── exceptions.py │ ├── locator.py │ ├── query.py │ ├── target_registry.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_registry.py │ │ ├── test_ui_tester.py │ │ └── test_ui_wrapper.py │ ├── ui_tester.py │ └── ui_wrapper.py └── tests │ ├── __init__.py │ ├── test_api.py │ ├── test_exception_handling.py │ └── test_gui.py ├── tests ├── __init__.py ├── _tools.py ├── editors │ ├── __init__.py │ ├── test_animatedGIF_editor.py │ ├── test_boolean_editor.py │ ├── test_button_editor.py │ ├── test_check_list_editor.py │ ├── test_code_editor.py │ ├── test_csv_editor.py │ ├── test_date_editor.py │ ├── test_date_range_editor.py │ ├── test_datetime_editor.py │ ├── test_default_override.py │ ├── test_directory_editor.py │ ├── test_drop_editor.py │ ├── test_enum_editor.py │ ├── test_file_editor.py │ ├── test_font_editor.py │ ├── test_html_editor.py │ ├── test_image_editor.py │ ├── test_image_enum_editor.py │ ├── test_instance_editor.py │ ├── test_list_editor.py │ ├── test_liststr_editor.py │ ├── test_liststr_editor_selection.py │ ├── test_range_editor.py │ ├── test_range_editor_spinner.py │ ├── test_range_editor_text.py │ ├── test_set_editor.py │ ├── test_shell_editor.py │ ├── test_styled_date_editor.py │ ├── test_table_editor.py │ ├── test_tabular_editor.py │ ├── test_text_editor.py │ ├── test_tree_editor.py │ ├── test_tuple_editor.py │ └── test_video_editor.py ├── null_backend │ ├── __init__.py │ ├── test_font_trait.py │ └── test_null_toolkit.py ├── test_actions.py ├── test_color_column.py ├── test_context_value.py ├── test_controller.py ├── test_datetime.py ├── test_editor.py ├── test_editors_imports.py ├── test_handler.py ├── test_helper.py ├── test_key_bindings.py ├── test_labels.py ├── test_layout.py ├── test_regression.py ├── test_shadow_group.py ├── test_splitter_prefs_restored.py ├── test_theme.py ├── test_toolkit.py ├── test_toolkit_traits.py ├── test_tree_node.py ├── test_ui.py ├── test_ui_panel.py ├── test_ui_traits.py ├── test_undo.py ├── test_view_application.py ├── test_visible_when_layout.py └── ui_editors │ ├── __init__.py │ └── test_data_frame_editor.py ├── theme.py ├── toolkit.py ├── toolkit_traits.py ├── tree_node.py ├── tree_node_renderer.py ├── ui.py ├── ui_editor.py ├── ui_editors ├── __init__.py ├── array_view_editor.py └── data_frame_editor.py ├── ui_info.py ├── ui_traits.py ├── undo.py ├── value_tree.py ├── view.py ├── view_element.py ├── view_elements.py └── wx ├── __init__.py ├── animated_gif_editor.py ├── array_editor.py ├── array_view_editor.py ├── boolean_editor.py ├── button_editor.py ├── check_list_editor.py ├── code_editor.py ├── color_editor.py ├── color_trait.py ├── compound_editor.py ├── constants.py ├── csv_list_editor.py ├── custom_editor.py ├── data_frame_editor.py ├── date_editor.py ├── directory_editor.py ├── dnd_editor.py ├── drop_editor.py ├── editor.py ├── editor_factory.py ├── enum_editor.py ├── extra ├── __init__.py ├── bounds_editor.py ├── led_editor.py └── windows │ ├── __init__.py │ ├── flash_editor.py │ └── ie_html_editor.py ├── file_editor.py ├── font_editor.py ├── font_trait.py ├── helper.py ├── history_control.py ├── history_editor.py ├── html_editor.py ├── image_control.py ├── image_editor.py ├── image_enum_editor.py ├── image_slice.py ├── images ├── cb_hover_off.png ├── cb_hover_on.png ├── cb_off.png ├── cb_on.png ├── file.png ├── frame.ico ├── group.png ├── hs_color_map.png ├── item.png ├── list_editor.png ├── nb_open.png ├── object.png ├── open.png ├── table_add.png ├── table_colors.png ├── table_delete.png ├── table_delete_synthetic.png ├── table_display.png ├── table_move_down.png ├── table_move_up.png ├── table_no_sort.png ├── table_prefs.png ├── table_search.png ├── table_synthetic.png └── table_undelete.png ├── instance_editor.py ├── key_binding_editor.py ├── key_event_to_name.py ├── list_editor.py ├── list_str_editor.py ├── menu.py ├── null_editor.py ├── popup_editor.py ├── progress_editor.py ├── range_editor.py ├── rgb_color_editor.py ├── rgb_color_trait.py ├── scrubber_editor.py ├── search_editor.py ├── set_editor.py ├── shell_editor.py ├── table_editor.py ├── table_model.py ├── tabular_editor.py ├── tests ├── __init__.py ├── test_color_trait.py └── test_font_trait.py ├── text_editor.py ├── time_editor.py ├── title_editor.py ├── toolkit.py ├── tree_editor.py ├── tuple_editor.py ├── ui_base.py ├── ui_editor.py ├── ui_live.py ├── ui_modal.py ├── ui_panel.py ├── ui_window.py ├── ui_wizard.py ├── value_editor.py └── view_application.py /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = traitsui 4 | omit = */tests/* 5 | 6 | [report] 7 | # Regexes for lines to exclude from consideration 8 | exclude_lines = 9 | # Have to re-enable the standard pragma 10 | pragma: no cover 11 | 12 | # Don't complain about missing debug-only code: 13 | def __repr__ 14 | 15 | # Don't complain if tests don't hit defensive assertion code: 16 | raise AssertionError 17 | raise NotImplementedError 18 | 19 | if __name__ == .__main__.: 20 | 21 | ignore_errors = True 22 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | exclude = docs 3 | per-file-ignores = */api.py:F401,*/toolkit.py:E402,examples/*:H101 4 | ignore = 5 | # codes we ignore as part of ETS style 6 | E266,W503,E722,E731,E741 7 | # codes we are ignoring pending clean-up 8 | F401,F841 9 | # codes for formatting pending clean-up 10 | E203,E265,E501,W291 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # For archives, substitute the commit hash in the setup.py file. 2 | /setup.py export-subst 3 | -------------------------------------------------------------------------------- /.github/actions/install-qt-support/README.md: -------------------------------------------------------------------------------- 1 | # Install Qt dependencies 2 | 3 | This action calls `apt-get` to install packages required for running Qt on Ubuntu. 4 | 5 | ## Inputs 6 | 7 | There are no inputs. 8 | 9 | ## Outputs 10 | 11 | There are no outputs. 12 | 13 | ## Example usage 14 | 15 | ```yml 16 | 17 | jobs: 18 | test: 19 | strategy: 20 | matrix: 21 | os: [ubuntu-latest, macos-latest, windows-latest] 22 | runs-on: ${{ matrix.os }} 23 | steps: 24 | - uses: actions/checkout@v3 25 | - name: Install Qt dependencies 26 | uses: ./.github/actions/install-qt-support 27 | ``` 28 | -------------------------------------------------------------------------------- /.github/actions/install-qt-support/action.yml: -------------------------------------------------------------------------------- 1 | name: install-qt-support 2 | description: 'Install supporting OS packages for Qt-using code' 3 | runs: 4 | using: composite 5 | steps: 6 | - name: Install Linux packages for Qt 7 | if: runner.os == 'Linux' 8 | run: | 9 | sudo apt-get update 10 | sudo apt-get install qtbase5-dev 11 | sudo apt-get install qtchooser 12 | sudo apt-get install qt5-qmake 13 | sudo apt-get install qtbase5-dev-tools 14 | sudo apt-get install libegl1 15 | sudo apt-get install libxkbcommon-x11-0 16 | sudo apt-get install libxcb-icccm4 17 | sudo apt-get install libxcb-image0 18 | sudo apt-get install libxcb-keysyms1 19 | sudo apt-get install libxcb-randr0 20 | sudo apt-get install libxcb-render-util0 21 | sudo apt-get install libxcb-xinerama0 22 | sudo apt-get install libxcb-shape0 23 | sudo apt-get install libxcb-cursor0 24 | sudo apt-get install pulseaudio 25 | sudo apt-get install libpulse-mainloop-glib0 26 | # Needed to work around https://bugreports.qt.io/browse/PYSIDE-1547 27 | sudo apt-get install libopengl0 28 | # Needed for Qt6 video playback 29 | sudo apt-get install libgstreamer-gl1.0-0 30 | shell: bash 31 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | **Checklist** 3 | - [ ] Add a news fragment if this PR is news-worthy for end users. (see docs/releases/README.rst) -------------------------------------------------------------------------------- /.github/workflows/basic-tests.yml: -------------------------------------------------------------------------------- 1 | name: Run test suite for Qt and wxPython 2 | 3 | on: [pull_request, workflow_dispatch] 4 | 5 | env: 6 | PYTHONUNBUFFERED: 1 7 | 8 | jobs: 9 | tests-qt: 10 | strategy: 11 | matrix: 12 | os: [ubuntu-latest, macos-latest, windows-latest] 13 | python-version: ['3.8', '3.11'] 14 | qt-api: ['pyqt5', 'pyside2', 'pyside6'] 15 | exclude: 16 | - python-version: '3.11' 17 | qt-api: 'pyside2' 18 | fail-fast: false 19 | 20 | env: 21 | ETS_TOOLKIT: qt 22 | 23 | runs-on: ${{ matrix.os }} 24 | timeout-minutes: 20 # should be plenty, it's usually < 5 25 | 26 | steps: 27 | - name: Check out the target commit 28 | uses: actions/checkout@v4 29 | - name: Install Qt dependencies 30 | uses: ./.github/actions/install-qt-support 31 | - name: Set up Python ${{ matrix.python-version }} 32 | uses: actions/setup-python@v5 33 | with: 34 | python-version: ${{ matrix.python-version }} 35 | - name: Install dependencies and local packages 36 | run: | 37 | python -m pip install ".[${{ matrix.qt-api }},editors,examples,test]" 38 | - name: Create clean test directory 39 | run: | 40 | mkdir testdir 41 | - name: Run the test suite (Linux) 42 | run: cd testdir && xvfb-run -a python -X faulthandler -m unittest discover -v traitsui 43 | if: matrix.os == 'ubuntu-latest' 44 | - name: Run the test suite (Windows/macOS) 45 | run: cd testdir && python -X faulthandler -m unittest discover -v traitsui 46 | if: matrix.os != 'ubuntu-latest' 47 | -------------------------------------------------------------------------------- /.github/workflows/full-wx-tests.yml: -------------------------------------------------------------------------------- 1 | name: Run test suite for Wx across all supported versions and OS weekly 2 | 3 | # This is currently failing for various reasons, so set to workflow dispatch 4 | on: [workflow_dispatch] 5 | 6 | env: 7 | PYTHONUNBUFFERED: 1 8 | 9 | jobs: 10 | test: 11 | strategy: 12 | matrix: 13 | os: [ubuntu-latest, macos-latest, windows-latest] 14 | python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] 15 | fail-fast: false 16 | 17 | env: 18 | ETS_TOOLKIT: wx 19 | 20 | runs-on: ${{ matrix.os }} 21 | timeout-minutes: 20 # should be plenty, it's usually < 5 22 | 23 | steps: 24 | - name: Check out the target commit 25 | uses: actions/checkout@v4 26 | - name: Set up Python ${{ matrix.python-version }} 27 | uses: actions/setup-python@v5 28 | with: 29 | python-version: ${{ matrix.python-version }} 30 | - name: Install dependencies and local packages 31 | run: | 32 | python -m pip install ".[wx,editors,examples,test]" 33 | - name: Create clean test directory 34 | run: | 35 | mkdir testdir 36 | - name: Run the test suite (Windows/macOS) 37 | run: cd testdir && python -X faulthandler -m unittest discover -v traitsui 38 | -------------------------------------------------------------------------------- /.github/workflows/minimal-deps-tests.yml: -------------------------------------------------------------------------------- 1 | # This workflow targets stable released dependencies from PyPI with 2 | # minimal dependencies. 3 | 4 | 5 | name: Minimal setup 6 | 7 | on: pull_request 8 | 9 | jobs: 10 | test: 11 | strategy: 12 | matrix: 13 | os: [ubuntu-latest, windows-latest] 14 | runs-on: ${{ matrix.os }} 15 | steps: 16 | - name: Check out 17 | uses: actions/checkout@v4 18 | - name: Set up Python 19 | uses: actions/setup-python@v5 20 | with: 21 | python-version: 3.8 22 | - name: Install Python packages 23 | run: | 24 | python -m pip install --upgrade pip wheel 25 | python -m pip install .[test] 26 | - name: Run test suite 27 | run: python -m unittest discover -v traitsui 28 | working-directory: ${{ runner.temp }} 29 | -------------------------------------------------------------------------------- /.github/workflows/publish-on-pypi.yml: -------------------------------------------------------------------------------- 1 | name: Publish release to PyPI 2 | 3 | on: 4 | workflow_dispatch: 5 | release: 6 | types: [published] 7 | 8 | jobs: 9 | build-and-upload: 10 | if: github.repository == 'enthought/traitsui' 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Check out the release commit 15 | uses: actions/checkout@v4 16 | - name: Set up Python 17 | uses: actions/setup-python@v5 18 | with: 19 | python-version: '3.8' 20 | - name: Install Python packages needed for build and upload 21 | run: | 22 | python -m pip install build twine 23 | - name: Build sdist and wheel 24 | run: | 25 | python -m build 26 | - name: Publish to PyPI 27 | env: 28 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 29 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 30 | run: | 31 | python -m twine check --strict dist/* 32 | python -m twine upload dist/* 33 | -------------------------------------------------------------------------------- /.github/workflows/style-checks.yml: -------------------------------------------------------------------------------- 1 | # This workflow run flake8 on the code base 2 | 3 | name: Style check 4 | 5 | on: pull_request 6 | 7 | jobs: 8 | style: 9 | strategy: 10 | matrix: 11 | os: [ubuntu-latest] 12 | python-version: [3.8, 3.11] 13 | 14 | runs-on: ${{ matrix.os }} 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Set up Python ${{ matrix.python-version }} 19 | uses: actions/setup-python@v5 20 | with: 21 | python-version: ${{ matrix.python-version }} 22 | - name: Install dependencies and local packages 23 | run: | 24 | python -m pip install --upgrade pip 25 | python -m pip install flake8 26 | - name: Run style checks 27 | run: | 28 | python -m flake8 29 | -------------------------------------------------------------------------------- /.github/workflows/test-build-documentation.yml: -------------------------------------------------------------------------------- 1 | name: Test documentation build 2 | 3 | on: 4 | pull_request 5 | 6 | jobs: 7 | docs: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v4 12 | - name: Set up Python 3.11 13 | uses: actions/setup-python@v5 14 | with: 15 | python-version: '3.11' 16 | - name: Install dependencies and local packages 17 | run: python -m pip install .[docs] 18 | - name: Autogenerate API documentation 19 | run: | 20 | sphinx-apidoc -e -M --no-toc -o docs/source/api traitsui traitsui/qt4/* traitsui/qt/* traitsui/wx/* */tests 21 | - name: Build HTML documentation with Sphinx 22 | run: | 23 | sphinx-build -b html -d build/doctrees source build/html 24 | working-directory: docs 25 | - name: Archive HTML documentation 26 | uses: actions/upload-artifact@v4 27 | with: 28 | name: docs-html 29 | path: docs/build/html 30 | retention-days: 5 31 | -------------------------------------------------------------------------------- /.github/workflows/test-etsdemo.yml: -------------------------------------------------------------------------------- 1 | # This workflow runs tests from the ets-demo distribution. 2 | 3 | name: Test etsdemo 4 | 5 | on: 6 | pull_request: 7 | paths: 8 | - 'ets-demo/**' 9 | 10 | env: 11 | QT_MAC_WANTS_LAYER: 1 12 | INSTALL_EDM_VERSION: 3.5.0 13 | 14 | jobs: 15 | 16 | test-etsdemo: 17 | strategy: 18 | matrix: 19 | os: [ubuntu-latest] 20 | toolkit: ['pyside6'] 21 | runs-on: ${{ matrix.os }} 22 | steps: 23 | - uses: actions/checkout@v4 24 | - name: Install Qt dependencies for Linux 25 | uses: ./.github/actions/install-qt-support 26 | if: startsWith(matrix.os, 'ubuntu') 27 | - name: Cache EDM packages 28 | uses: actions/cache@v4 29 | with: 30 | path: ~/.cache 31 | key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('ets-demo/etstool.py') }} 32 | - name: Setup EDM 33 | uses: enthought/setup-edm-action@v3 34 | with: 35 | edm-version: ${{ env.INSTALL_EDM_VERSION }} 36 | - name: Install click to the default EDM environment 37 | run: edm install -y wheel click 38 | - name: Install test environment 39 | run: edm run -- python etstool.py install --toolkit=${{ matrix.toolkit }} 40 | working-directory: ets-demo 41 | - name: Run tests 42 | run: xvfb-run -a edm run -- python etstool.py test --toolkit=${{ matrix.toolkit }} 43 | working-directory: ets-demo 44 | -------------------------------------------------------------------------------- /.github/workflows/test-with-pip-wx.yml: -------------------------------------------------------------------------------- 1 | # This workflow targets stable released dependencies from PyPI, with 2 | # the wxPython backend. 3 | 4 | name: Test with PyPI and wxPython 5 | 6 | on: workflow_dispatch 7 | 8 | jobs: 9 | # Tests against wxPython from PyPI 10 | # On OSX: 11 | # - wxPython complains about 'This program needs access to the screen'. 12 | # On Ubuntu: 13 | # - For wxPython 4.0, we need libsdl-image1.2 14 | # - For wxPython 4.1, we need libsdl2-2.0-0 15 | # - The Ubuntu build can be run but it fails and there are no equivalence 16 | # of allow-failure on GitHub Actions. 17 | pip-wx: 18 | env: 19 | # Enforce selection of toolkit 20 | ETS_TOOLKIT: wx 21 | strategy: 22 | # Test failure is currently expected to fail on Ubuntu 23 | fail-fast: false 24 | matrix: 25 | os: [windows-latest] 26 | python-version: [3.8] 27 | runs-on: ${{ matrix.os }} 28 | steps: 29 | - name: Check out 30 | uses: actions/checkout@v4 31 | - name: Set up Python 32 | uses: actions/setup-python@v5 33 | with: 34 | python-version: ${{ matrix.python-version }} 35 | - name: Update pip, setuptools and wheel 36 | run: python -m pip install --upgrade pip setuptools wheel 37 | - name: Install local packages 38 | run: python -m pip install .[wx,editors,test] 39 | - name: Run test suite 40 | uses: GabrielBB/xvfb-action@v1 41 | with: 42 | run: python -m unittest discover -v traitsui 43 | working-directory: ${{ runner.temp }} 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # file types to ignore 2 | *.pyc 3 | *.pyd 4 | *.so 5 | *.enamlc 6 | *~ 7 | .DS_Store 8 | 9 | # ignore the build directories 10 | *.egg-info/ 11 | build/ 12 | dist/ 13 | docs/build/ 14 | 15 | # Ignore the auto-generated version file 16 | traitsui/_version.py 17 | 18 | # Ignore automatically generated API documentation source 19 | # ... except index.rst which is manually maintained. 20 | docs/source/api/*.rst 21 | !docs/source/api/index.rst 22 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # Read the Docs configuration file 2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 3 | 4 | version: 2 5 | 6 | python: 7 | version: 3.8 8 | install: 9 | - method: pip 10 | path: . 11 | extra_requirements: 12 | - docs 13 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include CHANGES.txt 2 | include LICENSE.txt 3 | include MANIFEST.in 4 | include README.rst 5 | include README_example.png 6 | include image_LICENSE.txt 7 | include image_LICENSE_Eclipse.txt 8 | include image_LICENSE_Nuvola.txt 9 | include image_LICENSE_OOo.txt 10 | include TODO.txt 11 | include edm.yaml 12 | graft docs 13 | prune docs/build 14 | graft examples 15 | recursive-include traitsui *.py *.zip *.png *.txt *.ico 16 | recursive-include integrationtests *.py *.gif 17 | -------------------------------------------------------------------------------- /README_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/README_example.png -------------------------------------------------------------------------------- /ci-src-requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx-copybutton -------------------------------------------------------------------------------- /doc-requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/doc-requirements.txt -------------------------------------------------------------------------------- /docs/README.rst: -------------------------------------------------------------------------------- 1 | Building the TraitsUI Docs 2 | ============================ 3 | 4 | Dependency: 5 | Sphinx 6 | 7 | Optional Dependency: 8 | `Enthought-sphinx-theme`_ 9 | 10 | The docs can be built by running 11 | 12 | $ make clean 13 | $ make html 14 | 15 | from ``docs/``, which contains the ``Makefile``. 16 | Refer to ``docs/Makefile`` and ``docs/source/conf.py`` for further 17 | information on building the docs. 18 | 19 | NOTE : ``docs/source/conf.py`` calls ``_version.py`` which is autogenerated 20 | when the user installs/develops the library. 21 | -------------------------------------------------------------------------------- /docs/releases/README.rst: -------------------------------------------------------------------------------- 1 | The `upcoming` directory contains news fragments that will be added to the 2 | changelog for the NEXT release. 3 | 4 | Changes that are not of interest to the end-user can skip adding news fragment. 5 | 6 | Add a news fragment 7 | ------------------- 8 | Create a new file with a name like ``..rst``, where 9 | ```` is a pull request number, and ```` is one of: 10 | 11 | - ``feature``: New feature 12 | - ``bugfix``: Bug fixes 13 | - ``deprecation``: Deprecations of public API 14 | - ``removal``: Removal of public API 15 | - ``doc``: Documentation changes 16 | - ``test``: Changes to test suite ('end users' are distribution packagers) 17 | - ``build``: Build system changes that affect how the distribution is installed 18 | 19 | Then write a short sentence in the file that describes the changes for the 20 | end users, e.g. in ``123.removal.rst``:: 21 | 22 | Remove package xyz. 23 | 24 | Alternatively, use the following command, run from the project root directory 25 | and answer the questions:: 26 | 27 | python etstool.py changelog create 28 | 29 | (This command requires ``click`` in the environment.) 30 | -------------------------------------------------------------------------------- /docs/source/_static/e-logo-rev.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/_static/e-logo-rev.jpg -------------------------------------------------------------------------------- /docs/source/_static/et.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/_static/et.png -------------------------------------------------------------------------------- /docs/source/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {# Filename: _templates/layout.html #} 2 | {% extends '!layout.html' %} 3 | 4 | 5 | {% block relbaritems %} 6 | {% if current_page_name != 'index' %} 7 |
  • {{ title }}
  • 8 | {% endif %} 9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /docs/source/_templates/search.html: -------------------------------------------------------------------------------- 1 | {% extends "!search.html" %} 2 | {% block body %} 3 |

    Search

    4 |

    5 | Enter your search words into the box below and click 6 | search. Note that the search function automatically 7 | searches for all of the words. Pages containing some but not all 8 | of them won't appear in the result list. 9 |

    10 |
    11 | 12 | 13 |
    14 | {% if search_performed %} 15 |

    Search Results

    16 | {% if not search_results %} 17 |

    Your search did not match any results.

    18 | {% endif %} 19 | {% endif %} 20 |
    21 | {% if search_results %} 22 |
      23 | {% for href, caption, context in search_results %} 24 |
    • {{ caption }} 25 |
      {{ context|e }}
      26 |
    • 27 | {% endfor %} 28 |
    29 | {% endif %} 30 |
    31 | {% endblock %} 32 | -------------------------------------------------------------------------------- /docs/source/api/index.rst: -------------------------------------------------------------------------------- 1 | .. _traitsui-api-reference: 2 | 3 | TraitsUI |version| API Reference 4 | ================================ 5 | 6 | This document contains the auto-generated API reference documentation for 7 | TraitsUI. For user documentation, please read the 8 | :doc:`TraitsUI User Manual <../traitsui_user_manual/index>` 9 | 10 | .. toctree:: 11 | :maxdepth: 3 12 | 13 | traitsui 14 | -------------------------------------------------------------------------------- /docs/source/changelog.rst: -------------------------------------------------------------------------------- 1 | 2 | .. include:: ../../CHANGES.txt 3 | -------------------------------------------------------------------------------- /docs/source/e-logo-rev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/e-logo-rev.png -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | TraitsUI Documentation 2 | ====================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :glob: 7 | 8 | traitsui_user_manual/index 9 | traitsui_dev_guide/index 10 | api/index 11 | tutorials/index 12 | demos/index 13 | changelog 14 | 15 | .. include:: ../../README.rst 16 | 17 | Indices and tables 18 | ================== 19 | 20 | * :ref:`genindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /docs/source/traitsui_dev_guide/index.rst: -------------------------------------------------------------------------------- 1 | 2 | ================================== 3 | TraitsUI |version| Developer Guide 4 | ================================== 5 | 6 | This *internal* documentation describes how various features of TraitsUI are 7 | implemented, along with the reasoning, history and decision information. This 8 | is intended for current/future developers and maintainers of TraitsUI, those 9 | who want to dive into the code to troubleshoot issues and those who just want a 10 | better understanding of TraitsUI code base. 11 | 12 | Contents 13 | ======== 14 | 15 | .. toctree:: 16 | :maxdepth: 3 17 | 18 | testing.rst 19 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/configure_traits_view.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # configure_traits_view.py -- Sample code to demonstrate configure_traits() 12 | 13 | from traits.api import HasTraits, Int, Str 14 | from traitsui.api import Item, View 15 | 16 | 17 | class SimpleEmployee(HasTraits): 18 | first_name = Str() 19 | last_name = Str() 20 | department = Str() 21 | employee_number = Str() 22 | salary = Int() 23 | 24 | 25 | view1 = View( 26 | Item(name='first_name'), 27 | Item(name='last_name'), 28 | Item(name='department'), 29 | ) 30 | 31 | sam = SimpleEmployee() 32 | sam.configure_traits(view=view1) 33 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/configure_traits_view_buttons.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # configure_traits_view_buttons.py -- Sample code to demonstrate 12 | # configure_traits() 13 | 14 | from traits.api import HasTraits, Str, Int 15 | from traitsui.api import CancelButton, Item, OKButton, View 16 | 17 | 18 | class SimpleEmployee(HasTraits): 19 | first_name = Str() 20 | last_name = Str() 21 | department = Str() 22 | 23 | employee_number = Str() 24 | salary = Int() 25 | 26 | 27 | view1 = View( 28 | Item(name='first_name'), 29 | Item(name='last_name'), 30 | Item(name='department'), 31 | buttons=[OKButton, CancelButton], 32 | ) 33 | 34 | sam = SimpleEmployee() 35 | sam.configure_traits(view=view1) 36 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/configure_traits_view_group.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # configure_traits_view_group.py -- Sample code to demonstrate 12 | # configure_traits() 13 | 14 | from traits.api import HasTraits, Int, Str 15 | from traitsui.api import Group, Item, View 16 | 17 | 18 | class SimpleEmployee(HasTraits): 19 | first_name = Str() 20 | last_name = Str() 21 | department = Str() 22 | 23 | employee_number = Str() 24 | salary = Int() 25 | 26 | 27 | view1 = View( 28 | Group( 29 | Item(name='first_name'), 30 | Item(name='last_name'), 31 | Item(name='department'), 32 | label='Personnel profile', 33 | show_border=True, 34 | ), 35 | ) 36 | 37 | sam = SimpleEmployee() 38 | sam.configure_traits(view=view1) 39 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/default_trait_editors.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # default_trait_editors.py -- Example of using default trait editors 12 | 13 | from traits.api import Bool, HasTraits, Range, Str 14 | from traitsui.api import Item, View 15 | 16 | 17 | class Adult(HasTraits): 18 | first_name = Str() 19 | last_name = Str() 20 | age = Range(21, 99) 21 | registered_voter = Bool() 22 | 23 | traits_view = View( 24 | Item(name='first_name'), 25 | Item(name='last_name'), 26 | Item(name='age'), 27 | Item(name='registered_voter'), 28 | ) 29 | 30 | 31 | alice = Adult( 32 | first_name='Alice', 33 | last_name='Smith', 34 | age=42, 35 | registered_voter=True, 36 | ) 37 | 38 | alice.configure_traits() 39 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/default_traits_view.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # default_traits_view.py -- Sample code to demonstrate the use of 'traits_view' 12 | 13 | from traits.api import HasTraits, Int, Str 14 | from traitsui.api import Group, Item, View 15 | 16 | 17 | class SimpleEmployee2(HasTraits): 18 | first_name = Str() 19 | last_name = Str() 20 | department = Str() 21 | 22 | employee_number = Str() 23 | salary = Int() 24 | 25 | traits_view = View( 26 | Group( 27 | Item(name='first_name'), 28 | Item(name='last_name'), 29 | Item(name='department'), 30 | label='Personnel profile', 31 | show_border=True, 32 | ), 33 | ) 34 | 35 | 36 | sam = SimpleEmployee2() 37 | sam.configure_traits() 38 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/default_traits_view2.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # default_traits_view2.py -- Sample code to demonstrate the use of 12 | # 'default_traits_view' 13 | 14 | from traits.api import HasTraits, Str, Int 15 | from traitsui.api import View, Item, Group 16 | 17 | 18 | class SimpleEmployee2(HasTraits): 19 | first_name = Str() 20 | last_name = Str() 21 | department = Str() 22 | 23 | employee_number = Str() 24 | salary = Int() 25 | 26 | def default_traits_view(self): 27 | return View( 28 | Group( 29 | Item(name='first_name'), 30 | Item(name='last_name'), 31 | Item(name='department'), 32 | label='Personnel profile', 33 | show_border=True, 34 | ), 35 | ) 36 | 37 | 38 | sam = SimpleEmployee2() 39 | sam.configure_traits() 40 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/enum_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # enum_editor.py -- Example of using an enumeration editor 12 | 13 | from traits.api import Enum, HasTraits 14 | from traitsui.api import EnumEditor, Item, View 15 | 16 | 17 | class EnumExample(HasTraits): 18 | priority = Enum('Medium', 'Highest', 'High', 'Low', 'Lowest') 19 | 20 | view = View( 21 | Item( 22 | name='priority', 23 | editor=EnumEditor( 24 | values={ 25 | 'Highest': '1:Highest', 26 | 'High': '2:High', 27 | 'Medium': '3:Medium', 28 | 'Low': '4:Low', 29 | 'Lowest': '5:Lowest', 30 | } 31 | ), 32 | ), 33 | ) 34 | 35 | 36 | EnumExample().configure_traits() 37 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/handler_override.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # handler_override.py -- Example of a Handler that overrides setattr(), and 12 | # that has a user interface notification method 13 | 14 | from traits.api import Bool, HasTraits 15 | from traitsui.api import Handler, View 16 | 17 | 18 | class TC_Handler(Handler): 19 | def setattr(self, info, object, name, value): 20 | Handler.setattr(self, info, object, name, value) 21 | info.object._updated = True 22 | 23 | def object__updated_changed(self, info): 24 | if info.initialized: 25 | info.ui.title += "*" 26 | 27 | 28 | class TestClass(HasTraits): 29 | b1 = Bool() 30 | b2 = Bool() 31 | b3 = Bool() 32 | _updated = Bool(False) 33 | 34 | 35 | view1 = View( 36 | 'b1', 37 | 'b2', 38 | 'b3', 39 | title="Alter Title", 40 | handler=TC_Handler(), 41 | buttons=['OK', 'Cancel'], 42 | ) 43 | 44 | tc = TestClass() 45 | tc.configure_traits(view=view1) 46 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/mixed_styles.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # mixed_styles.py -- Example of using editor styles at various levels 12 | 13 | from traits.api import Enum, HasTraits, Str 14 | from traitsui.api import Group, Item, View 15 | 16 | 17 | class MixedStyles(HasTraits): 18 | first_name = Str() 19 | last_name = Str() 20 | 21 | department = Enum("Business", "Research", "Admin") 22 | position_type = Enum("Full-Time", "Part-Time", "Contract") 23 | 24 | traits_view = View( 25 | Group( 26 | Item(name='first_name'), 27 | Item(name='last_name'), 28 | Group( 29 | Item(name='department'), 30 | Item(name='position_type', style='custom'), 31 | style='simple', 32 | ), 33 | ), 34 | title='Mixed Styles', 35 | style='readonly', 36 | ) 37 | 38 | 39 | ms = MixedStyles(first_name='Sam', last_name='Smith') 40 | ms.configure_traits() 41 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/multiple_views.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # multiple_views.py -- Sample code to demonstrate the use of multiple views 12 | 13 | from traits.api import HasTraits, Str, Int 14 | from traitsui.api import View, Item, Group 15 | 16 | 17 | class SimpleEmployee3(HasTraits): 18 | first_name = Str() 19 | last_name = Str() 20 | department = Str() 21 | 22 | employee_number = Str() 23 | salary = Int() 24 | 25 | traits_view = View( 26 | Group( 27 | Item(name='first_name'), 28 | Item(name='last_name'), 29 | Item(name='department'), 30 | label='Personnel profile', 31 | show_border=True, 32 | ), 33 | ) 34 | 35 | all_view = View( 36 | Group( 37 | Item(name='first_name'), 38 | Item(name='last_name'), 39 | Item(name='department'), 40 | Item(name='employee_number'), 41 | Item(name='salary'), 42 | label='Personnel database entry', 43 | show_border=True, 44 | ), 45 | ) 46 | 47 | 48 | sam = SimpleEmployee3() 49 | sam.configure_traits() 50 | sam.configure_traits(view='all_view') 51 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/examples/wizard.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # wizard.py -- Example of a traits-based wizard UI 12 | 13 | from traits.api import HasTraits, Str 14 | from traits.etsconfig.api import ETSConfig 15 | from traitsui.api import Item, View, VGroup 16 | 17 | 18 | class Person(HasTraits): 19 | first_name = Str() 20 | last_name = Str() 21 | 22 | company = Str() 23 | position = Str() 24 | 25 | view = View( 26 | VGroup(Item("first_name"), Item("last_name")), 27 | VGroup(Item("company"), Item("position")), 28 | ) 29 | 30 | 31 | person = Person( 32 | first_name='Postman', 33 | last_name='Pat', 34 | company="Enthought", 35 | position="Software Developer", 36 | ) 37 | 38 | 39 | if ETSConfig.toolkit == "wx": 40 | # Wizard window is currently only available for wx backend. 41 | person.configure_traits(kind='wizard') 42 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ArrayEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ArrayEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/Auto_update_TabularEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/Auto_update_TabularEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/BooleanEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/BooleanEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ButtonEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ButtonEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/CSVListEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/CSVListEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/CheckListEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/CheckListEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/CodeEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/CodeEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ColorEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ColorEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/CompoundEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/CompoundEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/DataFrameEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/DataFrameEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/DatetimeEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/DatetimeEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/DirectoryEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/DirectoryEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/Dynamic_EnumEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/Dynamic_EnumEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/EnumEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/EnumEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/FileEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/FileEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/FontEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/FontEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/HTMLEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/HTMLEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/HTML_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/HTML_editor.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ImageEnumEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ImageEnumEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/InstanceEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/InstanceEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ListEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ListEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ListStrEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ListStrEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/RGBColorEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/RGBColorEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/RangeEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/RangeEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/SetEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/SetEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/TableEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/TableEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/TextEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/TextEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/TitleEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/TitleEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/TreeEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/TreeEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/TupleEditor_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/TupleEditor_demo.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/alter_title_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/alter_title_after.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/alter_title_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/alter_title_before.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/array_view_editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/array_view_editor.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/color_picker_windows.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/color_picker_windows.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/custom_enum_editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/custom_enum_editor.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/default_text_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/default_text_editor.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/delete_item_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/delete_item_icon.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/font_dialog_windows.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/font_dialog_windows.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/html_code_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/html_code_editor.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/insert_item_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/insert_item_icon.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/key_binding_editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/key_binding_editor.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/led_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/led_editor.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/list_with_context_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/list_with_context_menu.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/move_down_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/move_down_icon.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/move_up_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/move_up_icon.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/no_sort_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/no_sort_icon.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/notebook_list_editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/notebook_list_editor.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/read_only_editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/read_only_editor.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/search_table_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/search_table_icon.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/shell_editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/shell_editor.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/simple_enum_editor_closed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/simple_enum_editor_closed.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/simple_enum_editor_open.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/simple_enum_editor_open.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/table_column_selection.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/table_column_selection.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/table_prefs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/table_prefs.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/tabular_editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/tabular_editor.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/text_editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/text_editor.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/text_editor_integers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/text_editor_integers.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/text_editor_strings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/text_editor_strings.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/text_editors_passwords.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/text_editors_passwords.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ui_for_ex1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ui_for_ex1.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ui_for_ex12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ui_for_ex12.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ui_for_ex13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ui_for_ex13.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ui_for_ex16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ui_for_ex16.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ui_for_ex2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ui_for_ex2.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ui_for_ex3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ui_for_ex3.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ui_for_ex4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ui_for_ex4.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/ui_for_ex7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/ui_for_ex7.jpg -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/value_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/value_editor.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/wizard_dialog_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/wizard_dialog_1.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/images/wizard_dialog_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/images/wizard_dialog_2.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/testing.rst: -------------------------------------------------------------------------------- 1 | .. _testing-traitsui-applications: 2 | 3 | ============================= 4 | Testing TraitsUI Applications 5 | ============================= 6 | 7 | TraitsUI provides a toolkit independent API to help developers check the 8 | behavior of their applications in automated tests. 9 | 10 | Most of the testing functionality can be accessed via the |testing.api| module. 11 | 12 | .. note:: 13 | The testing library is relatively new compared to other features in 14 | TraitsUI. Built-in support for testing TraitsUI editors are continuously 15 | being added. 16 | 17 | 18 | Get started 19 | =========== 20 | 21 | .. toctree:: 22 | :maxdepth: 1 23 | 24 | testing/tutorials/first_test 25 | testing/tutorials/test_with_nested_object 26 | 27 | How-to guides 28 | ============= 29 | 30 | .. toctree:: 31 | :maxdepth: 1 32 | 33 | testing/howtos/add_new_interaction 34 | testing/howtos/add_new_location 35 | 36 | 37 | Discussions 38 | =========== 39 | 40 | .. toctree:: 41 | :maxdepth: 1 42 | 43 | testing/discussions/automated_vs_manual_test 44 | testing/discussions/debugging-gui-tests-at-runtime 45 | testing/discussions/compatibility_pyface_testing 46 | testing/discussions/event_loop_and_exceptions 47 | testing/discussions/target_interaction_location 48 | testing/discussions/working_of_extensions 49 | 50 | Technical Reference 51 | =================== 52 | 53 | .. toctree:: 54 | :maxdepth: 1 55 | 56 | testing/references/examples 57 | API Reference <../api/traitsui.testing> 58 | 59 | .. include:: testing/substitutions.rst 60 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/testing/discussions/automated_vs_manual_test.rst: -------------------------------------------------------------------------------- 1 | Limitations on automated GUI testing 2 | ==================================== 3 | 4 | The testing library allows more manual GUI tests to be rewritten as automated 5 | tests. However, automated tests cannot replace manual testing entirely, and 6 | there exists toolkit-dependent and platform-dependent limitations as to what 7 | can be achieved for programmatically imitating user interactions, e.g. the 8 | animation of a button being depressed when clicked may not be replicated in 9 | automated tests. 10 | 11 | The |UITester.delay| parameter allows playing back a test for visual 12 | confirmation, but it may not look identical to how the GUI looks when it is 13 | tested manually. 14 | 15 | If the GUI / trait states being asserted in tests are not consistent compared 16 | to manually testing, then that is likely a bug. Please report it. 17 | 18 | If the GUI / trait states being asserted in tests are consistent with manual 19 | testing, then such visual discrepancies may have to be tolerated. 20 | 21 | .. include:: ../substitutions.rst 22 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/testing/discussions/debugging-gui-tests-at-runtime.rst: -------------------------------------------------------------------------------- 1 | Debugging GUI tests at runtime 2 | ============================== 3 | 4 | To debug an issue with a GUI test, one can use the |UITester.delay| parameter 5 | to slow down the test, or they may use a Python debugger to inspect internal 6 | states while the test is being run. In both cases, developers should 7 | be aware that the GUI can react to any additional events that may be caused by 8 | these debugging activities, and this may cause the test to behave differently 9 | compared to running it in normal conditions. 10 | 11 | For example, if a test relies on a GUI widget having the keyboard input focus, 12 | a Python debugger may interfere with the test by stealing focus from the GUI 13 | when a break point occurs. 14 | 15 | .. include:: ../substitutions.rst 16 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/testing/references/examples.rst: -------------------------------------------------------------------------------- 1 | 2 | Examples 3 | ======== 4 | 5 | Several test examples can be found for testing 6 | :ref:`TraitsUI\'s own demos`. 7 | 8 | Editors 9 | ------- 10 | - :github-demo:`BooleanEditor ` 11 | - :github-demo:`ButtonEditor ` 12 | - :github-demo:`CheckListEditor ` 13 | - :github-demo:`EnumEditor ` 14 | - :github-demo:`FileEditor ` 15 | - :github-demo:`InstanceEditor ` 16 | - :github-demo:`ListEditor ` 17 | - :github-demo:`ListEditor (notebook) ` 18 | - :github-demo:`RangeEditor ` 19 | - :github-demo:`TextEditor ` 20 | 21 | Applications 22 | ------------ 23 | - :github-demo:`Converter ` 24 | -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/testing/tutorials/images/first_test/init-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/testing/tutorials/images/first_test/init-app.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/testing/tutorials/images/first_test/modified-fields.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/testing/tutorials/images/first_test/modified-fields.png -------------------------------------------------------------------------------- /docs/source/traitsui_user_manual/testing/tutorials/images/test_with_nested_object/init-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/traitsui_user_manual/testing/tutorials/images/test_with_nested_object/init-app.png -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/code_block0.py: -------------------------------------------------------------------------------- 1 | # code_block0.py 2 | 3 | from numpy import cos, sin 4 | 5 | 6 | class Point(object): 7 | """3D Points objects""" 8 | 9 | x = 0.0 10 | y = 0.0 11 | z = 0.0 12 | 13 | def rotate_z(self, theta): 14 | """rotate the point around the Z axis""" 15 | xtemp = cos(theta) * self.x + sin(theta) * self.y 16 | ytemp = -sin(theta) * self.x + cos(theta) * self.y 17 | self.x = xtemp 18 | self.y = ytemp 19 | -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/code_block1.py: -------------------------------------------------------------------------------- 1 | # code_block1.py 2 | 3 | from traits.api import CInt, Enum, HasTraits 4 | 5 | 6 | class Camera(HasTraits): 7 | """Camera object""" 8 | 9 | gain = Enum( 10 | 1, 11 | 2, 12 | 3, 13 | desc="the gain index of the camera", 14 | label="gain", 15 | ) 16 | exposure = CInt( 17 | 10, 18 | desc="the exposure time, in ms", 19 | label="Exposure", 20 | ) 21 | 22 | def capture(self): 23 | """Captures an image on the camera and returns it""" 24 | print( 25 | "capturing an image at %i ms exposure, gain: %i" 26 | % (self.exposure, self.gain) 27 | ) 28 | 29 | 30 | if __name__ == "__main__": 31 | camera = Camera() 32 | camera.configure_traits() 33 | camera.capture() 34 | -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/container.py: -------------------------------------------------------------------------------- 1 | # container.py 2 | 3 | from traits.api import CInt, Enum, HasTraits, Instance, String 4 | from traitsui.api import Item, View 5 | 6 | 7 | class Camera(HasTraits): 8 | """Camera object""" 9 | 10 | gain = Enum( 11 | 1, 12 | 2, 13 | 3, 14 | desc="the gain index of the camera", 15 | label="gain", 16 | ) 17 | 18 | exposure = CInt( 19 | 10, 20 | desc="the exposure time, in ms", 21 | label="Exposure", 22 | ) 23 | 24 | 25 | class Display(HasTraits): 26 | string = String() 27 | 28 | view = View(Item('string', show_label=False, springy=True, style='custom')) 29 | 30 | 31 | class Container(HasTraits): 32 | camera = Instance(Camera, ()) 33 | display = Instance(Display, ()) 34 | 35 | view = View( 36 | Item( 37 | 'camera', 38 | style='custom', 39 | show_label=False, 40 | ), 41 | Item( 42 | 'display', 43 | style='custom', 44 | show_label=False, 45 | ), 46 | ) 47 | 48 | 49 | Container().configure_traits() 50 | -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/echo_box.py: -------------------------------------------------------------------------------- 1 | # echo_box.py 2 | 3 | from traits.api import HasTraits, Str 4 | 5 | 6 | class EchoBox(HasTraits): 7 | input = Str() 8 | output = Str() 9 | 10 | def _input_changed(self): 11 | self.output = self.input 12 | 13 | 14 | EchoBox().configure_traits() 15 | -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/event_loop.py: -------------------------------------------------------------------------------- 1 | # event_loop.py 2 | 3 | from traits.api import HasTraits, Int 4 | from pyface.api import GUI 5 | 6 | 7 | class Counter(HasTraits): 8 | value = Int() 9 | 10 | 11 | Counter().edit_traits() 12 | GUI().start_event_loop() 13 | -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/event_loop_qt.py: -------------------------------------------------------------------------------- 1 | # event_loop_qt.py 2 | 3 | from pyface.qt.QtGui import QApplication 4 | 5 | from traits.api import HasTraits, Int 6 | 7 | 8 | class Counter(HasTraits): 9 | value = Int() 10 | 11 | 12 | Counter().edit_traits() 13 | QApplication.instance().exec_() 14 | -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/event_loop_wx.py: -------------------------------------------------------------------------------- 1 | # event_loop_wx.py 2 | 3 | import wx 4 | 5 | from traits.api import HasTraits, Int 6 | 7 | 8 | class Counter(HasTraits): 9 | value = Int() 10 | 11 | 12 | Counter().edit_traits() 13 | wx.App().MainLoop() 14 | -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/interactive.py: -------------------------------------------------------------------------------- 1 | # interactive.py 2 | 3 | from traits.api import HasTraits, Int, Button, observe 4 | from traitsui.api import View, Item, ButtonEditor 5 | 6 | 7 | class Counter(HasTraits): 8 | value = Int() 9 | add_one = Button() 10 | 11 | @observe('add_one') 12 | def _increment_value(self, event): 13 | self.value += 1 14 | 15 | view = View('value', Item('add_one', show_label=False)) 16 | 17 | 18 | Counter().configure_traits() 19 | -------------------------------------------------------------------------------- /docs/source/tutorials/code_snippets/thread_example.py: -------------------------------------------------------------------------------- 1 | # thread_example.py 2 | 3 | from threading import Thread 4 | from time import sleep 5 | 6 | 7 | class MyThread(Thread): 8 | def run(self): 9 | sleep(2) 10 | print("MyThread done") 11 | 12 | 13 | my_thread = MyThread() 14 | 15 | my_thread.start() 16 | print("Main thread done") 17 | -------------------------------------------------------------------------------- /docs/source/tutorials/images/application1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/tutorials/images/application1.png -------------------------------------------------------------------------------- /docs/source/tutorials/images/application2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/tutorials/images/application2.png -------------------------------------------------------------------------------- /docs/source/tutorials/images/application3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/tutorials/images/application3.png -------------------------------------------------------------------------------- /docs/source/tutorials/images/code_block1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/tutorials/images/code_block1.png -------------------------------------------------------------------------------- /docs/source/tutorials/images/container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/tutorials/images/container.png -------------------------------------------------------------------------------- /docs/source/tutorials/images/interactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/tutorials/images/interactive.png -------------------------------------------------------------------------------- /docs/source/tutorials/images/mpl_figure_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/tutorials/images/mpl_figure_editor.png -------------------------------------------------------------------------------- /docs/source/tutorials/images/traits_thread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/source/tutorials/images/traits_thread.png -------------------------------------------------------------------------------- /docs/source/tutorials/index.rst: -------------------------------------------------------------------------------- 1 | TraitsUI |version| Tutorials 2 | =================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 3 6 | 7 | traits_ui_scientific_app.rst 8 | 9 | -------------------------------------------------------------------------------- /docs/traits_ui.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/traits_ui.ppt -------------------------------------------------------------------------------- /docs/traits_ui_slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/docs/traits_ui_slides.pdf -------------------------------------------------------------------------------- /docs/traitsuidocreadme.txt: -------------------------------------------------------------------------------- 1 | Traits documentation files in this directory: 2 | 3 | traits_ui.ppt 4 | Slides from Dave Morrill's class on Traits UI 5 | traits_ui_slides.pdf 6 | PDF of Traits UI slides 7 | -------------------------------------------------------------------------------- /edm.yaml: -------------------------------------------------------------------------------- 1 | # This edm.yaml configuration file provides a standard EDM setup to be used by 2 | # the etstool.py script, particularly for CI 3 | 4 | store_url: "https://packages.enthought.com" 5 | 6 | # Packages' repositories 7 | repositories: 8 | - enthought/free 9 | - enthought/lgpl 10 | - enthought/gpl 11 | 12 | # Directory to use to cache downloaded files. 13 | files_cache: "~/.cache/edm" 14 | -------------------------------------------------------------------------------- /ets-demo/.gitignore: -------------------------------------------------------------------------------- 1 | # file types to ignore 2 | *.pyc 3 | *.pyd 4 | *~ 5 | .DS_Store 6 | 7 | # ignore the build directories 8 | *.egg-info/ 9 | build/ 10 | dist/ 11 | docs/build/ 12 | 13 | # Ignore the auto-generated version file 14 | etsdemo/version.py 15 | -------------------------------------------------------------------------------- /ets-demo/CHANGES.txt: -------------------------------------------------------------------------------- 1 | ETS Demo Changelog 2 | ================== 3 | 4 | Release 0.1.0 5 | ------------- 6 | 7 | This is an initial release of the Enthought Tool Suite Demo GUI application. 8 | The package itself does not include any demo materials. It relies on other 9 | projects to contribute data files via entry points. 10 | 11 | The application was initially hosted and advertised via 12 | ``traitsui.extras.demo.demo``. The functionality is now supported via 13 | ``etsdemo.main.main`` and projects are encouraged to migrate. 14 | ``traitsui.extras.demo.demo`` will eventually be deprecated and removed. 15 | 16 | See README for further details on how to contribute data and to launch 17 | the application. 18 | -------------------------------------------------------------------------------- /ets-demo/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include CHANGES.txt 2 | include LICENSE.txt 3 | include MANIFEST.in 4 | include README.rst 5 | include image_LICENSE_Nuvola.txt 6 | -------------------------------------------------------------------------------- /ets-demo/etsdemo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/ets-demo/etsdemo/__init__.py -------------------------------------------------------------------------------- /ets-demo/etsdemo/images/enthought-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/ets-demo/etsdemo/images/enthought-icon.png -------------------------------------------------------------------------------- /ets-demo/etsdemo/images/image_LICENSE.txt: -------------------------------------------------------------------------------- 1 | The icons are mostly derived work from other icons. As such they are 2 | licensed accordingly to the original license: 3 | 4 | Project License File 5 | ---------------------------------------------------------------------------- 6 | Nuvola LGPL image_LICENSE_Nuvola.txt 7 | 8 | Unless stated in this file, icons are the work of Enthought, and are 9 | released under a 3 clause BSD license. 10 | 11 | Files and orginal authors: 12 | ---------------------------------------------------------------------------- 13 | images: 14 | next.png | Nuvola 15 | parent.png | Nuvola 16 | previous.png | Nuvola 17 | reload.png | Nuvola 18 | run.png | Nuvola 19 | -------------------------------------------------------------------------------- /ets-demo/etsdemo/images/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/ets-demo/etsdemo/images/next.png -------------------------------------------------------------------------------- /ets-demo/etsdemo/images/parent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/ets-demo/etsdemo/images/parent.png -------------------------------------------------------------------------------- /ets-demo/etsdemo/images/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/ets-demo/etsdemo/images/previous.png -------------------------------------------------------------------------------- /ets-demo/etsdemo/images/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/ets-demo/etsdemo/images/reload.png -------------------------------------------------------------------------------- /ets-demo/etsdemo/images/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/ets-demo/etsdemo/images/run.png -------------------------------------------------------------------------------- /ets-demo/etsdemo/info.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2020-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | import pkg_resources 12 | 13 | from etsdemo.version import version 14 | 15 | ICON = pkg_resources.resource_filename("etsdemo", "images/enthought-icon.png") 16 | 17 | 18 | def info(): 19 | """Provides information to the "eam" package.""" 20 | return { 21 | "name": "ETS Demo", 22 | "description": "Application for browsing ETS examples and demos", 23 | "license": "BSD", 24 | "copyright": "(c) 2020 Enthought", 25 | "version": version, 26 | "schema_version": 2, 27 | "commands": [ 28 | { 29 | "name": "ETS Demo", 30 | "command": "etsdemo", 31 | "icon": ICON, 32 | }, 33 | ], 34 | "default": True, 35 | } 36 | -------------------------------------------------------------------------------- /ets-demo/etsdemo/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/ets-demo/etsdemo/tests/__init__.py -------------------------------------------------------------------------------- /ets-demo/etsdemo/tests/test_info.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2020-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Test the EAM app metadata. 12 | """ 13 | 14 | import os 15 | import subprocess 16 | import unittest 17 | 18 | try: 19 | import eam # noqa: #F401 20 | except ImportError: 21 | EAM_EXISTS = False 22 | else: 23 | EAM_EXISTS = True 24 | 25 | from etsdemo.info import info 26 | 27 | 28 | class TestInfoForEAM(unittest.TestCase): 29 | @unittest.skipUnless(EAM_EXISTS, "eam is not available.") 30 | def test_etsdemo_info(self): 31 | output = subprocess.check_output( 32 | ["eam", "info"], 33 | ) 34 | output = output.decode("utf-8") 35 | self.assertIn("etsdemo", output) 36 | 37 | def test_etsdemo_icon_exists(self): 38 | metadata = info() 39 | (command,) = metadata["commands"] 40 | icon = command["icon"] 41 | self.assertTrue( 42 | os.path.exists(icon), "Expected icon file to exist. Not found." 43 | ) 44 | -------------------------------------------------------------------------------- /examples/README.rst: -------------------------------------------------------------------------------- 1 | This folder contains examples for demonstration and documentation purposes. 2 | 3 | To aid discovery, symbolic links are created for files hosted in the package 4 | in order to be included as package data. 5 | 6 | If you have ``etsdemo`` package installed, you can browse the demo files with 7 | the following command:: 8 | 9 | $ etsdemo 10 | -------------------------------------------------------------------------------- /examples/demo: -------------------------------------------------------------------------------- 1 | ../traitsui/examples/demo -------------------------------------------------------------------------------- /examples/tutorials/default.css: -------------------------------------------------------------------------------- 1 | pre { border: 1px solid black; background-color: #E8E8E8; padding: 4px } 2 | -------------------------------------------------------------------------------- /examples/tutorials/doc_examples/default.css: -------------------------------------------------------------------------------- 1 | body { background-color: #FFFFFF; } 2 | 3 | h1 { font-family: Arial; 4 | font-size: 14pt; 5 | color: #303030; 6 | background-color: #FCD062; 7 | padding-top: 3px; 8 | padding-left:8px; 9 | padding-bottom: 3px; 10 | padding-right: 8px; } 11 | 12 | h2 { font-family: Arial; 13 | font-size: 12pt; 14 | color: #303030; 15 | background-color: #FCD062; 16 | padding-top: 3px; 17 | padding-left:8px; 18 | padding-bottom: 3px; 19 | padding-right: 8px; } 20 | 21 | pre { border: 1px solid #A0A0A0; 22 | background-color: #FDF7E7; 23 | padding: 4px; } 24 | 25 | dl { border: 1px solid #A0A0A0; 26 | background-color: #FDF7E7; 27 | padding-top: 4px; 28 | padding-bottom: 6px; 29 | padding-left: 8px; 30 | padding-right: 8px; } 31 | 32 | dl dl { border: 0px solid #A0A0A0; } 33 | 34 | dt { font-family: Arial; 35 | font-weight: bold; 36 | 37 | dd { padding-bottom: 10px; } 38 | -------------------------------------------------------------------------------- /examples/tutorials/doc_examples/examples/include_extra.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2007-2023 Enthought, Inc., Austin, TX 2 | # License: BSD Style. 3 | 4 | # include_extra.py --- Example of Include object 5 | # provided for subclasses 6 | from traits.api import HasTraits, Int, Str 7 | from traitsui.api import Group, Include, View 8 | 9 | 10 | class Person(HasTraits): 11 | name = Str() 12 | age = Int() 13 | 14 | person_view = View('name', Include('extra'), 'age') 15 | 16 | 17 | class LocatedPerson(Person): 18 | street = Str() 19 | city = Str() 20 | state = Str() 21 | zip = Str() 22 | 23 | extra = Group('street', 'city', 'state', 'zip') 24 | 25 | 26 | Person().configure_traits() 27 | LocatedPerson().configure_traits() 28 | -------------------------------------------------------------------------------- /examples/tutorials/doc_examples/examples/lesson.desc: -------------------------------------------------------------------------------- 1 | Examples from the Traits User Guide 2 | 3 | all_traits_features 4 | all_wildcard 5 | bad_self_ref 6 | circular_definition 7 | add_class_trait 8 | cast_simple 9 | compound 10 | 11 | custom_traithandler 12 | default_trait_ui 13 | delegate 14 | delegate_prefix 15 | disallow 16 | dynamic_notification 17 | enum_simple 18 | event 19 | explicit 20 | false 21 | graphic_example 22 | imageenumeditor 23 | include_extra 24 | instanceeditor 25 | instance_example 26 | keywords 27 | mapped 28 | map_simple 29 | minimal 30 | multiple_criteria 31 | object_trait_attrs 32 | override_default 33 | override_editor 34 | person_bmi 35 | range 36 | reuse_editor 37 | static_notification 38 | temp_wildcard 39 | this 40 | traitcasttype 41 | traitdict 42 | traitenum 43 | traitinstance 44 | traitlist 45 | traitmap 46 | traitprefixlist 47 | traitprefixmap 48 | traitrange 49 | traitstring 50 | traittuple 51 | traitype 52 | trait_reuse 53 | type_checked_methods 54 | type_simple 55 | user_custom_th 56 | use_custom_th 57 | validator 58 | view_attributes 59 | view_multi_object 60 | view_standalone 61 | widget 62 | wildcard 63 | wildcard_all 64 | wildcard_name 65 | wildcard_rules 66 | wizard 67 | -------------------------------------------------------------------------------- /examples/tutorials/doc_examples/examples/override_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2007-2023 Enthought, Inc., Austin, TX 2 | # License: BSD Style. 3 | 4 | # override_editor.py --- Example of overriding a trait 5 | # editor 6 | from traits.api import HasTraits, Trait 7 | from traitsui.api import Color, ColorEditor 8 | 9 | 10 | class Polygon(HasTraits): 11 | line_color = Trait(Color((0, 0, 0)), editor=ColorEditor()) 12 | 13 | 14 | Polygon().configure_traits() 15 | -------------------------------------------------------------------------------- /examples/tutorials/doc_examples/examples/view_attributes.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2007-2023 Enthought, Inc., Austin, TX 2 | # License: BSD Style. 3 | 4 | # view_attributes.py --- Example of a view as an 5 | # attribute of a class 6 | from traits.api import HasTraits, Int, Str, Trait 7 | from traitsui.api import View 8 | 9 | 10 | class Person(HasTraits): 11 | first_name = Str() 12 | last_name = Str() 13 | age = Int() 14 | gender = Trait(None, 'M', 'F') 15 | name_view = View('first_name', 'last_name') 16 | 17 | 18 | bill = Person() 19 | bill.configure_traits() 20 | -------------------------------------------------------------------------------- /examples/tutorials/doc_examples/examples/view_multi_object.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2007-2023 Enthought, Inc., Austin, TX 2 | # License: BSD Style. 3 | 4 | # view_multi_object.py --- Example of a view for 5 | # editing multiple objects 6 | import wx 7 | from traits.api import HasTraits, Str 8 | from traitsui.api import View 9 | 10 | 11 | class Person(HasTraits): 12 | first_name = Str() 13 | last_name = Str() 14 | 15 | 16 | class Company(HasTraits): 17 | company_name = Str() 18 | 19 | 20 | # Standalone View object referencing objects in the UI context 21 | employee_view = View('e.first_name', 'e.last_name', 'c.company_name') 22 | 23 | bill = Person(first_name='Bill') 24 | acme = Company(company_name='Acme Products') 25 | 26 | 27 | class TraitApp(wx.App): 28 | def __init__(self, obj1, obj2, view): 29 | self.obj1 = obj1 30 | self.obj2 = obj2 31 | self.view = view 32 | wx.InitAllImageHandlers() 33 | wx.App.__init__(self, 1, 'debug.log') 34 | self.MainLoop() 35 | 36 | def OnInit(self): 37 | # This is the call to the ui() method, which includes a 38 | # context dictionary 39 | ui = self.view.ui({'e': self.obj1, 'c': self.obj2}) 40 | self.SetTopWindow(ui.control) 41 | return True 42 | 43 | 44 | # Main program: 45 | TraitApp(bill, acme, employee_view) 46 | -------------------------------------------------------------------------------- /examples/tutorials/doc_examples/examples/view_standalone.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2007-2023 Enthought, Inc., Austin, TX 2 | # License: BSD Style. 3 | 4 | # view_standalone.py --- Example of a view as a 5 | # standalone object 6 | import wx 7 | from traits.api import HasTraits, Int, Str, Trait 8 | from traitsui.api import View 9 | 10 | 11 | class Person(HasTraits): 12 | first_name = Str() 13 | last_name = Str() 14 | age = Int() 15 | gender = Trait(None, 'M', 'F') 16 | name_view = View('first_name', 'last_name') 17 | 18 | 19 | # Note that person_view is a standalone object. 20 | person_view = View('first_name', 'last_name', 'age', 'gender') 21 | 22 | bill = Person() 23 | 24 | 25 | class TraitApp(wx.App): 26 | def __init__(self, object, view): 27 | self.object = object 28 | self.view = view 29 | wx.InitAllImageHandlers() 30 | wx.App.__init__(self, 1, 'debug.log') 31 | self.MainLoop() 32 | 33 | def OnInit(self): 34 | # This is the call to the ui() method. 35 | ui = self.view.ui(self.object) 36 | self.SetTopWindow(ui.control) 37 | return True 38 | 39 | 40 | # Main program: 41 | TraitApp(bill, person_view) 42 | -------------------------------------------------------------------------------- /examples/tutorials/doc_examples/lesson.desc: -------------------------------------------------------------------------------- 1 | The Traits Documentation Examples Tutorial 2 | 3 | examples 4 | -------------------------------------------------------------------------------- /examples/tutorials/traitsui_4.0/default.css: -------------------------------------------------------------------------------- 1 | body { background-color: #FFFFFF; } 2 | 3 | h1 { font-family: Arial; 4 | font-size: 14pt; 5 | color: #303030; 6 | background-color: #FCD062; 7 | padding-top: 3px; 8 | padding-left:8px; 9 | padding-bottom: 3px; 10 | padding-right: 8px; } 11 | 12 | h2 { font-family: Arial; 13 | font-size: 12pt; 14 | color: #303030; 15 | background-color: #FCD062; 16 | padding-top: 3px; 17 | padding-left:8px; 18 | padding-bottom: 3px; 19 | padding-right: 8px; } 20 | 21 | pre { border: 1px solid #A0A0A0; 22 | background-color: #FDF7E7; 23 | padding: 4px; } 24 | 25 | dl { border: 1px solid #A0A0A0; 26 | background-color: #FDF7E7; 27 | padding-top: 4px; 28 | padding-bottom: 6px; 29 | padding-left: 8px; 30 | padding-right: 8px; } 31 | 32 | dl dl { border: 0px solid #A0A0A0; } 33 | 34 | dt { font-family: Arial; 35 | font-weight: bold; 36 | 37 | dd { padding-bottom: 10px; } 38 | -------------------------------------------------------------------------------- /examples/tutorials/traitsui_4.0/editors/tabular_editor/tutorial.desc: -------------------------------------------------------------------------------- 1 | Tabular Editor 2 | 3 | tabular_editor: Tabular Editor Introduction 4 | sm_person_example: Single and Married Person Example 5 | python_source_browser: Python Source Browser Example 6 | numpy_array: NumPy Array Example 7 | -------------------------------------------------------------------------------- /examples/tutorials/traitsui_4.0/editors/tutorial.desc: -------------------------------------------------------------------------------- 1 | New Traits UI Editors 2 | 3 | animated_gif: Animated GIF Editor 4 | led: LED Editor 5 | ie_html: Internet Explorer HTML Editor (Windows Only) 6 | flash: Flash Editor (Windows Only) 7 | tabular_editor: Tabular Editor 8 | -------------------------------------------------------------------------------- /examples/tutorials/traitsui_4.0/tutorial.desc: -------------------------------------------------------------------------------- 1 | Traits UI Changes and Enhancements 2 | deferred: Deferred UI Notifications 3 | buttons: View Default Button Changes 4 | model_view: ModelView and Controller Classes 5 | items: Extended Traits UI Item and Editor References 6 | editors 7 | -------------------------------------------------------------------------------- /examples/tutorials/tutor.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------- 2 | # 3 | # (C) Copyright 2007-2023 Enthought, Inc., Austin, TX 4 | # All rights reserved. 5 | # 6 | # This software is provided without warranty under the terms of the BSD 7 | # license included in enthought/LICENSE.txt and may be redistributed only 8 | # under the conditions described in the aforementioned license. The license 9 | # is also available online at http://www.enthought.com/licenses/BSD.txt 10 | # 11 | # Thanks for using Enthought open source! 12 | # 13 | # ------------------------------------------------------------------------- 14 | 15 | """ Script to run the tutorial. 16 | """ 17 | 18 | 19 | import os 20 | import sys 21 | 22 | from traitsui.extras.demo import demo 23 | 24 | # Correct program usage information: 25 | usage = """ 26 | Correct usage is: tutor.py [root_dir] 27 | where: 28 | root_dir = Path to root of the tutorial tree 29 | 30 | If omitted, 'root_dir' defaults to the current directory.""" 31 | 32 | 33 | def main(root_dir): 34 | # Create a tutor and display the tutorial: 35 | path, name = os.path.splitext(root_dir) 36 | demo(dir_name=root_dir) 37 | 38 | 39 | if __name__ == '__main__': 40 | 41 | # Validate the command line arguments: 42 | if len(sys.argv) > 2: 43 | print(usage) 44 | sys.exit(1) 45 | 46 | # Determine the root path to use for the tutorial files: 47 | if len(sys.argv) == 2: 48 | root_dir = sys.argv[1] 49 | else: 50 | root_dir = os.getcwd() 51 | 52 | main(root_dir) 53 | -------------------------------------------------------------------------------- /flake8_strict.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = E266,W503,E722,E731,E741 3 | per-file-ignores = */api.py:F401 4 | -------------------------------------------------------------------------------- /image_LICENSE_OOo.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/image_LICENSE_OOo.txt -------------------------------------------------------------------------------- /integrationtests/ui/enum_dynamic_test.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traits.api import HasTraits, List, Str 12 | from traitsui.api import EnumEditor, Item, View 13 | 14 | 15 | def evaluate_value(v): 16 | print('evaluate_value', v) 17 | return str(v) 18 | 19 | 20 | class Team(HasTraits): 21 | 22 | captain = Str('Dick') 23 | players = List(['Tom', 'Dick', 'Harry', 'Sally'], Str) 24 | 25 | captain_editor = EnumEditor(name='players', evaluate=evaluate_value) 26 | 27 | view = View( 28 | Item('captain', editor=captain_editor), '_', 'players@', height=200 29 | ) 30 | 31 | 32 | if __name__ == '__main__': 33 | team = Team() 34 | team.configure_traits() 35 | team.print_traits() 36 | -------------------------------------------------------------------------------- /integrationtests/ui/images/bottom_left_origin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/integrationtests/ui/images/bottom_left_origin.gif -------------------------------------------------------------------------------- /integrationtests/ui/images/bottom_right_origin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/integrationtests/ui/images/bottom_right_origin.gif -------------------------------------------------------------------------------- /integrationtests/ui/images/top_left_origin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/integrationtests/ui/images/top_left_origin.gif -------------------------------------------------------------------------------- /integrationtests/ui/images/top_right_origin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/integrationtests/ui/images/top_right_origin.gif -------------------------------------------------------------------------------- /integrationtests/ui/set_dynamic_test.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traits.api import HasTraits, List, Str 12 | from traitsui.api import Item, SetEditor, View 13 | 14 | 15 | class Team(HasTraits): 16 | 17 | batting_order = List(Str) 18 | roster = List(['Tom', 'Dick', 'Harry', 'Sally'], Str) 19 | 20 | view = View( 21 | Item('batting_order', editor=SetEditor(name='roster', ordered=True)), 22 | '_', 23 | 'roster@', 24 | height=500, 25 | resizable=True, 26 | ) 27 | 28 | 29 | if __name__ == '__main__': 30 | Team().configure_traits() 31 | -------------------------------------------------------------------------------- /integrationtests/ui/text_editor_invalid.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # Test for TextEditor 'invalid' trait. 12 | # 13 | # Look for: 14 | # 15 | # background color should be correctly to the error indicating color 16 | # whenever the name is invalid (all whitespace). In particular: 17 | # 18 | # background color should be set at initialization. 19 | 20 | from traits.api import Bool, HasTraits, Property, Str 21 | from traitsui.api import Item, View 22 | from traitsui.api import TextEditor 23 | 24 | 25 | class Person(HasTraits): 26 | name = Str() 27 | 28 | invalid = Property(Bool, observe='name') 29 | 30 | def _get_invalid(self): 31 | # Name is valid iff it doesn't consist entirely of whitespace. 32 | stripped_name = self.name.strip() 33 | return stripped_name == '' 34 | 35 | traits_view = View( 36 | Item('name', editor=TextEditor(invalid='invalid')), 37 | ) 38 | 39 | 40 | if __name__ == '__main__': 41 | Person().configure_traits() 42 | -------------------------------------------------------------------------------- /traitsui/default_dock_window_theme.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the default DockWindow theme. 12 | """ 13 | 14 | from .dock_window_theme import DockWindowTheme 15 | 16 | from .theme import Theme 17 | 18 | 19 | # The original DockWindows UI redone as a theme: 20 | default_dock_window_theme = DockWindowTheme( 21 | use_theme_color=False, 22 | tab_active=Theme("@std:tab_active", label=(0, -3), content=(7, 6, 0, 0)), 23 | tab_inactive=Theme("@std:tab_inactive", label=(0, -1), content=(5, 0)), 24 | tab_hover=Theme("@std:tab_hover", label=(0, -2), content=(5, 0)), 25 | tab_background=Theme("@std:tab_background"), 26 | tab=Theme("@std:tab", content=0, label=(-7, 0)), 27 | vertical_splitter=Theme( 28 | "@std:vertical_splitter", content=0, label=(0, -25) 29 | ), 30 | horizontal_splitter=Theme( 31 | "@std:horizontal_splitter", content=0, label=(-24, 0) 32 | ), 33 | vertical_drag=Theme("@std:vertical_drag", content=(0, 10)), 34 | horizontal_drag=Theme("@std:horizontal_drag", content=(10, 0)), 35 | ) 36 | -------------------------------------------------------------------------------- /traitsui/editors/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | 12 | def __getattr__(name): 13 | # For backwards compatibility, continue to make the editors available for 14 | # import here, but warn it is deprecated. 15 | import traitsui.editors.api 16 | if name in traitsui.editors.api.__dict__: 17 | obj = getattr(traitsui.editors.api, name) 18 | import warnings 19 | warnings.warn( 20 | "Using or importing Editor factories from 'traitsui.editors' " 21 | "instead of from 'traitsui.editors.api' is deprecated and will " 22 | "stop working in TraitsUI 9.0", 23 | DeprecationWarning, stacklevel=2, 24 | ) 25 | globals()[name] = obj 26 | return obj 27 | 28 | raise AttributeError(f'module {__name__!r} has no attribute {name!r}') 29 | -------------------------------------------------------------------------------- /traitsui/editors/compound_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the compound editor factory for all traits toolkit backends. 12 | """ 13 | 14 | from traits.api import Bool, List 15 | 16 | from traitsui.editor_factory import EditorFactory 17 | 18 | # ------------------------------------------------------------------------- 19 | # Trait definitions: 20 | # ------------------------------------------------------------------------- 21 | 22 | # List of component editor factories used to build a compound editor 23 | editors_trait = List(EditorFactory) 24 | 25 | 26 | class CompoundEditor(EditorFactory): 27 | """Editor factory for compound editors.""" 28 | 29 | # ------------------------------------------------------------------------- 30 | # Trait definitions: 31 | # ------------------------------------------------------------------------- 32 | 33 | #: Component editor factories used to build the editor 34 | editors = editors_trait 35 | 36 | #: Is user input set on every keystroke? 37 | auto_set = Bool(True) 38 | 39 | 40 | # This alias is deprecated and will be removed in TraitsUI 8. 41 | ToolkitEditorFactory = CompoundEditor 42 | -------------------------------------------------------------------------------- /traitsui/editors/date_range_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traits.api import Bool, Constant 12 | 13 | from traitsui.editors.date_editor import DateEditor 14 | 15 | 16 | class DateRangeEditor(DateEditor): 17 | """Editor for a date range. The target value should be a tuple 18 | containing two dates (start date, end date) 19 | """ 20 | 21 | #: This must be set to true for setting a date range. 22 | multi_select = Constant(True) 23 | 24 | #: Whether it is possible to unset the date range. 25 | #: If true, then the date range will be set to (None, None) 26 | #: when all the dates are unselected. 27 | allow_no_selection = Bool(False) 28 | 29 | 30 | # This alias is deprecated and will be removed in TraitsUI 8. 31 | ToolkitEditorFactory = DateRangeEditor 32 | -------------------------------------------------------------------------------- /traitsui/editors/datetime_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ A Traits UI editor 12 | """ 13 | 14 | import datetime 15 | 16 | from traits.api import Datetime, Str 17 | 18 | from traitsui.editor_factory import EditorFactory 19 | 20 | 21 | class DatetimeEditor(EditorFactory): 22 | """Editor factory for the datetime editor.""" 23 | 24 | # ------------------------------------------------------------------------- 25 | # Trait definitions: 26 | # ------------------------------------------------------------------------- 27 | 28 | #: The earliest datetime allowed by the editor 29 | minimum_datetime = Datetime(datetime.datetime(100, 1, 1), allow_none=True) 30 | 31 | #: The latest datetime allowed by the editor 32 | maximum_datetime = Datetime(datetime.datetime.max, allow_none=True) 33 | 34 | # -- ReadonlyEditor traits ------------------------------------------------ 35 | 36 | #: Message to show when datetime is None. 37 | message = Str("Undefined") 38 | 39 | #: The string representation of the datetime to show. Uses time.strftime 40 | #: format. 41 | strftime = Str("%Y-%m-%dT%H:%M:%S") 42 | -------------------------------------------------------------------------------- /traitsui/editors/directory_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the directory editor factory for all traits toolkit backends. 12 | """ 13 | 14 | from traitsui.editors.file_editor import FileEditor 15 | 16 | 17 | class DirectoryEditor(FileEditor): 18 | """Editor factory for directory editors.""" 19 | 20 | pass 21 | 22 | 23 | # This alias is deprecated and will be removed in TraitsUI 8. 24 | ToolkitEditorFactory = DirectoryEditor 25 | -------------------------------------------------------------------------------- /traitsui/editors/dnd_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the editor factory for a drag-and-drop editor. A drag-and-drop 12 | editor represents its value as a simple image which, depending upon the 13 | editor style, can be a drag source only, a drop target only, or both a 14 | drag source and a drop target. 15 | """ 16 | 17 | from pyface.ui_traits import Image 18 | 19 | from traitsui.editor_factory import EditorFactory 20 | 21 | 22 | class DNDEditor(EditorFactory): 23 | """Editor factory for drag-and-drop editors.""" 24 | 25 | # ------------------------------------------------------------------------- 26 | # Trait definitions: 27 | # ------------------------------------------------------------------------- 28 | 29 | #: The image to use for the target: 30 | image = Image 31 | 32 | #: The image to use when the target is disabled: 33 | disabled_image = Image 34 | 35 | 36 | # This alias is deprecated and will be removed in TraitsUI 8. 37 | ToolkitEditorFactory = DNDEditor 38 | -------------------------------------------------------------------------------- /traitsui/editors/drop_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines a drop editor factory for all traits toolkit backends. 12 | A drop target editor handles drag and drop operations as a drop 13 | target. 14 | """ 15 | 16 | from traits.api import Any, Bool 17 | 18 | from traitsui.editors.text_editor import TextEditor 19 | 20 | 21 | class DropEditor(TextEditor): 22 | """Editor factory for drop editors.""" 23 | 24 | # ------------------------------------------------------------------------- 25 | # Trait definitions: 26 | # ------------------------------------------------------------------------- 27 | 28 | #: Allowable drop objects must be of this class (optional) 29 | klass = Any() 30 | 31 | #: Must allowable drop objects be bindings? 32 | binding = Bool(False) 33 | 34 | #: Can the user type into the editor, or is it read only? 35 | readonly = Bool(True) 36 | 37 | 38 | # This alias is deprecated and will be removed in TraitsUI 8. 39 | ToolkitEditorFactory = DropEditor 40 | -------------------------------------------------------------------------------- /traitsui/editors/history_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines a text editor which displays a text field and maintains a history 12 | of previously entered values. 13 | """ 14 | 15 | from traits.api import Int, Bool 16 | 17 | from traitsui.basic_editor_factory import BasicEditorFactory 18 | from traitsui.toolkit import toolkit_object 19 | 20 | # Define callable which returns the 'klass' value (i.e. the editor to use in 21 | # the EditorFactory. 22 | 23 | 24 | def history_editor(*args, **traits): 25 | return toolkit_object("history_editor:_HistoryEditor")(*args, **traits) 26 | 27 | 28 | # ------------------------------------------------------------------------- 29 | # Create the editor factory object: 30 | # ------------------------------------------------------------------------- 31 | 32 | 33 | class ToolkitEditorFactory(BasicEditorFactory): 34 | 35 | #: The number of entries in the history: 36 | entries = Int(10) 37 | 38 | #: Should each keystroke update the value (or only the enter key, tab, 39 | #: etc.)? 40 | auto_set = Bool(False) 41 | 42 | 43 | HistoryEditor = ToolkitEditorFactory(klass=history_editor) 44 | -------------------------------------------------------------------------------- /traitsui/editors/key_binding_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the key binding editor for use with the KeyBinding class. This is a 12 | specialized editor used to associate a particular key with a control (i.e., the 13 | key binding editor). 14 | """ 15 | 16 | from traitsui.basic_editor_factory import BasicEditorFactory 17 | from traitsui.toolkit import toolkit_object 18 | 19 | # Callable which returns the editor to use in the ui. 20 | 21 | 22 | def key_binding_editor(*args, **traits): 23 | return toolkit_object("key_binding_editor:KeyBindingEditor")( 24 | *args, **traits 25 | ) 26 | 27 | 28 | # ------------------------------------------------------------------------- 29 | # Create the editor factory object: 30 | # ------------------------------------------------------------------------- 31 | KeyBindingEditor = ToolkitEditorFactory = BasicEditorFactory( 32 | klass=key_binding_editor 33 | ) 34 | -------------------------------------------------------------------------------- /traitsui/editors/null_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines a completely empty editor, intended to be used as a spacer. 12 | """ 13 | 14 | from traitsui.basic_editor_factory import BasicEditorFactory 15 | from traitsui.toolkit import toolkit_object 16 | 17 | # Callable which returns the editor to use in the ui. 18 | 19 | 20 | def null_editor(*args, **traits): 21 | return toolkit_object("null_editor:NullEditor")(*args, **traits) 22 | 23 | 24 | # ------------------------------------------------------------------------- 25 | # Create the editor factory object: 26 | # ------------------------------------------------------------------------- 27 | NullEditor = BasicEditorFactory(klass=null_editor) 28 | -------------------------------------------------------------------------------- /traitsui/editors/set_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the set editor factory for all traits user interface toolkits. 12 | """ 13 | 14 | from traits.api import Bool, Str 15 | 16 | from traitsui.editor_factory import EditorWithListFactory 17 | 18 | 19 | class SetEditor(EditorWithListFactory): 20 | """Editor factory for editors for sets.""" 21 | 22 | # ------------------------------------------------------------------------- 23 | # Trait definitions: 24 | # ------------------------------------------------------------------------- 25 | 26 | #: Are the items in the set ordered (vs. unordered)? 27 | ordered = Bool(False) 28 | 29 | #: Can the user add and delete all items in the set at once? 30 | can_move_all = Bool(True) 31 | 32 | #: Title of left column: 33 | left_column_title = Str() 34 | 35 | #: Title of right column: 36 | right_column_title = Str() 37 | 38 | 39 | # This alias is deprecated and will be removed in TraitsUI 8. 40 | ToolkitEditorFactory = SetEditor 41 | -------------------------------------------------------------------------------- /traitsui/editors/styled_date_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traits.api import Bool, List, Str 12 | 13 | from traitsui.editors.date_editor import DateEditor 14 | 15 | 16 | class StyledDateEditor(DateEditor): 17 | """A DateEditor that can show sets of dates in different styles.""" 18 | 19 | #: The name of a dictionary on the object that maps names to groups 20 | #: (list/tuples) of datetime.date objects. Each of these groups can be 21 | #: styled using the **styles** dict. 22 | dates_trait = Str() 23 | 24 | #: The name of a dictionary on the object that maps names of styles to 25 | #: CellFormat objects. The names used must match the names used in the 26 | #: **dates** dict. 27 | styles_trait = Str() 28 | 29 | #: Allow selection of arbitrary dates in the past. 30 | allow_past = Bool(True) 31 | 32 | #: Allow selection of arbitrary dates in the future. 33 | allow_future = Bool(True) 34 | 35 | #: A list of strings that will be offered as an alternative to specifying 36 | #: an absolute date, and instead specify a relative date. 37 | relative_dates = List() 38 | 39 | 40 | # This alias is deprecated and will be removed in TraitsUI 8. 41 | ToolkitEditorFactory = StyledDateEditor 42 | -------------------------------------------------------------------------------- /traitsui/editors/time_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ A Traits UI editor that wraps a timer control. 12 | """ 13 | 14 | from traits.api import Str 15 | 16 | from traitsui.editor_factory import EditorFactory 17 | from traitsui.ui_traits import AView 18 | 19 | 20 | class TimeEditor(EditorFactory): 21 | """Editor factory for time editors.""" 22 | 23 | # ------------------------------------------------------------------------- 24 | # Trait definitions: 25 | # ------------------------------------------------------------------------- 26 | 27 | # -- ReadonlyEditor traits ------------------------------------------------ 28 | 29 | #: Message to show when Time is None. 30 | message = Str("Undefined") 31 | 32 | #: The string representation of the time to show. Uses time.strftime 33 | #: format. 34 | strftime = Str("%I:%M:%S %p") 35 | 36 | #: An optional view to display when a read-only text editor is clicked: 37 | view = AView 38 | -------------------------------------------------------------------------------- /traitsui/editors/title_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the title editor factory for all traits toolkit backends. 12 | """ 13 | 14 | from traits.api import Bool 15 | 16 | from traitsui.editor_factory import EditorFactory 17 | from traitsui.toolkit import toolkit_object 18 | 19 | 20 | class TitleEditor(EditorFactory): 21 | """Editor factory for Title editors.""" 22 | 23 | allow_selection = Bool(False) 24 | 25 | def _get_simple_editor_class(self): 26 | """Returns the editor class to use for "simple" style views. 27 | The default implementation tries to import the SimpleEditor class in 28 | the editor file in the backend package, and if such a class is not to 29 | found it returns the SimpleEditor class defined in editor_factory 30 | module in the backend package. 31 | 32 | """ 33 | SimpleEditor = toolkit_object("title_editor:SimpleEditor") 34 | return SimpleEditor 35 | 36 | 37 | # This alias is deprecated and will be removed in TraitsUI 8. 38 | ToolkitEditorFactory = TitleEditor 39 | -------------------------------------------------------------------------------- /traitsui/examples/demo/Advanced/Time_editor_demo.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ 12 | A timer editor 13 | 14 | Display or edit a time. 15 | 16 | You can edit the time directly, or by using only the arrow keys (left & right 17 | to navigate, up & down to change). 18 | 19 | """ 20 | 21 | import datetime 22 | 23 | from traits.api import HasTraits, Time 24 | from traitsui.api import View, Item, TimeEditor 25 | 26 | 27 | class TimeEditorDemo(HasTraits): 28 | """Demo class.""" 29 | 30 | time = Time(datetime.time(12, 0, 0)) 31 | 32 | traits_view = View( 33 | Item('time', label='Simple Editor'), 34 | Item( 35 | 'time', 36 | label='Readonly Editor', 37 | style='readonly', 38 | # Show 24-hour mode instead of default 12 hour. 39 | editor=TimeEditor(strftime='%H:%M:%S'), 40 | ), 41 | resizable=True, 42 | ) 43 | 44 | def _time_changed(self): 45 | """Print each time the time value is changed in the editor.""" 46 | print(self.time) 47 | 48 | 49 | # -- Set Up The Demo ------------------------------------------------------ 50 | 51 | demo = TimeEditorDemo() 52 | 53 | if __name__ == "__main__": 54 | demo.configure_traits() 55 | -------------------------------------------------------------------------------- /traitsui/examples/demo/Advanced/index.rst: -------------------------------------------------------------------------------- 1 | These examples demonstrate advanced features of TraitsUI. 2 | -------------------------------------------------------------------------------- /traitsui/examples/demo/Advanced/test_fixed.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Advanced/test_fixed.h5 -------------------------------------------------------------------------------- /traitsui/examples/demo/Advanced/test_fixed_compressed.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Advanced/test_fixed_compressed.h5 -------------------------------------------------------------------------------- /traitsui/examples/demo/Advanced/test_h5pydata.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Advanced/test_h5pydata.h5 -------------------------------------------------------------------------------- /traitsui/examples/demo/Advanced/test_table_dc.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Advanced/test_table_dc.h5 -------------------------------------------------------------------------------- /traitsui/examples/demo/Advanced/test_table_no_dc.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Advanced/test_table_no_dc.h5 -------------------------------------------------------------------------------- /traitsui/examples/demo/Applications/images/GG5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Applications/images/GG5.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Applications/images/TFB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Applications/images/TFB.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Applications/images/blue_ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Applications/images/blue_ball.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Applications/images/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Applications/images/header.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Applications/images/notebook_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Applications/images/notebook_close.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Applications/images/notebook_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Applications/images/notebook_open.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Applications/images/red_ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Applications/images/red_ball.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Applications/index.rst: -------------------------------------------------------------------------------- 1 | These examples demonstrate two simple applications built using TraitsUI 2 | 3 | - a Python source code browser, 4 | - a length measurement converter between various unit systems. -------------------------------------------------------------------------------- /traitsui/examples/demo/Dynamic_Forms/index.rst: -------------------------------------------------------------------------------- 1 | Implementations of dynamic form behavior using TraitsUI 2 | -------------------------------------------------------------------------------- /traitsui/examples/demo/Extras/images/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Extras/images/info.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Extras/images/logo_32x32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Extras/images/logo_32x32.gif -------------------------------------------------------------------------------- /traitsui/examples/demo/Extras/images/logo_48x48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Extras/images/logo_48x48.gif -------------------------------------------------------------------------------- /traitsui/examples/demo/Extras/images/logo_64x64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Extras/images/logo_64x64.gif -------------------------------------------------------------------------------- /traitsui/examples/demo/Extras/images/python-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Extras/images/python-logo.png -------------------------------------------------------------------------------- /traitsui/examples/demo/Extras/index.rst: -------------------------------------------------------------------------------- 1 | These demos showcase some extra behaviors that are possible with TraitsUI -------------------------------------------------------------------------------- /traitsui/examples/demo/Extras/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/Extras/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/examples/demo/Extras/tests/test_Image_editor_demo.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ This file provides tests for the demo of the same name located in the 12 | directory one level up. 13 | """ 14 | import os 15 | import runpy 16 | import unittest 17 | 18 | #: Filename of the demo script 19 | FILENAME = "Image_editor_demo.py" 20 | 21 | #: Path of the demo script 22 | DEMO_PATH = os.path.join(os.path.dirname(__file__), "..", FILENAME) 23 | 24 | 25 | class TestImageEditorDemo(unittest.TestCase): 26 | def test_image_path_exists(self): 27 | (search_path,) = runpy.run_path(DEMO_PATH)["search_path"] 28 | self.assertTrue(os.path.exists(search_path)) 29 | 30 | 31 | # Run the test(s) 32 | unittest.TextTestRunner().run( 33 | unittest.TestLoader().loadTestsFromTestCase(TestImageEditorDemo) 34 | ) 35 | -------------------------------------------------------------------------------- /traitsui/examples/demo/Misc/index.rst: -------------------------------------------------------------------------------- 1 | These examples demonstrate two useful features of TraitsUI 2 | 3 | - Controlling the height and width of Groups in your TraitsUI application, 4 | - Spacing widgets in your TraitsUI application using springs. -------------------------------------------------------------------------------- /traitsui/examples/demo/Standard_Editors/ArrayEditor_demo.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """Demo of the ArrayEditor""" 12 | 13 | import numpy as np 14 | 15 | from traits.api import Array, HasPrivateTraits 16 | from traitsui.api import ArrayEditor, Item, View 17 | from traitsui.menu import NoButtons 18 | 19 | 20 | class ArrayEditorTest(HasPrivateTraits): 21 | 22 | three = Array(np.int64, (3, 3)) 23 | 24 | four = Array( 25 | np.float64, 26 | (4, 4), 27 | editor=ArrayEditor(width=-50), 28 | ) 29 | 30 | view = View( 31 | Item('three', label='3x3 Integer'), 32 | '_', 33 | Item('three', label='Integer Read-only', style='readonly'), 34 | '_', 35 | Item('four', label='4x4 Float'), 36 | '_', 37 | Item('four', label='Float Read-only', style='readonly'), 38 | buttons=NoButtons, 39 | resizable=True, 40 | ) 41 | 42 | 43 | demo = ArrayEditorTest() 44 | 45 | if __name__ == '__main__': 46 | demo.configure_traits() 47 | -------------------------------------------------------------------------------- /traitsui/examples/demo/Standard_Editors/index.rst: -------------------------------------------------------------------------------- 1 | These examples demonstrate how the Standard Editors available in TraitsUI can be used. -------------------------------------------------------------------------------- /traitsui/examples/demo/examples.cfg: -------------------------------------------------------------------------------- 1 | [global] 2 | destdir = TraitsUI 3 | 4 | 5 | [Traits UI Uber-demo] 6 | files = demo.py, traits_ui_demo.jpg, Advanced/*, Applications/*, Dynamic Forms/*, Extras/*, Standard Editors/*, Tools/*, Misc/*, images/* 7 | 8 | -------------------------------------------------------------------------------- /traitsui/examples/demo/index.rst: -------------------------------------------------------------------------------- 1 | .. image:: traits_ui_demo.jpg 2 | -------------------------------------------------------------------------------- /traitsui/examples/demo/traits_ui_demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/examples/demo/traits_ui_demo.jpg -------------------------------------------------------------------------------- /traitsui/extras/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/extras/__init__.py -------------------------------------------------------------------------------- /traitsui/extras/_demo_info.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ This module provides the metadata to contribute example files for 12 | the ETS demo application. 13 | """ 14 | 15 | import pkg_resources 16 | 17 | 18 | def info(request): 19 | """Return a configuration for contributing demo examples to the 20 | Demo application. 21 | 22 | Parameters 23 | ---------- 24 | request : dict 25 | Information provided by the demo application. 26 | Currently this is a placeholder. 27 | 28 | Returns 29 | ------- 30 | response : dict 31 | """ 32 | return dict( 33 | version=1, 34 | name="TraitsUI Demo", 35 | root=pkg_resources.resource_filename("traitsui", "examples/demo"), 36 | ) 37 | -------------------------------------------------------------------------------- /traitsui/extras/api.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines 'pseudo' package that imports all of the traits extras symbols. 12 | """ 13 | 14 | 15 | from .checkbox_column import CheckboxColumn 16 | from .edit_column import EditColumn 17 | from .has_dynamic_views import ( 18 | DynamicView, 19 | DynamicViewSubElement, 20 | HasDynamicViews, 21 | ) 22 | from .progress_column import ProgressColumn 23 | from .saving import CanSaveMixin, SaveHandler 24 | -------------------------------------------------------------------------------- /traitsui/extras/demo.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # This module preserves the entry point for other ETS package's example script 12 | # to import. 13 | # This entry point should be deprecated once ets-demo is released. 14 | 15 | from ._demo_legacy import demo 16 | -------------------------------------------------------------------------------- /traitsui/extras/edit_column.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the table column descriptor used for editing the object represented 12 | by the row 13 | """ 14 | 15 | 16 | from ..table_column import ObjectColumn 17 | 18 | 19 | class EditColumn(ObjectColumn): 20 | def __init__(self, **traits): 21 | """Initializes the object.""" 22 | super().__init__(**traits) 23 | 24 | from traitsui.toolkit import toolkit_object 25 | 26 | EditRenderer = toolkit_object('extra.edit_renderer:EditRenderer') 27 | self.renderer = EditRenderer() 28 | 29 | self.label = "" 30 | 31 | def get_cell_color(self, object): 32 | """Returns the cell background color for the column for a specified 33 | object. 34 | """ 35 | 36 | # Override the parent class to ALWAYS provide the standard color: 37 | return self.cell_color_ 38 | 39 | def is_editable(self, object): 40 | """Returns whether the column is editable for a specified object.""" 41 | return False 42 | -------------------------------------------------------------------------------- /traitsui/extras/images/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/extras/images/next.png -------------------------------------------------------------------------------- /traitsui/extras/images/parent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/extras/images/parent.png -------------------------------------------------------------------------------- /traitsui/extras/images/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/extras/images/previous.png -------------------------------------------------------------------------------- /traitsui/extras/images/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/extras/images/reload.png -------------------------------------------------------------------------------- /traitsui/extras/images/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/extras/images/run.png -------------------------------------------------------------------------------- /traitsui/images/frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/images/frame.png -------------------------------------------------------------------------------- /traitsui/mimedata.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # Import the toolkit specific version. 12 | from traitsui.toolkit import toolkit_object 13 | 14 | # WIP: Currently only supports qt backend. API might change without 15 | # prior notification 16 | PyMimeData = toolkit_object("clipboard:PyMimeData") 17 | -------------------------------------------------------------------------------- /traitsui/null/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Define the concrete implementations of the traits Toolkit interface for the 12 | 'null' (do nothing) user interface toolkit. This toolkit is provided to 13 | handle situations where no recognized traits-compatible UI toolkit is 14 | installed, but users still want to use traits for non-UI related tasks. 15 | """ 16 | 17 | # ------------------------------------------------------------------------- 18 | # Define the reference to the exported GUIToolkit object: 19 | # ------------------------------------------------------------------------- 20 | 21 | 22 | from . import toolkit 23 | 24 | toolkit = toolkit.GUIToolkit("traitsui", "null", "traitsui.null") 25 | -------------------------------------------------------------------------------- /traitsui/qt/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2008-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # ------------------------------------------------------------------------------ 12 | # Copyright (c) 2007, Riverbank Computing Limited 13 | # All rights reserved. 14 | # 15 | # This software is provided without warranty under the terms of the BSD license. 16 | # However, when used with the GPL version of PyQt the additional terms 17 | # described in the PyQt GPL exception also apply 18 | 19 | # 20 | # Author: Riverbank Computing Limited 21 | # ------------------------------------------------------------------------------ 22 | 23 | """ Defines the concrete implementations of the traits Toolkit interface for 24 | the PyQt user interface toolkit. 25 | """ 26 | 27 | # import pyface.qt before anything else is done so the sipapi 28 | # can be set correctly if needed 29 | import pyface.qt 30 | 31 | # ---------------------------------------------------------------------------- 32 | # Define the reference to the exported GUIToolkit object: 33 | # ---------------------------------------------------------------------------- 34 | 35 | from . import toolkit 36 | 37 | # Reference to the GUIToolkit object for Qt. 38 | toolkit = toolkit.GUIToolkit("traitsui", "qt", "traitsui.qt") 39 | -------------------------------------------------------------------------------- /traitsui/qt/array_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines array editors for the PyQt user interface toolkit. 12 | """ 13 | 14 | 15 | from traitsui.editors.array_editor import SimpleEditor as BaseSimpleEditor 16 | 17 | from .editor import Editor 18 | 19 | # ------------------------------------------------------------------------- 20 | # 'SimpleEditor' class: 21 | # ------------------------------------------------------------------------- 22 | 23 | 24 | class SimpleEditor(BaseSimpleEditor, Editor): 25 | """Simple style of editor for arrays.""" 26 | 27 | # FIXME: This class has been re-defined here simply so it inherits from the 28 | # PyQt Editor class. 29 | pass 30 | 31 | 32 | class ReadonlyEditor(SimpleEditor): 33 | 34 | #: Set the value of the readonly trait. 35 | readonly = True 36 | -------------------------------------------------------------------------------- /traitsui/qt/array_view_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.ui_editors.array_view_editor import ( 12 | _ArrayViewEditor as BaseArrayViewEditor, 13 | ) 14 | 15 | from .ui_editor import UIEditor 16 | 17 | # ------------------------------------------------------------------------- 18 | # '_ArrayViewEditor' class: 19 | # ------------------------------------------------------------------------- 20 | 21 | 22 | class _ArrayViewEditor(BaseArrayViewEditor, UIEditor): 23 | pass 24 | -------------------------------------------------------------------------------- /traitsui/qt/csv_list_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the various text editors for the Qt user interface toolkit. 12 | The module is mainly a place-folder for TextEditor factories that have 13 | been augmented to also listen to changes in the items of the list object. 14 | """ 15 | 16 | 17 | from .text_editor import SimpleEditor as QtSimpleEditor 18 | from .text_editor import CustomEditor as QtCustomEditor 19 | from .text_editor import ReadonlyEditor as QtReadonlyEditor 20 | from ..editors.csv_list_editor import _prepare_method, _dispose_method 21 | 22 | 23 | class SimpleEditor(QtSimpleEditor): 24 | """Simple Editor style for CSVListEditor.""" 25 | 26 | prepare = _prepare_method 27 | dispose = _dispose_method 28 | 29 | 30 | class CustomEditor(QtCustomEditor): 31 | """Custom Editor style for CSVListEditor.""" 32 | 33 | prepare = _prepare_method 34 | dispose = _dispose_method 35 | 36 | 37 | class ReadonlyEditor(QtReadonlyEditor): 38 | """Readonly Editor style for CSVListEditor.""" 39 | 40 | prepare = _prepare_method 41 | dispose = _dispose_method 42 | 43 | 44 | TextEditor = SimpleEditor 45 | -------------------------------------------------------------------------------- /traitsui/qt/data_frame_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.ui_editors.data_frame_editor import ( 12 | _DataFrameEditor as BaseDataFrameEditor, 13 | ) 14 | 15 | from .ui_editor import UIEditor 16 | 17 | 18 | class _DataFrameEditor(BaseDataFrameEditor, UIEditor): 19 | """Qt Toolkit implementation of the DataFrameEditor""" 20 | 21 | pass 22 | -------------------------------------------------------------------------------- /traitsui/qt/extra/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/qt/extra/__init__.py -------------------------------------------------------------------------------- /traitsui/qt/extra/led_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from pyface.qt import QtGui 12 | from traitsui.qt.editor import Editor 13 | from traitsui.basic_editor_factory import BasicEditorFactory 14 | from traits.api import Any, Undefined 15 | 16 | 17 | class _LEDEditor(Editor): 18 | def init(self, parent): 19 | self.control = QtGui.QLCDNumber() 20 | self.control.setSegmentStyle(QtGui.QLCDNumber.SegmentStyle.Flat) 21 | self.set_tooltip() 22 | 23 | def update_editor(self): 24 | self.control.display(self.str_value) 25 | 26 | 27 | class LEDEditor(BasicEditorFactory): 28 | 29 | #: The editor class to be created 30 | klass = _LEDEditor 31 | #: Alignment is not supported for QT backend 32 | alignment = Any(Undefined) 33 | -------------------------------------------------------------------------------- /traitsui/qt/images/closetab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/qt/images/closetab.png -------------------------------------------------------------------------------- /traitsui/qt/images/frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/qt/images/frame.png -------------------------------------------------------------------------------- /traitsui/qt/images/list_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/qt/images/list_editor.png -------------------------------------------------------------------------------- /traitsui/qt/images/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/qt/images/next.png -------------------------------------------------------------------------------- /traitsui/qt/images/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/qt/images/previous.png -------------------------------------------------------------------------------- /traitsui/qt/null_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines a completely empty editor, intended to be used as a spacer. 12 | """ 13 | 14 | 15 | from pyface.qt import QtGui 16 | 17 | from .editor import Editor 18 | 19 | 20 | class NullEditor(Editor): 21 | """A completely empty editor.""" 22 | 23 | def init(self, parent): 24 | """Finishes initializing the editor by creating the underlying toolkit 25 | widget. 26 | """ 27 | self.control = QtGui.QWidget() 28 | 29 | def update_editor(self): 30 | """Updates the editor when the object trait changes externally to the 31 | editor. 32 | """ 33 | pass 34 | -------------------------------------------------------------------------------- /traitsui/qt/shell_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Editor that displays an interactive Python shell. 12 | """ 13 | 14 | 15 | from traitsui.editors.shell_editor import _ShellEditor as BaseShellEditor 16 | 17 | from .editor import Editor 18 | 19 | # ------------------------------------------------------------------------- 20 | # 'ShellEditor' class: 21 | # ------------------------------------------------------------------------- 22 | 23 | 24 | class _ShellEditor(BaseShellEditor, Editor): 25 | """Editor that displays an interactive Python shell.""" 26 | 27 | def init(self, parent): 28 | super().init(None) 29 | -------------------------------------------------------------------------------- /traitsui/qt/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/qt/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/qt/tests/test_ui_base.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | import unittest 12 | 13 | from traits.api import HasTraits, Int 14 | from traitsui.api import Item, View 15 | from traitsui.tests._tools import ( 16 | create_ui, 17 | requires_toolkit, 18 | ToolkitName, 19 | ) 20 | 21 | 22 | class ObjectWithNumber(HasTraits): 23 | number = Int() 24 | 25 | 26 | @requires_toolkit([ToolkitName.qt]) 27 | class TestStickyDialog(unittest.TestCase): 28 | """Test _StickyDialog used by the UI's Qt backend.""" 29 | 30 | def test_sticky_dialog_with_parent(self): 31 | obj = ObjectWithNumber() 32 | obj2 = ObjectWithNumber() 33 | parent_view = View(Item("number"), title="Parent") 34 | nested = View(Item("number"), resizable=True, title="Nested") 35 | with create_ui(obj, dict(view=parent_view)) as ui: 36 | with create_ui(obj2, dict(parent=ui.control, view=nested)) as ui2: 37 | from pyface.qt import QtCore 38 | 39 | self.assertFalse( 40 | ui2.control.windowState() 41 | & QtCore.Qt.WindowState.WindowMaximized 42 | ) 43 | -------------------------------------------------------------------------------- /traitsui/qt/tuple_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2008-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # ------------------------------------------------------------------------------ 12 | # Copyright (c) 2007, Riverbank Computing Limited 13 | # All rights reserved. 14 | # 15 | # This software is provided without warranty under the terms of the BSD license. 16 | # However, when used with the GPL version of PyQt the additional terms 17 | # described in the PyQt GPL exception also apply 18 | 19 | # 20 | # Author: Riverbank Computing Limited 21 | # ------------------------------------------------------------------------------ 22 | 23 | """ Defines the tuple editor for the PyQt user interface toolkit. 24 | """ 25 | 26 | 27 | from traitsui.editors.tuple_editor import SimpleEditor as BaseSimpleEditor 28 | 29 | from .editor import Editor 30 | 31 | # ------------------------------------------------------------------------- 32 | # 'SimpleEditor' class: 33 | # ------------------------------------------------------------------------- 34 | 35 | 36 | class SimpleEditor(BaseSimpleEditor, Editor): 37 | """Simple style of editor for tuples. 38 | 39 | The editor displays an editor for each of the fields in the tuple, based on 40 | the type of each field. 41 | """ 42 | 43 | pass 44 | -------------------------------------------------------------------------------- /traitsui/qt/ui_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the BasicUIEditor class, which allows creating editors that define 12 | their function by creating an embedded Traits UI. 13 | """ 14 | 15 | 16 | from traitsui.ui_editor import UIEditor as BaseUIEditor 17 | 18 | from .editor import Editor 19 | 20 | # ------------------------------------------------------------------------- 21 | # 'UIEditor' base class: 22 | # ------------------------------------------------------------------------- 23 | 24 | 25 | class UIEditor(BaseUIEditor, Editor): 26 | """An editor that creates an embedded Traits UI.""" 27 | 28 | pass 29 | -------------------------------------------------------------------------------- /traitsui/qt/value_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the tree-based Python value editor and the value editor factory, 12 | for the wxPython user interface toolkit. 13 | """ 14 | 15 | 16 | from traitsui.editors.value_editor import _ValueEditor 17 | 18 | from .editor import Editor 19 | 20 | 21 | class SimpleEditor(_ValueEditor, Editor): 22 | """Returns the editor to use for simple style views.""" 23 | 24 | #: Override the value of the readonly trait. 25 | readonly = False 26 | 27 | 28 | class ReadonlyEditor(_ValueEditor, Editor): 29 | """Returns the editor to use for readonly style views.""" 30 | 31 | #: Override the value of the readonly trait. 32 | readonly = True 33 | -------------------------------------------------------------------------------- /traitsui/testing/README.txt: -------------------------------------------------------------------------------- 1 | ./__init__.py -------------------------------------------------------------------------------- /traitsui/testing/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ 12 | This package provide functionality to help testing GUI applications built 13 | using TraitsUI. 14 | 15 | The top-level ``api`` module re-exposes the public API for convenience. 16 | 17 | Private modules in this package serve TraitsUI only. 18 | """ 19 | -------------------------------------------------------------------------------- /traitsui/testing/data/test.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/testing/data/test.mp4 -------------------------------------------------------------------------------- /traitsui/testing/tester/README.txt: -------------------------------------------------------------------------------- 1 | ./__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ 12 | This package contains library code for testing TraitsUI applications via 13 | ``UITester`` (in ``ui_tester`` module). 14 | 15 | Other public modules are also part of the public API. 16 | 17 | ``_ui_tester_registry`` contains internal implementations to support testing 18 | TraitsUI UI and editors. 19 | 20 | The only modules/packages that are specific about TraitsUI UI and editors are 21 | ``ui_tester`` and ``_ui_tester_registry``. The other modules are generic enough 22 | to be used with GUI components external to TraitsUI. This allows extensions 23 | beyond the scope of TraitsUI. 24 | """ 25 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/README.txt: -------------------------------------------------------------------------------- 1 | ./__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ This package contains implementations for supporting testing with TraitsUI 12 | UI and editors. 13 | 14 | The top-level module ``default_registry`` supplies the implementation to 15 | the ``UITester`` and hides implementation details internal to this package. 16 | """ 17 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/_compat.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ This module contains functions used by toolkit specific implementation for 12 | normalizing differences among toolkits (Qt and Wx). 13 | """ 14 | 15 | 16 | def check_key_compat(key): 17 | """Check if the given key is a unicode character within the range of 18 | values currently supported for emulating key sequences on both Qt and Wx 19 | textboxes. 20 | 21 | Parameters 22 | ---------- 23 | key : str 24 | A unicode character 25 | 26 | Raises 27 | ------ 28 | ValueError 29 | If the unicode character is not within the supported range of values. 30 | """ 31 | # Support for more characters can be added when there are needs. 32 | if ord(key) < 32 or ord(key) >= 127: 33 | raise ValueError( 34 | f"Key {key!r} is currently not supported. " 35 | f"Supported characters between code point 32 - 126." 36 | ) 37 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/README.txt: -------------------------------------------------------------------------------- 1 | ./__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ This package contains implementations for testing TraitsUI UI editors 12 | with Qt. 13 | 14 | The top-level module ``default_registry`` serves external packages and hides 15 | implementation details internal to this package. 16 | """ 17 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/_traitsui/README.txt: -------------------------------------------------------------------------------- 1 | ./__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/_traitsui/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ The organization in this package should more or less mirror that of 12 | the ``traitsui.qt`` package and contains the corresponding logic for testing. 13 | 14 | Note that once new implementations are added, they may need to be exposed 15 | via the ``default_registry`` module (one level up from this package). 16 | """ 17 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/_traitsui/directory_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.testing.tester._ui_tester_registry.qt._registry_helper import ( 12 | register_editable_textbox_handlers, 13 | ) 14 | from traitsui.qt.directory_editor import SimpleEditor 15 | 16 | 17 | def register(registry): 18 | """Register interactions for the given registry. 19 | 20 | If there are any conflicts, an error will occur. 21 | 22 | Parameters 23 | ---------- 24 | registry : TargetRegistry 25 | The registry being registered to. 26 | """ 27 | 28 | register_editable_textbox_handlers( 29 | registry=registry, 30 | target_class=SimpleEditor, 31 | widget_getter=lambda wrapper: wrapper._target._file_name, 32 | ) 33 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/_traitsui/editor_factory.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.testing.tester.query import DisplayedText 12 | from traitsui.testing.tester._ui_tester_registry.qt._registry_helper import ( 13 | register_editable_textbox_handlers, 14 | ) 15 | from traitsui.qt.editor_factory import ReadonlyEditor, TextEditor 16 | 17 | 18 | def register(registry): 19 | """Register interactions for the given registry. 20 | 21 | If there are any conflicts, an error will occur. 22 | 23 | Parameters 24 | ---------- 25 | registry : TargetRegistry 26 | The registry being registered to. 27 | """ 28 | 29 | register_editable_textbox_handlers( 30 | registry=registry, 31 | target_class=TextEditor, 32 | widget_getter=lambda wrapper: wrapper._target.control, 33 | ) 34 | registry.register_interaction( 35 | target_class=ReadonlyEditor, 36 | interaction_class=DisplayedText, 37 | handler=lambda wrapper, _: wrapper._target.control.text(), 38 | ) 39 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/_traitsui/file_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.testing.tester._ui_tester_registry.qt._registry_helper import ( 12 | register_editable_textbox_handlers, 13 | ) 14 | from traitsui.qt.file_editor import SimpleEditor 15 | 16 | 17 | def register(registry): 18 | """Register interactions for the given registry. 19 | 20 | If there are any conflicts, an error will occur. 21 | 22 | Parameters 23 | ---------- 24 | registry : TargetRegistry 25 | The registry being registered to. 26 | """ 27 | 28 | register_editable_textbox_handlers( 29 | registry=registry, 30 | target_class=SimpleEditor, 31 | widget_getter=lambda wrapper: wrapper._target._file_name, 32 | ) 33 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/_traitsui/font_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.testing.tester._ui_tester_registry.qt._registry_helper import ( 12 | register_editable_textbox_handlers, 13 | ) 14 | from traitsui.qt.font_editor import TextFontEditor 15 | 16 | 17 | def register(registry): 18 | """Register interactions pertaining to (Qt) FontEditor for the given 19 | registry. 20 | 21 | Parameters 22 | ---------- 23 | registry : TargetRegistry 24 | The registry being registered to. 25 | """ 26 | register_editable_textbox_handlers( 27 | registry=registry, 28 | target_class=TextFontEditor, 29 | widget_getter=lambda wrapper: wrapper._target.control, 30 | ) 31 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/_traitsui/ui_base.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.qt.ui_base import ButtonEditor 12 | from traitsui.testing.tester.command import MouseClick 13 | from traitsui.testing.tester.query import DisplayedText 14 | from traitsui.testing.tester._ui_tester_registry.qt import ( 15 | _interaction_helpers, 16 | ) 17 | 18 | 19 | def register(registry): 20 | """Register solvers/handlers specific to qt ui_base Editors 21 | for the given registry. 22 | 23 | If there are any conflicts, an error will occur. 24 | 25 | Parameters 26 | ---------- 27 | registry : TargetRegistry 28 | """ 29 | handlers = [ 30 | ( 31 | MouseClick, 32 | ( 33 | lambda wrapper, _: _interaction_helpers.mouse_click_qwidget( 34 | wrapper._target.control, wrapper.delay 35 | ) 36 | ), 37 | ), 38 | (DisplayedText, lambda wrapper, _: wrapper._target.control.text()), 39 | ] 40 | for interaction_class, handler in handlers: 41 | registry.register_interaction( 42 | target_class=ButtonEditor, 43 | interaction_class=interaction_class, 44 | handler=handler, 45 | ) 46 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/qt/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/testing/tester/_ui_tester_registry/qt/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/testing/tester/_ui_tester_registry/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/tests/test_default_registry.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | import unittest 12 | 13 | from traitsui.testing.tester._abstract_target_registry import ( 14 | AbstractTargetRegistry, 15 | ) 16 | from traitsui.testing.tester._ui_tester_registry.default_registry import ( 17 | get_default_registries, 18 | ) 19 | 20 | 21 | class TestDefaultRegistry(unittest.TestCase): 22 | def test_load_default_registries(self): 23 | registries = get_default_registries() 24 | for registry in registries: 25 | self.assertIsInstance(registry, AbstractTargetRegistry) 26 | 27 | self.assertGreaterEqual(len(registries), 1) 28 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/README.txt: -------------------------------------------------------------------------------- 1 | ./__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ This package contains implementations for testing TraitsUI UI editors 12 | with Wx. 13 | 14 | The top-level module ``default_registry`` serves external packages and hides 15 | implementation details internal to this package. 16 | """ 17 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/README.txt: -------------------------------------------------------------------------------- 1 | ./__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ The organization in this package should more or less mirror that of 12 | the ``traitsui.wx`` package and contains the corresponding logic for testing. 13 | 14 | Note that once new implementations are added, they may need to be exposed 15 | via the ``default_registry`` module (one level up from this package). 16 | """ 17 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/directory_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.wx.directory_editor import SimpleEditor 12 | from traitsui.testing.tester._ui_tester_registry.wx._registry_helper import ( 13 | register_editable_textbox_handlers, 14 | ) 15 | 16 | 17 | def register(registry): 18 | """Register interactions for the given registry. 19 | 20 | If there are any conflicts, an error will occur. 21 | 22 | Parameters 23 | ---------- 24 | registry : TargetRegistry 25 | The registry being registered to. 26 | """ 27 | register_editable_textbox_handlers( 28 | registry=registry, 29 | target_class=SimpleEditor, 30 | widget_getter=lambda wrapper: wrapper._target._file_name, 31 | ) 32 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/editor_factory.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.wx.editor_factory import ReadonlyEditor, TextEditor 12 | from traitsui.testing.tester.query import DisplayedText 13 | from traitsui.testing.tester._ui_tester_registry.wx import _interaction_helpers 14 | from traitsui.testing.tester._ui_tester_registry.wx._registry_helper import ( 15 | register_editable_textbox_handlers, 16 | ) 17 | 18 | 19 | def register(registry): 20 | """Register interactions for the given registry. 21 | 22 | If there are any conflicts, an error will occur. 23 | 24 | Parameters 25 | ---------- 26 | registry : TargetRegistry 27 | The registry being registered to. 28 | """ 29 | register_editable_textbox_handlers( 30 | registry=registry, 31 | target_class=TextEditor, 32 | widget_getter=lambda wrapper: wrapper._target.control, 33 | ) 34 | registry.register_interaction( 35 | target_class=ReadonlyEditor, 36 | interaction_class=DisplayedText, 37 | handler=lambda wrapper, _: _interaction_helpers.readonly_textbox_displayed_text( 38 | wrapper._target.control 39 | ), 40 | ) 41 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/file_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.wx.file_editor import SimpleEditor 12 | from traitsui.testing.tester._ui_tester_registry.wx._registry_helper import ( 13 | register_editable_textbox_handlers, 14 | ) 15 | 16 | 17 | def register(registry): 18 | """Register interactions for the given registry. 19 | 20 | If there are any conflicts, an error will occur. 21 | 22 | Parameters 23 | ---------- 24 | registry : TargetRegistry 25 | The registry being registered to. 26 | """ 27 | register_editable_textbox_handlers( 28 | registry=registry, 29 | target_class=SimpleEditor, 30 | widget_getter=lambda wrapper: wrapper._target._file_name, 31 | ) 32 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/font_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.testing.tester._ui_tester_registry.wx._registry_helper import ( 12 | register_editable_textbox_handlers, 13 | ) 14 | from traitsui.wx.font_editor import TextFontEditor 15 | 16 | 17 | def register(registry): 18 | """Register interactions pertaining to (wx) FontEditor for the given 19 | registry. 20 | 21 | Parameters 22 | ---------- 23 | registry : TargetRegistry 24 | The registry being registered to. 25 | """ 26 | register_editable_textbox_handlers( 27 | registry=registry, 28 | target_class=TextFontEditor, 29 | widget_getter=lambda wrapper: wrapper._target.control, 30 | ) 31 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/_traitsui/ui_base.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.wx.ui_base import ButtonEditor 12 | from traitsui.testing.tester.command import MouseClick 13 | from traitsui.testing.tester.query import DisplayedText 14 | from traitsui.testing.tester._ui_tester_registry.wx import _interaction_helpers 15 | 16 | 17 | def register(registry): 18 | """Register solvers/handlers specific to wx Button Editors 19 | for the given registry. 20 | 21 | If there are any conflicts, an error will occur. 22 | 23 | Parameters 24 | ---------- 25 | registry : TargetRegistry 26 | """ 27 | 28 | registry.register_interaction( 29 | target_class=ButtonEditor, 30 | interaction_class=MouseClick, 31 | handler=( 32 | lambda wrapper, _: _interaction_helpers.mouse_click_button( 33 | control=wrapper._target.control, delay=wrapper.delay 34 | ) 35 | ), 36 | ) 37 | 38 | registry.register_interaction( 39 | target_class=ButtonEditor, 40 | interaction_class=DisplayedText, 41 | handler=lambda wrapper, _: wrapper._target.control.GetLabel(), 42 | ) 43 | -------------------------------------------------------------------------------- /traitsui/testing/tester/_ui_tester_registry/wx/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/testing/tester/_ui_tester_registry/wx/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tester/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/testing/tester/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/testing/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/testing/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/tests/editors/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/tests/editors/__init__.py -------------------------------------------------------------------------------- /traitsui/tests/editors/test_font_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Test FontEditor 12 | """ 13 | import unittest 14 | 15 | from traits.api import HasTraits 16 | from traitsui.api import Font, Item, View 17 | from traitsui.tests._tools import ( 18 | requires_toolkit, 19 | ToolkitName, 20 | ) 21 | from traitsui.testing.api import MouseClick, UITester 22 | 23 | 24 | class ObjectWithFont(HasTraits): 25 | font_trait = Font() 26 | 27 | 28 | @requires_toolkit([ToolkitName.qt, ToolkitName.wx]) 29 | class TestFontEditor(unittest.TestCase): 30 | def test_create_and_dispose_text_style(self): 31 | # Setting focus on the widget and then disposing the widget 32 | # should not cause errors. 33 | view = View(Item("font_trait", style="text")) 34 | tester = UITester() 35 | with tester.create_ui(ObjectWithFont(), dict(view=view)) as ui: 36 | wrapper = tester.find_by_name(ui, "font_trait") 37 | wrapper.perform(MouseClick()) 38 | -------------------------------------------------------------------------------- /traitsui/tests/editors/test_liststr_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ 12 | Test case for ListStrEditor and ListStrAdapter 13 | """ 14 | import unittest 15 | 16 | from traits.has_traits import HasTraits 17 | from traits.trait_types import List, Str 18 | from traitsui.list_str_adapter import ListStrAdapter 19 | from traitsui.tests._tools import BaseTestMixin 20 | 21 | 22 | class TraitObject(HasTraits): 23 | list_str = List(Str) 24 | 25 | 26 | class TestListStrAdapter(BaseTestMixin, unittest.TestCase): 27 | def setUp(self): 28 | BaseTestMixin.setUp(self) 29 | 30 | def tearDown(self): 31 | BaseTestMixin.tearDown(self) 32 | 33 | def test_list_str_adapter_length(self): 34 | """Test the ListStringAdapter len method""" 35 | 36 | object = TraitObject() 37 | object.list_str = ["hello"] 38 | 39 | adapter = ListStrAdapter() 40 | 41 | self.assertEqual(adapter.len(object, "list_str"), 1) 42 | self.assertEqual(adapter.len(None, "list_str"), 0) 43 | -------------------------------------------------------------------------------- /traitsui/tests/null_backend/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/tests/null_backend/__init__.py -------------------------------------------------------------------------------- /traitsui/tests/null_backend/test_null_toolkit.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | import unittest 12 | 13 | from traits.api import HasTraits, Int 14 | from traitsui.tests._tools import BaseTestMixin, requires_toolkit, ToolkitName 15 | 16 | 17 | class TestNullToolkit(BaseTestMixin, unittest.TestCase): 18 | def setUp(self): 19 | BaseTestMixin.setUp(self) 20 | 21 | def tearDown(self): 22 | BaseTestMixin.tearDown(self) 23 | 24 | @requires_toolkit([ToolkitName.null]) 25 | def test_configure_traits_error(self): 26 | """Verify that configure_traits fails with NotImplementedError.""" 27 | 28 | class Test(HasTraits): 29 | x = Int() 30 | 31 | t = Test() 32 | 33 | with self.assertRaises(NotImplementedError): 34 | t.configure_traits() 35 | -------------------------------------------------------------------------------- /traitsui/tests/test_controller.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ 12 | Test cases for the Controller class. 13 | """ 14 | 15 | import unittest 16 | 17 | from traits.api import HasTraits, Instance, Str 18 | from traitsui.api import Controller 19 | from traitsui.tests._tools import BaseTestMixin 20 | 21 | 22 | class FooModel(HasTraits): 23 | my_str = Str("hallo") 24 | 25 | 26 | class FooController(Controller): 27 | """Test dialog that does nothing useful.""" 28 | 29 | model = Instance(FooModel) 30 | 31 | def _model_default(self): 32 | return FooModel(my_str="meh") 33 | 34 | 35 | class TestController(BaseTestMixin, unittest.TestCase): 36 | def setUp(self): 37 | BaseTestMixin.setUp(self) 38 | 39 | def tearDown(self): 40 | BaseTestMixin.tearDown(self) 41 | 42 | def test_construction(self): 43 | # check default constructor. 44 | dialog = FooController() 45 | self.assertIsNotNone(dialog.model) 46 | self.assertEqual(dialog.model.my_str, "meh") 47 | 48 | # check initialization when `model` is explcitly passed in. 49 | new_model = FooModel() 50 | dialog = FooController(model=new_model) 51 | self.assertIs(dialog.model, new_model) 52 | -------------------------------------------------------------------------------- /traitsui/tests/test_editors_imports.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | import unittest 12 | 13 | 14 | class TestEditorsImports(unittest.TestCase): 15 | 16 | def test_editors_import_warns(self): 17 | # Importing from traitsui.editors is deprecated 18 | with self.assertWarns(DeprecationWarning): 19 | from traitsui.editors import BooleanEditor 20 | -------------------------------------------------------------------------------- /traitsui/tests/test_shadow_group.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Tests for the ShadowGroup class. 12 | """ 13 | 14 | import unittest 15 | 16 | from traitsui.api import Group 17 | from traitsui.group import ShadowGroup 18 | 19 | from traitsui.tests._tools import BaseTestMixin 20 | 21 | 22 | class TestShadowGroup(BaseTestMixin, unittest.TestCase): 23 | def setUp(self): 24 | BaseTestMixin.setUp(self) 25 | 26 | def tearDown(self): 27 | BaseTestMixin.tearDown(self) 28 | 29 | def test_creation_sets_shadow_first(self): 30 | group = Group() 31 | # We end up with a DelegationError if the 'shadow' trait is not set 32 | # first. Initialization order is dependent on dictionary order, which 33 | # we can't control, so we throw in a good number of other traits to 34 | # increase the chance that some other trait is set first. 35 | ShadowGroup( 36 | label="dummy", 37 | show_border=True, 38 | show_labels=True, 39 | show_left=True, 40 | orientation="horizontal", 41 | scrollable=True, 42 | shadow=group, 43 | ) 44 | -------------------------------------------------------------------------------- /traitsui/tests/test_toolkit_traits.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | import unittest 11 | 12 | from traits.api import HasTraits 13 | 14 | from traitsui.toolkit_traits import RGBColor 15 | 16 | 17 | class HasRGBColor(HasTraits): 18 | color = RGBColor() 19 | 20 | 21 | class TestRGBColor(unittest.TestCase): 22 | 23 | # regression test for enthought/traitsui#1531 24 | def test_hex_converion(self): 25 | has_rgb_color = HasRGBColor() 26 | has_rgb_color.color = 0x000000 27 | self.assertEqual(has_rgb_color.color, (0.0, 0.0, 0.0)) 28 | -------------------------------------------------------------------------------- /traitsui/tests/ui_editors/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/tests/ui_editors/__init__.py -------------------------------------------------------------------------------- /traitsui/ui_editors/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/ui_editors/__init__.py -------------------------------------------------------------------------------- /traitsui/wx/__init__.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the concrete implementations of the traits Toolkit interface for 12 | the wxPython user interface toolkit. 13 | """ 14 | 15 | # ------------------------------------------------------------------------- 16 | # Define the reference to the exported GUIToolkit object: 17 | # ------------------------------------------------------------------------- 18 | 19 | from . import toolkit 20 | 21 | # Reference to the GUIToolkit object for wxPython 22 | toolkit = toolkit.GUIToolkit("traitsui", "wx", "traitsui.wx") 23 | -------------------------------------------------------------------------------- /traitsui/wx/array_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines array editors for the WX user interface toolkit. 12 | """ 13 | 14 | 15 | from traitsui.editors.array_editor import SimpleEditor as BaseSimpleEditor 16 | 17 | from .editor import Editor 18 | 19 | # ------------------------------------------------------------------------- 20 | # 'SimpleEditor' class: 21 | # ------------------------------------------------------------------------- 22 | 23 | 24 | class SimpleEditor(BaseSimpleEditor, Editor): 25 | """Simple style of editor for arrays.""" 26 | 27 | # FIXME: This class has been re-defined here simply so it inherits from the 28 | # wx Editor class. 29 | pass 30 | 31 | 32 | class ReadonlyEditor(SimpleEditor): 33 | 34 | #: Set the value of the readonly trait. 35 | readonly = True 36 | -------------------------------------------------------------------------------- /traitsui/wx/array_view_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.ui_editors.array_view_editor import ( 12 | _ArrayViewEditor as BaseArrayViewEditor, 13 | ) 14 | 15 | from .ui_editor import UIEditor 16 | 17 | # ------------------------------------------------------------------------- 18 | # '_ArrayViewEditor' class: 19 | # ------------------------------------------------------------------------- 20 | 21 | 22 | class _ArrayViewEditor(BaseArrayViewEditor, UIEditor): 23 | pass 24 | -------------------------------------------------------------------------------- /traitsui/wx/csv_list_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the various text editors for the wxPython user interface toolkit. 12 | The module is mainly a place-folder for TextEditor factories that have 13 | been augmented to also listen to changes in the items of the list object. 14 | 15 | """ 16 | 17 | 18 | from .text_editor import SimpleEditor as WXSimpleEditor 19 | from .text_editor import CustomEditor as WXCustomEditor 20 | from .text_editor import ReadonlyEditor as WXReadonlyEditor 21 | from ..editors.csv_list_editor import _prepare_method, _dispose_method 22 | 23 | 24 | class SimpleEditor(WXSimpleEditor): 25 | """Simple Editor style for CSVListEditor.""" 26 | 27 | prepare = _prepare_method 28 | dispose = _dispose_method 29 | 30 | 31 | class CustomEditor(WXCustomEditor): 32 | """Custom Editor style for CSVListEditor.""" 33 | 34 | prepare = _prepare_method 35 | dispose = _dispose_method 36 | 37 | 38 | class ReadonlyEditor(WXReadonlyEditor): 39 | """Readonly Editor style for CSVListEditor.""" 40 | 41 | prepare = _prepare_method 42 | dispose = _dispose_method 43 | 44 | 45 | TextEditor = SimpleEditor 46 | -------------------------------------------------------------------------------- /traitsui/wx/data_frame_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | from traitsui.ui_editors.data_frame_editor import ( 12 | _DataFrameEditor as BaseDataFrameEditor, 13 | ) 14 | 15 | from .ui_editor import UIEditor 16 | 17 | 18 | class _DataFrameEditor(BaseDataFrameEditor, UIEditor): 19 | """Wx Toolkit implementation of the DataFrameEditor""" 20 | 21 | pass 22 | -------------------------------------------------------------------------------- /traitsui/wx/extra/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/extra/__init__.py -------------------------------------------------------------------------------- /traitsui/wx/extra/windows/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/extra/windows/__init__.py -------------------------------------------------------------------------------- /traitsui/wx/images/cb_hover_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/cb_hover_off.png -------------------------------------------------------------------------------- /traitsui/wx/images/cb_hover_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/cb_hover_on.png -------------------------------------------------------------------------------- /traitsui/wx/images/cb_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/cb_off.png -------------------------------------------------------------------------------- /traitsui/wx/images/cb_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/cb_on.png -------------------------------------------------------------------------------- /traitsui/wx/images/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/file.png -------------------------------------------------------------------------------- /traitsui/wx/images/frame.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/frame.ico -------------------------------------------------------------------------------- /traitsui/wx/images/group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/group.png -------------------------------------------------------------------------------- /traitsui/wx/images/hs_color_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/hs_color_map.png -------------------------------------------------------------------------------- /traitsui/wx/images/item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/item.png -------------------------------------------------------------------------------- /traitsui/wx/images/list_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/list_editor.png -------------------------------------------------------------------------------- /traitsui/wx/images/nb_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/nb_open.png -------------------------------------------------------------------------------- /traitsui/wx/images/object.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/object.png -------------------------------------------------------------------------------- /traitsui/wx/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/open.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_add.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_colors.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_delete.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_delete_synthetic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_delete_synthetic.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_display.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_move_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_move_down.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_move_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_move_up.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_no_sort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_no_sort.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_prefs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_prefs.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_search.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_synthetic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_synthetic.png -------------------------------------------------------------------------------- /traitsui/wx/images/table_undelete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/images/table_undelete.png -------------------------------------------------------------------------------- /traitsui/wx/null_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines a completely empty editor, intended to be used as a spacer. 12 | """ 13 | 14 | 15 | import wx 16 | 17 | from .editor import Editor 18 | 19 | 20 | class NullEditor(Editor): 21 | """A completely empty editor.""" 22 | 23 | def init(self, parent): 24 | """Finishes initializing the editor by creating the underlying toolkit 25 | widget. 26 | """ 27 | self.control = control = wx.Window(parent, -1, size=wx.Size(1, 1)) 28 | control.SetBackgroundColour(parent.GetBackgroundColour()) 29 | 30 | def update_editor(self): 31 | """Updates the editor when the object trait changes externally to the 32 | editor. 33 | """ 34 | pass 35 | -------------------------------------------------------------------------------- /traitsui/wx/popup_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | # FIXME: PopupEditor is a proxy class defined here just for backward 12 | # compatibility. The class (which represents the editor factory) has been moved 13 | # to the traitsui.editors.list_editor file. 14 | from traitsui.editors.popup_editor import ( 15 | _PopupEditor as BasePopupEditor, 16 | PopupEditor, 17 | ) 18 | 19 | from .ui_editor import UIEditor 20 | 21 | # ------------------------------------------------------------------------- 22 | # '_PopupEditor' class: 23 | # ------------------------------------------------------------------------- 24 | 25 | 26 | class _PopupEditor(BasePopupEditor, UIEditor): 27 | pass 28 | -------------------------------------------------------------------------------- /traitsui/wx/shell_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Editor that displays an interactive Python shell. 12 | """ 13 | 14 | 15 | from traitsui.editors.shell_editor import _ShellEditor as BaseShellEditor 16 | 17 | from .editor import Editor 18 | 19 | # ------------------------------------------------------------------------- 20 | # 'ShellEditor' class: 21 | # ------------------------------------------------------------------------- 22 | 23 | 24 | class _ShellEditor(BaseShellEditor, Editor): 25 | """Editor that displays an interactive Python shell.""" 26 | 27 | pass 28 | -------------------------------------------------------------------------------- /traitsui/wx/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/enthought/traitsui/b3673a74c6a2317d0813947290e949eedff204f5/traitsui/wx/tests/__init__.py -------------------------------------------------------------------------------- /traitsui/wx/tuple_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the tuple editor for the wxPython user interface toolkit. 12 | """ 13 | 14 | 15 | from traitsui.editors.tuple_editor import SimpleEditor as BaseSimpleEditor 16 | 17 | from .editor import Editor 18 | 19 | # ------------------------------------------------------------------------- 20 | # 'SimpleEditor' class: 21 | # ------------------------------------------------------------------------- 22 | 23 | 24 | class SimpleEditor(BaseSimpleEditor, Editor): 25 | """Simple style of editor for tuples. 26 | 27 | The editor displays an editor for each of the fields in the tuple, 28 | based on the type of each field. 29 | """ 30 | 31 | pass 32 | -------------------------------------------------------------------------------- /traitsui/wx/ui_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the BasicUIEditor class, which allows creating editors that define 12 | their function by creating an embedded Traits UI. 13 | """ 14 | 15 | 16 | from traitsui.ui_editor import UIEditor as BaseUIEditor 17 | 18 | from .editor import Editor 19 | 20 | # ------------------------------------------------------------------------- 21 | # 'UIEditor' base class: 22 | # ------------------------------------------------------------------------- 23 | 24 | 25 | class UIEditor(BaseUIEditor, Editor): 26 | """An editor that creates an embedded Traits UI.""" 27 | 28 | pass 29 | 30 | 31 | # -- End UI preference save/restore interface ----------------------------- 32 | -------------------------------------------------------------------------------- /traitsui/wx/value_editor.py: -------------------------------------------------------------------------------- 1 | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX 2 | # All rights reserved. 3 | # 4 | # This software is provided without warranty under the terms of the BSD 5 | # license included in LICENSE.txt and may be redistributed only under 6 | # the conditions described in the aforementioned license. The license 7 | # is also available online at http://www.enthought.com/licenses/BSD.txt 8 | # 9 | # Thanks for using Enthought open source! 10 | 11 | """ Defines the tree-based Python value editor and the value editor factory, 12 | for the wxPython user interface toolkit. 13 | """ 14 | 15 | 16 | from traitsui.editors.value_editor import _ValueEditor 17 | 18 | from .editor import Editor 19 | 20 | 21 | class SimpleEditor(_ValueEditor, Editor): 22 | """Returns the editor to use for simple style views.""" 23 | 24 | #: Override the value of the readonly trait. 25 | readonly = False 26 | 27 | 28 | class ReadonlyEditor(_ValueEditor, Editor): 29 | """Returns the editor to use for readonly style views.""" 30 | 31 | #: Override the value of the readonly trait. 32 | readonly = True 33 | --------------------------------------------------------------------------------