Exemple #1
0
from util import prepare_for_display, window_manager, GuiLockError
import numpy as np
import sys

# We try to aquire the gui lock first or else the gui import might
# trample another GUI's PyOS_InputHook.
window_manager.acquire('qt2')

try:
    from PyQt4.QtGui import (QApplication, QMainWindow, QImage, QPixmap,
                             QLabel, QWidget)
    from PyQt4 import QtCore, QtGui
    from scivi2 import _simple_imshow, _advanced_imshow

except ImportError:
    window_manager._release('qt2')

    raise ImportError("""\
    PyQt4 libraries not installed. Please refer to

    http://www.riverbankcomputing.co.uk/software/pyqt/intro

    for more information.  PyQt4 is GPL licensed.  For an
    LGPL equivalent, see

    http://www.pyside.org
    """)

app = None

def imshow(im, flip=None, fancy=False):
Exemple #2
0
from util import prepare_for_display, window_manager, GuiLockError

try:
    # we try to aquire the gui lock first
    # or else the gui import might trample another
    # gui's pyos_inputhook.
    window_manager.acquire('gtk')
except GuiLockError as gle:
    print(gle)
else:
    try:
        import gtk
    except ImportError:
        print('pygtk libraries not installed.')
        print('plugin not loaded.')
        window_manager._release('gtk')
    else:

        class ImageWindow(gtk.Window):
            def __init__(self, arr, mgr):
                gtk.Window.__init__(self)
                self.mgr = mgr
                self.mgr.add_window(self)

                self.connect("destroy", self.destroy)

                width = arr.shape[1]
                height = arr.shape[0]
                rstride = arr.strides[0]
                pb = gtk.gdk.pixbuf_new_from_data(arr.data,
                                                  gtk.gdk.COLORSPACE_RGB,
from util import prepare_for_display, window_manager, GuiLockError

try:
    # we try to aquire the gui lock first
    # or else the gui import might trample another
    # gui's pyos_inputhook.
    window_manager.acquire('gtk')
except GuiLockError as gle:
    print(gle)
else:
    try:
        import gtk
    except ImportError:
        print('pygtk libraries not installed.')
        print('plugin not loaded.')
        window_manager._release('gtk')
    else:

        class ImageWindow(gtk.Window):
            def __init__(self, arr, mgr):
                gtk.Window.__init__(self)
                self.mgr = mgr
                self.mgr.add_window(self)

                self.connect("destroy", self.destroy)

                width = arr.shape[1]
                height = arr.shape[0]
                rstride = arr.strides[0]
                pb = gtk.gdk.pixbuf_new_from_data(arr.data,
                                                  gtk.gdk.COLORSPACE_RGB,
Exemple #4
0
from util import prepare_for_display, window_manager, GuiLockError
import numpy as np
import sys

# We try to aquire the gui lock first or else the gui import might
# trample another GUI's PyOS_InputHook.
window_manager.acquire('qt')

try:
    from PyQt4.QtGui import (QApplication, QMainWindow, QImage, QPixmap,
                             QLabel, QWidget)
    from PyQt4 import QtCore, QtGui

except ImportError:
    window_manager._release('qt')

    raise ImportError("""\
    PyQt4 libraries not installed. Please refer to

    http://www.riverbankcomputing.co.uk/software/pyqt/intro

    for more information.  PyQt4 is GPL licensed.  For an
    LGPL equivalent, see

    http://www.pyside.org
    """)

app = None


class ImageLabel(QLabel):