Skip to content

Update _*_changed static trait listeners to use traits observe#954

Merged
aaronayres35 merged 12 commits into
masterfrom
update-_changed-methods
Jun 21, 2021
Merged

Update _*_changed static trait listeners to use traits observe#954
aaronayres35 merged 12 commits into
masterfrom
update-_changed-methods

Conversation

@aaronayres35
Copy link
Copy Markdown
Contributor

Part of #899

This PR replaces some of the instances of _*_changed static trait listeners with observe from the code base. There are still plenty more that will need to be addressed in follow up PRs.

Comment thread pyface/dock/dock_sizer.py
Comment on lines 2009 to +2013
# Handles the 'feature_changed' trait being changed:
# ---------------------------------------------------------------------------

def _feature_changed(self):
@observe("feature_changed")
def _feature_changed_updated(self, event):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this had been a bug before I will look into writing a regression test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: done


class TestDockControl(unittest.TestCase):

@unittest.skipIf(not_wx, "This test is specific to the wx backend")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my surprise, pyface/dock/dock_sizer.py is wx specific although it lives in a generic module.

@aaronayres35 aaronayres35 requested a review from rahulporuri June 18, 2021 12:36
@rahulporuri
Copy link
Copy Markdown
Contributor

@aaronayres35 looks like the wx import is causing CI to fail.

@aaronayres35
Copy link
Copy Markdown
Contributor Author

@aaronayres35 looks like the wx import is causing CI to fail.

Agh, my mistake. I pulled the problem import inside the test - hopefully that should fix things

Copy link
Copy Markdown
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread pyface/dock/dock_sizer.py
# Handles the 'feature_changed' trait being changed:
# ---------------------------------------------------------------------------

def _feature_changed(self):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh looks like this was buggy before - feature_changed is the event trait

@aaronayres35 aaronayres35 merged commit 0f00ffd into master Jun 21, 2021
@aaronayres35 aaronayres35 deleted the update-_changed-methods branch June 21, 2021 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants