enthought / enthought/pyface

Untangle creation and deletion methods

Open
#995 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
115
Forks
54
PR merge metrics
No merged PRs in 30d

Description

In more recent `Widget` classes we are finding a pattern that works for creation of:

- the `_create` method calls `_create_control` which creates the main toolkit control, possibly with some minimal configuration and setting of options that always apply and sets the result into the `control` attribute.
- in some cases there are method calls to create associated widgets or sub-widgets for complex widgets
- the `_create` method calls `_initialize_control` to configure the initial state of control properties that may vary
- the `_create` method calls `_add_event_listeners` which connects traits observers which need ui dispatch, and binds callbacks for toolkit events (and signals, etc. in Qt).

Some of these should call `super()` to ensure that creation methods from the superclass get done correctly.

There is a corresponding (although usually simpler) stack of things to be done at widget destruction time.

Many older, particularly Wx, widgets don't follow this pattern. Some effort should be put into standardizing things to facilitate subclassing, etc.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.