Skip to content

add coupling between ds9 and asdf dialog - #15

Open
perrygreenfield wants to merge 1 commit into
mainfrom
sync
Open

add coupling between ds9 and asdf dialog#15
perrygreenfield wants to merge 1 commit into
mainfrom
sync

Conversation

@perrygreenfield

Copy link
Copy Markdown
Contributor

These changes provide better coupling between ds9 and the ASDF windows.

If the ds9 that generated the ASDF windows is terminated, the ADSF will be removed (within a second).

If the user clicks the file/asdf button when an asdf dialog is already open, it will not create a new one, and
will raise the root asdf window to the top (but currently not other child asdf window such as the image browser; I haven't figured that out yet).

The first is done by passing the Python ASDF code the ds9 pid
The second is done by ds9 storing the Python pid when it creates the Python subprocess.

The Python process institutes a polling mechanism that checks every second (this can be changed) to see if the process associated with the ds9 pid no longer exists, in which case it self destructs (apologies to Mission Impossible).

If the ds9 clicks ASDF when a dialog is already open, it refuses to create a new one. Further more it write a file to the temporary directory used by Python to send images to ds9 to indicate that it wants the dialog to be raised to the top so the user is not confused. I would like it to raise all the children windows, but I am deferring that since the simple solution doesn't seem to work for that. This is done through the same polling mechanism that looks for the special file (which it then deletes). This is a very simple minded communication method, but very portable and does not require inserting things deeper down in ds9.

Currently it is possible for the user to ask for a new image browser window which will be created even if there is already one open.

Addresses issues #5 and #6

No AI tools used.

@braingram braingram left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I wasn't able to get this to work (see 2 issues in comments). Would you look at those and I can try this again?

Comment thread src/pds9/plugin.py
import asdf
import ds9samp
import numpy as np
import psutil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This needs to be added as a dependency.

Comment thread src/pds9/ds9.ini
# Check that there is dialog is present by checking the pid's existance
if {[CheckPID $asdf_pid] == "running"} {
# Signal that it should be raised over other windows
set fid [open "/Users/perry/ds9tmp/ds9cmd" w]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Testing this I get an error:

Image

What's the expectation here?

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.

2 participants