From 8827954d04c9aa34ed6912e4425b3563b10c35ba Mon Sep 17 00:00:00 2001 From: John Wiggins Date: Fri, 19 Mar 2021 13:10:28 +0100 Subject: [PATCH 1/2] Add documentation for ComponentEditor --- docs/source/enable/traitsui.rst | 27 +++++++++++++++++++++++++++ docs/source/index.rst | 1 + 2 files changed, 28 insertions(+) create mode 100644 docs/source/enable/traitsui.rst diff --git a/docs/source/enable/traitsui.rst b/docs/source/enable/traitsui.rst new file mode 100644 index 000000000..dc923554b --- /dev/null +++ b/docs/source/enable/traitsui.rst @@ -0,0 +1,27 @@ +Enable TraitsUI Editors +======================= +To facilitate the inclusion of Enable :class:`~.Component` objects in +`TraitsUI GUIs `_, Enable provides +:class:`~.ComponentEditor`. + +ComponentEditor +--------------- +:class:`~.ComponentEditor` is a fairly simple editor. It only has a few traits +which are of interest to users: + +bgcolor +~~~~~~~ +``bgcolor`` is a :class:`ColorTrait` which can be used to specify the background +color of the component. The default value is ``"sys_window"``, which may or may +not match the default window background color of the GUI toolkit you are using. + +high_resolution +~~~~~~~~~~~~~~~ +``high_resolution`` is a boolean which, if True, tells Enable that you would +like your component to take advantage of HiDPI displays if the GUI toolkit +supports it. The default value is True. + +size +~~~~ +``size`` is a tuple of integers which can be used to specify the initial size of +the component in a GUI. The default value is ``(400, 400)``. diff --git a/docs/source/index.rst b/docs/source/index.rst index 43a04e6e3..35bb9b5a4 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -30,6 +30,7 @@ Enable enable/basic_tools enable/drag_and_drop enable/traits + enable/traitsui enable/undo_redo enable/toolkit_selection From 4aece93c7f92fb1143ab92788fe700a59a4c338d Mon Sep 17 00:00:00 2001 From: John Wiggins Date: Fri, 19 Mar 2021 15:30:35 +0100 Subject: [PATCH 2/2] PR feedback --- enable/component_editor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/enable/component_editor.py b/enable/component_editor.py index d002f0ecf..9dc3279cd 100644 --- a/enable/component_editor.py +++ b/enable/component_editor.py @@ -86,7 +86,7 @@ def _get_initial_size(self): class ComponentEditor(BasicEditorFactory): - """ wxPython editor factory for Enable components. + """ TraitsUI editor factory for Enable components. """ # ------------------------------------------------------------------------- @@ -96,19 +96,19 @@ class ComponentEditor(BasicEditorFactory): # The class used to create all editor styles (overrides BasicEditorFactory) klass = _ComponentEditor - # The background color for the window + #: The background color for the window bgcolor = ColorTrait("sys_window") - # When available, use HiDPI for GraphicsContext rasterization. + #: When available, use HiDPI for GraphicsContext rasterization. high_resolution = Bool(True) - # The default size of the Window wrapping this Enable component + #: The default size of the Window wrapping this Enable component size = Tuple((400, 400)) - # Convenience function for accessing the width + #: Convenience function for accessing the width width = Property - # Convenience function for accessing the width + #: Convenience function for accessing the width height = Property def _get_width(self):