Skip to content

Use new pyface toolkit#641

Merged
prabhuramachandran merged 4 commits into
enthought:masterfrom
prabhuramachandran:use-new-pyface-toolkit
May 23, 2018
Merged

Use new pyface toolkit#641
prabhuramachandran merged 4 commits into
enthought:masterfrom
prabhuramachandran:use-new-pyface-toolkit

Conversation

@prabhuramachandran
Copy link
Copy Markdown
Member

@prabhuramachandran prabhuramachandran commented May 21, 2018

Fixes #626.

@corranwebster -- could you please take a look at this PR, the pyface toolkit related bits especially to see if I haven't done anything wrong. Thanks! BTW, the changes for the pyface toolkit are all in the first commit.

- Also adding pygments as most folks use Mayavi with the Qt backend
  which depends on it.
- Some PEP8 fixes.
- Remove useless early wxPython imports.
@codecov-io
Copy link
Copy Markdown

codecov-io commented May 21, 2018

Codecov Report

Merging #641 into master will increase coverage by 0.04%.
The diff coverage is 25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #641      +/-   ##
==========================================
+ Coverage   50.41%   50.46%   +0.04%     
==========================================
  Files         257      257              
  Lines       23415    23327      -88     
  Branches     3194     3180      -14     
==========================================
- Hits        11804    11771      -33     
+ Misses      10850    10801      -49     
+ Partials      761      755       -6
Impacted Files Coverage Δ
mayavi/mlab.py 78.57% <ø> (+10.38%) ⬆️
mayavi/scripts/mayavi2.py 0% <0%> (ø) ⬆️
mayavi/tools/engine_manager.py 57.14% <0%> (-0.52%) ⬇️
tvtk/pyface/ui/null/init.py 0% <0%> (ø) ⬆️
tvtk/pyface/ui/qt4/init.py 100% <100%> (+50%) ⬆️
tvtk/pyface/ui/wx/init.py 100% <100%> (+71.42%) ⬆️
tvtk/pyface/toolkit.py 100% <100%> (+47.82%) ⬆️

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 dfacd49...b90054b. Read the comment docs.

@corranwebster
Copy link
Copy Markdown

On a quick look-over, I think you should explicitly attempt to import pyface.toolkit module in the tvtk.pyface.*.init modules to ensure that appropriate initialization of the UI occurs (see, eg. https://github.com/enthought/traitsui/blob/master/traitsui/wx/toolkit.py#L32 and https://github.com/enthought/traitsui/blob/master/traitsui/qt4/toolkit.py#L24). In particular, this ensures that the equivalent of the code that was deleted that initializes the _app instance gets run somewhere.

It is suboptimal that importing pyface.toolkit has important side-effects, but we are stuck with that behaviour, I think (in particular, you can't make some Qt calls until the app exists).

I'll have a closer look tomorrow morning.

@prabhuramachandran
Copy link
Copy Markdown
Member Author

Hmm, it seems to work fine as is, the tests pass. Since Mayavi is using traitsui shouldn't it be enough that traitsui will perform the necessary imports?

@prabhuramachandran
Copy link
Copy Markdown
Member Author

@corranwebster -- please let me know if this looks OK. Thanks!

@corranwebster
Copy link
Copy Markdown

It's probably fine, assuming that you can't use Mayavi without bringing in TraitsUI at some point in the process.

@prabhuramachandran
Copy link
Copy Markdown
Member Author

Thank you! Yes indeed when we do use a UI, we use traitsui. When we don't want a UI we don't want the Qt or wx app to be created anyway. So I think it should be fine.

@prabhuramachandran prabhuramachandran merged commit 25799fc into enthought:master May 23, 2018
@prabhuramachandran prabhuramachandran deleted the use-new-pyface-toolkit branch November 16, 2018 20:16
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.

3 participants