crawfordsm / specidentify

Software for identifying spectral lines and calibrating spectroscopic observations.
15 stars 11 forks source link

Initial support for the ginga viewer as an option #6

Closed ejeschke closed 9 years ago

ejeschke commented 9 years ago

This adds support for Ginga as an image viewer in the specreduce interidentify GUI tools.

If the user does not have ginga installed or there is a problem importing it then nothing is different from the default. If the ginga package is installed then the ginga viewer replaces the imageWidget with a ginga-powered one. This gives you a very full featured image browser.

crawfordsm commented 9 years ago

Thanks so much for the quick pull request @ejeschke !

I've just tried to check it out and I've run into the error File "test_specred_rss.py", line 9, in from specreduce.interidentify import InterIdentify File "/Users/crawford/programs/specreduce/specreduce/interidentify.py", line 42, in from gingatools import GingaImageDisplay File "/Users/crawford/programs/specreduce/specreduce/gingatools.py", line 11, in from ginga.qtw.ImageViewCanvasQt import ImageViewCanvas as GingaCanvas File "/usr/local/lib/python2.7/site-packages/ginga/qtw/ImageViewCanvasQt.py", line 11, in from ginga.qtw import ImageViewQt File "/usr/local/lib/python2.7/site-packages/ginga/qtw/ImageViewQt.py", line 15, in from ginga.qtw.QtHelp import QtGui, QtCore, QFont, QColor, QImage, \ File "/usr/local/lib/python2.7/site-packages/ginga/qtw/QtHelp.py", line 50, in sip.setapi(cl, 2) ValueError: API 'QString' has already been set to version 1

Do you know the quick source of this or should I go hunting?

ejeschke commented 9 years ago

See the test file and email I sent you.

crawfordsm commented 9 years ago

Ah thanks for the update, i'm going to add it here as a note

# hack to force Qt v2 api
import sip
for cl in ('QString', 'QVariant'):
     sip.setapi(cl, 2)

Is there a way to incorporate this in the code?

crawfordsm commented 9 years ago

But, yes, with that I got it to work! Awesome!

crawfordsm commented 9 years ago

If I add that import from sip into the init.py it seems to then work without needing it in the script. Unless there is a good reason not to, can you add that to this pull request and then I'll go ahead and merge it?

ejeschke commented 9 years ago

Hi @crawfordsm, I've updated the branch to fix a couple of issues. First, the layout with the ginga widget now looks good. I also removed the log messages to stderr. Checkout the branch and let me know your thoughts.