enthought / pyface

pyface: traits-capable windowing framework
Other
106 stars 55 forks source link

The `create()` method of `IWidget` should accept a `parent` argument #1218

Closed corranwebster closed 1 year ago

corranwebster commented 1 year ago

One of the tasks listed in #729 is to make the APIs of things like task panes align with the API of IWidget. An obstacle to this is that Tasks create methods generally expect a parent argument, which allows lazier creation:

t = TasksThing()
...
t.create(parent)

where with the current widget API this looks like:

t = WidgetThing()
...
t.parent = parent
t.create()

This issue proposes adding an optional parent argument to IWidget.create that does something like:

def create(self, parent=None):
    if parent is not None:
        self.parent = parent
    ...

which can probably be achieved by simply adding this to the base MWidget.create() and then updating the signatures and super calls appropriately.