Skip to content

Fix get_engine options agreement#303

Merged
prabhuramachandran merged 2 commits into
masterfrom
fix-get-engine-options-agreement
Mar 9, 2016
Merged

Fix get_engine options agreement#303
prabhuramachandran merged 2 commits into
masterfrom
fix-get-engine-options-agreement

Conversation

@kitchoi
Copy link
Copy Markdown
Contributor

@kitchoi kitchoi commented Feb 29, 2016

  • If someone switches offscreen on, gets an OffScreenEngine created and registered, then switches offscreen off again, get_engine would still return OffScreenEngine if `backend=="auto". This doesn't make sense (or should it?). So here I implemented a fix for this special case.
  • Test for get_engine is made more robust by using assertIs instead of assertIsInstance as NullEngine, EnvisageEngine, OffScreenEngine are all subclass of Engine (so only L40 of the master test_engine_manager.py is dubious). But this is a crucial distinction for the new test added in this PR

@kitchoi kitchoi changed the title Fix get engine options agreement Fix get_engine options agreement Feb 29, 2016
@prabhuramachandran
Copy link
Copy Markdown
Member

I am a bit unsure about this. The reason is that "auto" is supposed to mean: pick a reasonable default. The trouble is that "reasonable" is quite ambiguous. Maybe the solution would be to add more unambiguous backends -- say an "offscreen" backend or a "ui" backend? Are you thinking that "auto" is just another name for "ui"? Thoughts?

@kitchoi
Copy link
Copy Markdown
Contributor Author

kitchoi commented Mar 2, 2016

Indeed "reasonable" is not well defined. So it would be helpful to check some case studies. For example:

from mayavi import mlab
mlab.options.offscreen = True
mlab.test_contour3d()
mlab.savefig("saved.png")

mlab.options.offscreen = False
mlab.figure()  ### Here

should the reasonable engine on the last line be an Engine (i.e. on screen) and not an OffScreenEngine?

@prabhuramachandran
Copy link
Copy Markdown
Member

Hmm, I think if offscreen is false, it should pop-up a view but then again, since there is already an off screen engine ready, technically it could use the same off screen engine.

OK, so if offscreen is not set, one should not get an offscreen engine. So in your case, one should get a non-offscreen engine depending on the backend. Is this what happens with your PR?

@kitchoi
Copy link
Copy Markdown
Contributor Author

kitchoi commented Mar 9, 2016

OK, so if offscreen is not set, one should not get an offscreen engine. So in your case, one should get a non-offscreen engine depending on the backend. Is this what happens with your PR?

Indeed this PR is aiming at this.

prabhuramachandran added a commit that referenced this pull request Mar 9, 2016
@prabhuramachandran prabhuramachandran merged commit 3b40750 into master Mar 9, 2016
@prabhuramachandran prabhuramachandran deleted the fix-get-engine-options-agreement branch March 9, 2016 13:10
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