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

(q)uit does not work correctly in a DV3D interactive canvas (exits python) #953

Closed
jypeter opened this issue Jan 8, 2015 · 4 comments
Closed
Assignees
Milestone

Comments

@jypeter
Copy link
Member

@jypeter jypeter commented Jan 8, 2015

I don't know if this has been reported yet. It's something we saw with @chaosphere2112 when I was visiting PCMDI

When you are in interactive mode and type 'q' in a DV3D canvas, the script will completely exit python when you only want to continue the script or go back to the interpreter

The following example (run it with python -i script.py) opens both a 3D and a classical 2D canvas and shows that 'q' works as expected when you use it in the 2D canvas, but not in the 3D canvas

#!/usr/bin/env python

# A simple script showing that the 'q'uit command in a DV3D canvas
# will exit python, when it should only go back to the interpreter
#
# Use: python -i this_script.py
#
# J-Y Peterschmitt - LSCE - 01/2015

import vcs, cdms2, sys

# Canvas with a 3D plot
print 'Creating a simple 3D plot canvas...\n'

x = vcs.init()
f = cdms2.open(sys.prefix+"/sample_data/clt.nc")   
v = f("clt", time=slice(0,10))
dv3d = vcs.get3d_scalar()
x.plot( v, dv3d )

# Canvas with a default 2D plot
print '\nCreating a simple 2D plot canvas...\n'
y = vcs.init()
y.plot(v)

# Enter the interactive mode, then try to quit it to go back to the
# interpreter
print '\nEntering the interactive mode...'
print 'Typing "q" in the 3D canvas will exit python => NOT good :('
print 'Typing "q" in the 2D canvas will go back to the interpreter => GOOD! :)\n'
x.interact()

# The end
@jypeter
Copy link
Member Author

@jypeter jypeter commented Mar 19, 2015

@ThomasMaxwell Do you think you can do something about this? It was a bit annoying, when making my tests to report #1155 to have to restart python each time I quit the interact mode in a dv3d canvas

@ThomasMaxwell
Copy link
Contributor

@ThomasMaxwell ThomasMaxwell commented Mar 20, 2015

I have implemented a fix for this in branch vcs3D-return_to_shell_on_q_keypress_event (PR #1157). After the ‘q’ key is pressed control returns to python and one can generate another plot ( staring with ‘vcs.init()’ ).

From: Jean-Yves Peterschmitt <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Thursday, March 19, 2015 at 6:25 PM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Cc: "Maxwell, Thomas P. (GSFC-606.2)[SCIENCE APPLICATIONS INTL CORP]" <thomas.maxwell@nasa.govmailto:thomas.maxwell@nasa.gov>
Subject: Re: uvcdatuit does not work correctly in a DV3D interactive canvas (exits python) (#953)

@ThomasMaxwellhttps://github.com/ThomasMaxwell Do you think you can do something about this? It was a bit annoying, when making my tests to report #1155#1155 to have to restart python each time I quit the interact mode in a dv3d canvas


Reply to this email directly or view it on GitHubhttps://github.com//issues/953#issuecomment-83785515.

@jypeter
Copy link
Member Author

@jypeter jypeter commented Mar 23, 2015

Thanks!

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented May 7, 2015

@ThomasMaxwell it appears to still be here or to be back in (dv3d vector)

In [21]: x.plot(dv3d,s,s)
Warning, can't open data file 'None'
Warning, transient variable clt already exists in dataset, overwriting!
 Can't get Metadata for var __zeros__!
Sample rate: 6 
Sample rate: 6 
 Update Text Display:  Level: 0.00 
initCamera: Camera => ((0.0, 0.0, 540.0), (0.0, 0.0, 0.0), (0.0, 1.0, 0.0)) 
Out[21]: <vcs.displayplot.Dp at 0x1149c4230>

In [22]: x.interact()
/lgm/uvcdat/2.2.0/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/VTKPlots.py:87: UserWarning: Press 'Q' to exit interactive mode and continue script execution
  warnings.warn("Press 'Q' to exit interactive mode and continue script execution")
 saved state data to file  <closed file 'DV3D/data/state.txt', mode 'w' at 0x114c1b4b0>
doutriaux1@lapetitechipie:[Packages]:[release*]:[5869]> 

Pressed Q and went back to the terminal prompt

@aashish24 aashish24 added this to the 2.3 milestone May 11, 2015
@aashish24 aashish24 removed this from the 2.2 milestone May 11, 2015
@doutriaux1 doutriaux1 closed this Jan 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants