Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convenience classes for widget Actions #360

Merged
merged 13 commits into from
Apr 23, 2019
Merged

Conversation

corranwebster
Copy link
Contributor

@corranwebster corranwebster commented Mar 29, 2019

This PR adds:

  • some simple field widgets for data entry
  • an Action subclass that supports embedding them in toolbars
  • an Action subclass that supports embedding TraitsUI views in toolbars

Screen Shot 2019-03-29 at 4 05 21 pm

Fixes #349

examples/python_editor.py Outdated Show resolved Hide resolved
examples/python_editor.py Outdated Show resolved Hide resolved
pyface/action/field_action.py Show resolved Hide resolved
pyface/action/traitsui_widget_action.py Outdated Show resolved Hide resolved
pyface/fields/i_combo_field.py Show resolved Hide resolved
pyface/fields/i_spin_field.py Outdated Show resolved Hide resolved
pyface/fields/i_spin_field.py Outdated Show resolved Hide resolved
pyface/fields/i_spin_field.py Outdated Show resolved Hide resolved
pyface/ui/qt4/fields/spin_field.py Outdated Show resolved Hide resolved
@corranwebster corranwebster added this to the 6.1.0 Version milestone Apr 12, 2019
@codecov-io
Copy link

codecov-io commented Apr 16, 2019

Codecov Report

Merging #360 into master will increase coverage by 1.15%.
The diff coverage is 81.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #360      +/-   ##
==========================================
+ Coverage   35.15%   36.31%   +1.15%     
==========================================
  Files         463      481      +18     
  Lines       25820    26397     +577     
  Branches     3838     3909      +71     
==========================================
+ Hits         9076     9585     +509     
- Misses      16350    16399      +49     
- Partials      394      413      +19
Impacted Files Coverage Δ
pyface/action/api.py 100% <100%> (ø) ⬆️
pyface/action/traitsui_widget_action.py 100% <100%> (ø)
pyface/fields/combo_field.py 100% <100%> (ø)
pyface/fields/spin_field.py 100% <100%> (ø)
pyface/fields/api.py 100% <100%> (ø)
pyface/fields/text_field.py 100% <100%> (ø)
pyface/ui/qt4/fields/spin_field.py 100% <100%> (ø)
pyface/ui/wx/fields/spin_field.py 100% <100%> (ø)
pyface/ui/qt4/fields/field.py 68% <68%> (ø)
pyface/fields/i_text_field.py 71.01% <71.01%> (ø)
... and 41 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 966cca9...6517ec1. Read the comment docs.

Copy link
Member

@jwiggins jwiggins left a comment

Choose a reason for hiding this comment

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

I'm basically 👍 on this. Just adding a few remaining comments now that I've done a more careful reading.

examples/python_editor.py Outdated Show resolved Hide resolved
examples/python_editor.py Outdated Show resolved Hide resolved
pyface/action/traitsui_widget_action.py Outdated Show resolved Hide resolved
pyface/ui/qt4/fields/field.py Outdated Show resolved Hide resolved
pyface/ui/qt4/fields/spin_field.py Outdated Show resolved Hide resolved
pyface/ui/qt4/fields/text_field.py Outdated Show resolved Hide resolved
@corranwebster
Copy link
Contributor Author

I'm starting to write tests and finding some interesting issues, so there are likely to be some updates on this (currently SpinField is behaving oddly in tests).

@corranwebster
Copy link
Contributor Author

This is being delayed a bit more: dispatch of traits listeners needs to be on the UI thread so I need to refactor away from _*_changed forms :(

@corranwebster
Copy link
Contributor Author

... except UI dispatch requires TraitsUI to be imported, which means tests have errors unless there happens to have been an import of TraitsUI somewhere.

I am knee-deep in yak hair right now.

@corranwebster
Copy link
Contributor Author

@jwiggins This has been thoroughly worked over, so a re-review would be appreciated at some point.

Copy link
Member

@jwiggins jwiggins left a comment

Choose a reason for hiding this comment

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

Found a few things looking over the most recent changes. I'm about to do another pass over everything...

pyface/action/tests/test_traitsui_widget_action.py Outdated Show resolved Hide resolved
pyface/fields/tests/test_combo_field.py Outdated Show resolved Hide resolved
pyface/fields/tests/test_combo_field.py Show resolved Hide resolved
pyface/fields/tests/test_spin_field.py Outdated Show resolved Hide resolved
pyface/fields/tests/test_text_field.py Outdated Show resolved Hide resolved
pyface/ui/wx/fields/field.py Outdated Show resolved Hide resolved
@jwiggins
Copy link
Member

It's good that this is covered by tests now. I won't push too hard for big changes, because I'd rather see this merged soon.

That said, the repetition in the testing code is a bit of a smell. It would be nice to track that in a separate issue and clean it up later. (I see that GuiTestAssistant only exists for Qt...)

@corranwebster
Copy link
Contributor Author

I think the testing of the field classes is about as tight as you are going to be able to get it, although it would be nice to have the GuiTestAssistant available to make some of the event processing nicer and a bit more robust. The action testing is not as good, but it should really be done as part of re-writing the tests for all the actions.

Copy link
Member

@jwiggins jwiggins left a comment

Choose a reason for hiding this comment

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

Pending a clean CI run, this is good-to-go

@corranwebster
Copy link
Contributor Author

Looks good. Merging.

@corranwebster corranwebster merged commit 836df6d into master Apr 23, 2019
@corranwebster corranwebster deleted the feature/field-widgets branch April 23, 2019 09:39
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.

Allow Widgets in Toolbars
3 participants