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

Closing a canvas does not work properly if more than one canvas is open. #21

Open
danlipsa opened this issue Oct 7, 2016 · 16 comments
Open
Assignees
Milestone

Comments

@danlipsa
Copy link
Contributor

danlipsa commented Oct 7, 2016

The following script opens 4 canvases, plots the same fillarea and closes the canvases one at a time.
The canvases get cleared but not closed. This does not work on Linux but works on Mac.

import vcs
import sys
import vtk

f=vcs.createfillarea()
f.x=[.2,.5,.8]
f.y=[.2,.8,.2]
f.color=["red"]

x=vcs.init()
x.plot(f)

y=vcs.init()
y.plot(f)

z=vcs.init()
z.plot(f)

w=vcs.init()
w.plot(f)


x.interact()
x.close()

y.interact()
y.close()

z.interact()
z.close()

w.interact()
w.close()

If we replace .interact() with .backend.interact() everything works fine.

@danlipsa
Copy link
Contributor Author

danlipsa commented Oct 7, 2016

@doutriaux1 @aashish24 Do you have any ideas on this? I've seen this while working on vcs.js.

@danlipsa
Copy link
Contributor Author

danlipsa commented Oct 7, 2016

Related issues I think:
CDAT/cdat#2049
CDAT/cdat#2016
I think the problem here is that someone keeps a reference to a pipeline object, which in turn keeps a reference to the render window. This prevents the render window from being deleted.

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 2, 2016

@doutriaux1 @aashish24 @chaosphere2112 This is related to the interactor attached to the render window. Without this, windows close fine. There is a way to make this work - @chaosphere2112 might already have the code.

@aashish24
Copy link
Contributor

that would be in vcs-js. I think for the pure vcs, we may still have this issue. Is that correct?

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 2, 2016

@aashish24 pure vcs still creates an interactor if we run in foreground mode. So the problem affects both vcs.js and vcs.

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 2, 2016

@chaosphere2112 @doutriaux1 @aashish24 The problem is in configurator.py

def interact(self, *args, **kargs):
self.configure()
self.backend.interact(*args, **kargs)

Commenting out self.configure() makes the windows close properly.
Do we still want to keep this interface - this means I have to debug this or is it safe to strip it - which means I'll spend the time removing it.

@chaosphere2112
Copy link
Contributor

Ah! My code doesn't put it in Interact mode, which is why it closes correctly (I just proxy events manually to the vtkRenderWindowInteractor)

@chaosphere2112
Copy link
Contributor

@danlipsa Actually, looks like it works regardless on my mac. Tried:

import vcs
x = vcs.init()
y = vcs.init()
x.open()
y.open()
x.interact()
"q"
y.interact()
"q"
x.close()
y.close()

and everything closed properly.

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 3, 2016

@chaosphere2112 Does the following work? So, the first window has to close, then the second window has to close.

import vcs
x = vcs.init()
y = vcs.init()
x.open()
y.open()
x.interact()
x.close()

y.interact()
y.close()

@durack1
Copy link
Member

durack1 commented Nov 3, 2016

@danlipsa @chaosphere2112 I do recall an instance in the distant past (and admittedly on a devel version) that the handles got tangled, so that I had two canvases open, but when I closed the first one opened, the second one locked, or some similar situation.. It would be great to augment any existing tests to make sure similar issues aren't happening as shared objects are "locking" the ability to deal with each independent canvas..

@chaosphere2112
Copy link
Contributor

Seems to work (though the second call to interact() doesn’t actually Start() the interactor as far as I can tell, the widgets do show up from the call to configure())

From: Dan Lipsa <[email protected]mailto:[email protected]>
Reply-To: UV-CDAT/vcs <[email protected]mailto:[email protected]>
Date: Thursday, November 3, 2016 at 7:05 AM
To: UV-CDAT/vcs <[email protected]mailto:[email protected]>
Cc: "Fries, Samuel" <[email protected]mailto:[email protected]>, Mention <[email protected]mailto:[email protected]>
Subject: Re: [UV-CDAT/vcs] Closing a canvas does not work properly if more than one canvas is open. (#21)

@chaosphere2112https://github.com/chaosphere2112 Does the following work? So, the first window has to close, then the second window has to close.

import vcs
x = vcs.init()
y = vcs.init()
x.open()
y.open()
x.interact()
x.close()

y.interact()
y.close()


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com//issues/21#issuecomment-258151249, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAr2sBHVy1Sgmfz6MOkyKxvG7FTGoK3bks5q6eoOgaJpZM4KRPOE.

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 3, 2016

@chaosphere2112 @doutriaux1 @aashish24 Indeed this works on mac. I have to press "Open Configure" first to get the interactor to receive the key Q I press but it does close one window at a time. So this seems to be a difference between vtkXOpenGLRenderWindow and vtkCocoaRenderWindow. I have not been able to reproduce it using a VTK only example.

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 3, 2016

Ah! My code doesn't put it in Interact mode, which is why it closes correctly (I just proxy events manually > to the vtkRenderWindowInteractor)

@chaosphere2112 @aashish24 @doutriaux1 In this case, I'll stop working on this. The reason why I wanted to get this working is because of vcs.js. The question remains: Should we keep the "configure" interface or should we strip it? I would vote to strip it - it provides very limited functionality, and creates maintenance problems like this one. The following image is a reminder of what this interface does:
configure

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 3, 2016

I can see this is used in the 3D plots. We can still keep it there.

@doutriaux1 doutriaux1 modified the milestone: 3.0 May 5, 2017
@doutriaux1 doutriaux1 modified the milestones: 3.0, post 3.0 Mar 29, 2018
@doutriaux1 doutriaux1 modified the milestones: 8.1, 8.2 Mar 27, 2019
@doutriaux1
Copy link
Contributor

@scottwittenburg it appears x.close() does not actually close the window at all.

@scottwittenburg
Copy link
Collaborator

Possible duplicated of (or at least related to) #403.

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

No branches or pull requests

6 participants