Skip to content

Commit

Permalink
Add missing calls to super class "__init__"s (#1693)
Browse files Browse the repository at this point in the history
* FIX : Add missing call to __init__ in super class

* FIX : Add missing call to __init__ in super class

* FIX : Add missing call to __init__ in super class

* FIX : Add missing call to super __init__

and fix a flake8 error

	modified:   traitsui/editors/array_editor.py
	modified:   traitsui/qt4/ui_panel.py

* DEV : Undo change in qt4 GroupEditor

see #1674

	modified:   traitsui/qt4/ui_panel.py

* CLN : Pass args to __init__ call

Previously, we were setting traits/attributes before calling __init__ on
the objects, which setup the traits machinery. Instead, this commit
passes the arguments to __init__, which feels like the right thing to do

	modified:   traitsui/editors/array_editor.py
	modified:   traitsui/editors/tuple_editor.py
	modified:   traitsui/qt4/ui_panel.py
  • Loading branch information
Poruri Sai Rahul authored Jul 7, 2021
1 parent 8d4c01d commit 762f66b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions traitsui/editors/array_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ class ArrayStructure(HasTraits):
def __init__(self, editor):
""" Initializes the object.
"""
# Save the reference to the editor:
self.editor = editor
super().__init__(editor=editor)

# Set up the field width for each item:
width = editor.factory.width
Expand Down
5 changes: 2 additions & 3 deletions traitsui/editors/tuple_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,14 @@ class TupleStructure(HasTraits):
def __init__(self, editor):
""" Initializes the object.
"""
super().__init__(editor=editor)

factory = editor.factory
types = factory.types
labels = factory.labels
editors = factory.editors
cols = factory.cols

# Save the reference to the editor:
self.editor = editor

# Get the tuple we are mirroring:
object = editor.value

Expand Down
3 changes: 2 additions & 1 deletion traitsui/qt4/ui_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ class _Panel(BasePanel):
def __init__(self, ui, parent, is_subpanel):
"""Initialise the object.
"""
self.ui = ui
super().__init__(ui=ui)

history = ui.history
view = ui.view

Expand Down

0 comments on commit 762f66b

Please sign in to comment.