enthought / enthought/pyface

The _create method should be public

Open
#729 3 comments 0 reactions 0 assignees View on GitHub
difficulty: easy Feature type: refactoring
Dominant language
Python
Stars
115
Forks
54
PR merge metrics
No merged PRs in 30d

Description

The base `Widget._create` method is nominally private, but in practice tends to get used as:
```
w = Widget(parent=parent)
w._create()
```
although a few widgets perform the `_create()` call as part of their `__init__`.

Two-phase creation has an advantage in that it permits programmatic configuration of the widget beyond what is passed in at class creation time before the underlying toolkit control is created.

This issue proposes that:

- [x] there is a public `create` method, which initially can be implemented to simple call `_create` (#735)
- [x] that calls to `_create` are changed to calls to `create`
- [x] that classes migrate the implementation of `_create` into `create`, and make `_create` call `create`
- [ ] that `_create` is removed

Additionally:
- [x] any classes which call `_create` or (worse) `_create_control` in their `__init__` be modified to not do that
- [ ] classes in Tasks which match the new `IWidget` interface (such as `ITaskPane`) should be modified to inherit from `IWidget` and their implementations to inherit from `Widget`.

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.