Beispiel #1
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(576, 522)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setMinimumSize(QtCore.QSize(100, 150))
        self.im_view = QtGui.QWidget(MainWindow)
        self.im_view.setMinimumSize(QtCore.QSize(50, 50))
        self.im_view.setObjectName("im_view")
        self.horizontalLayout = QtGui.QHBoxLayout(self.im_view)
        self.horizontalLayout.setObjectName("horizontalLayout")
        MainWindow.setCentralWidget(self.im_view)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolbar = QtGui.QToolBar(MainWindow)
        self.toolbar.setObjectName("toolbar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolbar)
        self.action_close = QtGui.QAction(MainWindow)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/image/close.png"), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        self.action_close.setIcon(icon)
        self.action_close.setObjectName("action_close")
        self.action_snapshot = QtGui.QAction(MainWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/image/snapshot.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.action_snapshot.setIcon(icon1)
        self.action_snapshot.setObjectName("action_snapshot")
        self.action_rotate_left = QtGui.QAction(MainWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/image/rotate_left.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.action_rotate_left.setIcon(icon2)
        self.action_rotate_left.setObjectName("action_rotate_left")
        self.action_rotate_right = QtGui.QAction(MainWindow)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/image/rotate_right.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.action_rotate_right.setIcon(icon3)
        self.action_rotate_right.setObjectName("action_rotate_right")
        self.toolbar.addAction(self.action_close)
        self.toolbar.addAction(self.action_snapshot)
        self.toolbar.addAction(self.action_rotate_left)
        self.toolbar.addAction(self.action_rotate_right)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Beispiel #2
0
    def __init__(self, banner_path=None, content=None):
        QtGui.QWidget.__init__(self)

        if banner_path is None:
            banner_path = shared_data(openalea.oalab, 'icons/logo/banner.png')

        self._lay = QtGui.QVBoxLayout(self)

        p = QtGui.QSizePolicy

        self._banner = QtGui.QLabel()
        self._banner.setStyleSheet("QLabel { background-color : #ffffff;}")
        banner = QtGui.QPixmap(banner_path)
        size = banner.size()
        self._banner.setPixmap(banner)

        self._content = QWebView()
        if hasattr(self._content, "setReadOnly"):
            self._content.setReadOnly(True)
        self._content.setHtml(content)

        self._footer = QtGui.QLabel()
        self._footer.setStyleSheet("QLabel { background-color : #459454;}")

        self._lay.addWidget(self._banner)
        self._lay.addWidget(self._content)
        self._lay.addWidget(self._footer)
        self._lay.setContentsMargins(0, 0, 0, 0)
        self._lay.setSpacing(0)
Beispiel #3
0
    def __init__(self, project, size=200, parent=None):
        super(ProjectPushButton, self).__init__(parent)
        wanted_size = size

        self.setMinimumSize(wanted_size, wanted_size)
        self.setMaximumSize(wanted_size, wanted_size)
        self.project = project

        layout = QtGui.QGridLayout(self)
        icon_path = project.icon_path
        icon_name = icon_path if icon_path else ":/images/resources/openalealogo.png"
        text = pretty_print(project.name)

        pixmap = QtGui.QPixmap(icon_name).scaled(size, size)
        label = QtGui.QLabel()
        label.setScaledContents(True)

        painter = QtGui.QPainter()
        painter.begin(pixmap)
        painter.setPen(QtCore.Qt.darkGreen)
        qsize = pixmap.size()
        ytext = 0.85 * qsize.height()
        painter.drawText(0, ytext, qsize.width(), 0.2 * qsize.height(),
                         QtCore.Qt.AlignHCenter, text)
        painter.end()

        label.setPixmap(pixmap)

        layout.addWidget(label, 0, 0)
Beispiel #4
0
    def startDrag(self, supportedActions):

        item = self.currentIndex()

        itemData = QtCore.QByteArray()
        dataStream = QtCore.QDataStream(itemData, QtCore.QIODevice.WriteOnly)
        pixmap = QtGui.QPixmap(":/icons/ccmime.png")

        l = self.model().datapool.keys()
        l.sort()
        name = l[item.row()]

        dataStream.writeSting(name)

        mimeData = QtCore.QMimeData()
        mimeData.setData("openalea/data_instance", itemData)

        linecode = cli.get_datapool_code(name)
        mimeData.setText(linecode)

        drag = QtGui.QDrag(self)
        drag.setMimeData(mimeData)
        drag.setHotSpot(QtCore.QPoint(pixmap.width()/2, pixmap.height()/2))
        drag.setPixmap(pixmap)

        drag.start(QtCore.Qt.MoveAction)
Beispiel #5
0
    def __init__(self, project, parent=None):
        super(Preview, self).__init__(parent)
        wanted_size = 50
        self.project = project

        layout = QtGui.QGridLayout()
        icon_name = ":/images/resources/openalea_icon2.png"
        if len(project.icon):
            if project.icon[0] is not ":":
                # local icon
                icon_name = project.path / project.icon
                # else native icon from oalab.gui.resources

        image = QtGui.QImage(icon_name)
        label = QtGui.QLabel()
        label.setPixmap(QtGui.QPixmap(image))
        size = image.size()
        if size.height() > wanted_size or size.width() > wanted_size:
            # Auto-rescale if image is bigger than wanted_size x wanted_size
            label.setScaledContents(True)
        label.setMinimumSize(wanted_size, wanted_size)
        label.setMaximumSize(wanted_size, wanted_size)
        layout.addWidget(label, 0, 0)

        layout.addWidget(
            QtGui.QLabel("<b><FONT SIZE = 40>" + pretty_print(project.name) +
                         "<\b>"), 0, 1)

        i = 1
        for label in Project.DEFAULT_METADATA:
            layout.addWidget(QtGui.QLabel(label), i, 0)
            # GBY Review:
            # QLabel expects a QString and QString is equivalent to unicode
            # so you must convert str to unicode to support non ASCII characters correctly (for example accent in author's name)
            # If project meta-info encoding is utf-8, you can write projet.author.decode('utf-8')
            # Just put accents or greek characters in test data to check such problems

            # GBY Review: if amount of metainfo grows, QTextEdit can be more convenient
            layout.addWidget(
                QtGui.QLabel(pretty_print(getattr(project, label))), i, 1)
            i += 1

        layout.addWidget(QtGui.QLabel("Items:"), i, 0, 1, 2)
        model_list = QtGui.QTextEdit()
        layout.addWidget(model_list, i + 1, 0, 1, 2)

        model_list.setText(html_item_summary(project))

        open_button = QtGui.QPushButton("Open this project")
        open_button.clicked.connect(self.on_project_opened)
        layout.addWidget(open_button, i + 2, 0)

        self.setLayout(layout)
Beispiel #6
0
def show_splash_screen():
    """Show a small splash screen to make people wait for OpenAleaLab to startup"""

    pix = QtGui.QPixmap(":/images/resources/splash.png")
    splash = QtGui.QSplashScreen(pix, QtCore.Qt.WindowStaysOnTopHint)
    splash.show()
    message = "" + metainfo.get_copyright() + \
              "Version : %s\n" % (metainfo.get_version(),) + \
              "Loading modules..."
    splash.showMessage(message, QtCore.Qt.AlignCenter | QtCore.Qt.AlignBottom)
    # -- make sure qt really display the message before importing the modules.--
    QtGui.QApplication.processEvents()
    return splash
Beispiel #7
0
def qicon(filename,
          default=None,
          paths=None,
          save_filepath=None,
          packages=None):
    if isinstance(filename, QtGui.QIcon):
        return filename

    if not filename:
        if default is None:
            default = get_shared_data('icons/oxygen_application-x-desktop.png')
        return qicon(default, default, save_filepath=save_filepath)
    elif filename.startswith(':/'):
        pixmap = QtGui.QPixmap(filename).scaled(
            *DEFAULT_SCALE, aspectRatioMode=QtCore.Qt.KeepAspectRatio)
        icon = QtGui.QIcon(pixmap)
        if save_filepath:
            icon.addFile(save_filepath)
            pixmap.save(save_filepath)
        return icon
    else:
        if packages is None:
            packages = [openalea.core, openalea.oalab]
        found = icon_path(filename,
                          default=default,
                          paths=paths,
                          packages=packages)
        if found:
            pixmap = QtGui.QPixmap(found).scaled(
                *DEFAULT_SCALE, aspectRatioMode=QtCore.Qt.KeepAspectRatio)
            icon = QtGui.QIcon(pixmap)
            if save_filepath:
                icon.addFile(save_filepath)
                pixmap.save(save_filepath)
            return icon
        else:
            return qicon(":/images/resources/%s" % filename,
                         save_filepath=save_filepath)
Beispiel #8
0
    def on_widget_changed(self):
        widget = None
        if self.cb_widget.currentIndex() == -1:
            return
        widget_name = self.widget_plugins[self.cb_widget.currentIndex()].name
        iname = self._interfaces[self.cb_interface.currentIndex()]

        icon_path = None
        for plugin in qt_widget_plugins(iname):
            if widget_name == plugin.name:
                widget = plugin.load()
                if hasattr(plugin, 'icon_path'):
                    icon_path = plugin.icon_path
                    if icon_path and not icon_path.exists():
                        icon_path = None
                else:
                    icon_path = None
                if icon_path is None:
                    icon_path = shared_data(openalea.oalab,
                                            'icons/preview_%s.png' % iname)
                    if icon_path and not icon_path.exists():
                        icon_path = None
                break

        if icon_path:
            pixmap = QtGui.QPixmap(icon_path)
            if pixmap.width() >= 400 or pixmap.height() >= 400:
                pixmap = pixmap.scaled(400, 400, QtCore.Qt.KeepAspectRatio)
            self.widget_preview.setPixmap(pixmap)
            self.l_widget.setToolTip(
                '<b>%s</b><br /><img src="%s" width="200" />' %
                (widget_alias(plugin), icon_path))
        else:
            self.widget_preview.setText("No preview")

        if self._constraints:
            widget_constraints = self._constraints()
            self._layout_constraints.removeWidget(widget_constraints)
            widget_constraints.close()
            self._constraints = None
#             self.l_constraints.hide()

        if widget and hasattr(widget, 'edit_constraints'):
            widget_constraints = widget.edit_constraints()
            widget_constraints.setAttribute(QtCore.Qt.WA_DeleteOnClose)
            self._layout_constraints.addWidget(widget_constraints)
            #             self.l_constraints.show()

            self._constraints = weakref.ref(widget_constraints)
Beispiel #9
0
    def data(self, index, role):

        if (not index.isValid()):
            return to_qvariant()

        if (index.row() >= len(self.datapool.keys())):
            return to_qvariant()

        if (role == QtCore.Qt.DisplayRole):
            l = self.datapool.keys()
            l.sort()
            name = l[index.row()]
            #classname = self.datapool[name].__class__
            value = repr(self.datapool[name])
            if(len(value) > 30) : value = value[:30] + "..."
            return to_qvariant("%s ( %s )"%(name, value))

        # Icon
        elif( role == QtCore.Qt.DecorationRole ):
            return to_qvariant(QtGui.QPixmap(":/icons/ccmime.png"))

        # Tool Tip
        elif( role == QtCore.Qt.ToolTipRole ):
            l = self.datapool.keys()
            l.sort()
            name = l[index.row()]

            tips = [name]

            tips.append("%s\n"%(str(self.datapool[name]),))
            tips.append("Dir :")

            temp = ""
            for i, n in enumerate(dir(self.datapool[name])):
                s = str(n)
                if(len(s) > 20): s = s[:20]
                temp += s + "\t\t"
                # 2 column view
                if(i%2):
                    tips.append(temp)
                    temp = ""

            if(temp) : tips.append(temp)
            tipstr = '\n'.join(tips)

            return to_qvariant(str(tipstr))

        else:
            return to_qvariant()
                else:
                    widget.setMinimumSize(64, 64)
                layout.addWidget(w_editor)
#                 layout.addStretch()
                widget.show()
                widget.raise_()
                if kwargs.get('value', None):
                    print 'use sample for %s' % iname

                x = widget.pos().x()
                y = widget.pos().y()
                w = widget.size().width()
                h = widget.size().height()

                if sys.platform == 'linux2':
                    pixmap = QtGui.QPixmap(w, h)
                    widget.render(pixmap)
                else:
                    pixmap = QtGui.QPixmap.grabWindow(widget.winId(), 0, 0, w, h)

                filename = Path('%s/%s_%s_%s.png' % (workdir, iname, plugin.name, shape)).abspath()
                # print 'save', filename
                pixmap.save(filename)

                if shape == 'large':
                    filename = Path('%s/preview_%s.png' % (workdir, iname)).abspath()
                    # print 'save', filename
                    pixmap.save(filename)

                widget.close()
Beispiel #11
0
    def __init__(self, parent=None, style=None):
        AbstractListener.__init__(self)
        QtGui.QWidget.__init__(self, parent=parent)

        self.world = None

        self.name = ""
        self._controls = []

        self._manager = ControlContainer()

        self.interpreter = get_interpreter()
        self.interpreter.locals['draco_control'] = self

        self._layout = QtGui.QVBoxLayout(self)

        self._title_img = QtGui.QWidget()
        title_layout = QtGui.QHBoxLayout(self._title_img)

        p = QtGui.QSizePolicy
        pixmap_dirname = shared_data(openalea.draco_stem)

        icon_img = QtGui.QLabel()
        pixmap_icon = QtGui.QPixmap(
            os.path.join(
                pixmap_dirname,
                "../../src/openalea/draco_stem/draco_oalab/widget/draco_icon.png"
            ))
        icon_img.setPixmap(pixmap_icon)
        icon_img.setScaledContents(True)
        icon_img.setFixedWidth(60)
        icon_img.setFixedHeight(60)
        # icon_img.setSizePolicy(p(p.Expanding, p.Maximum))
        title_layout.addWidget(icon_img)
        # title_layout.addSpacing(20)

        title_img = QtGui.QLabel()
        pixmap_title = QtGui.QPixmap(
            os.path.join(
                pixmap_dirname,
                "../../src/openalea/draco_stem/draco_oalab/widget/draco_title.png"
            ))
        title_img.setPixmap(pixmap_title)
        title_img.setScaledContents(True)
        # title_img.setSizePolicy(p(p.Expanding, p.Maximum))
        title_img.setFixedWidth(140)
        title_img.setFixedHeight(60)
        title_layout.addWidget(title_img)
        # title_layout.addSpacing(20)

        title_label = QtGui.QLabel(
            u'Dual Reconstruction\nby Adjacency\nComplex Optimization')
        title_label.setAlignment(QtCore.Qt.AlignCenter)
        # title_label.setFixedWidth(150)
        title_layout.addWidget(title_label)

        self._title_img.setFixedHeight(75)
        self._title_img.setSizePolicy(p(p.Expanding, p.Maximum))
        self._layout.addWidget(self._title_img, 0)

        self._view = None
        self._set_manager(self._manager)

        self.draco = None
#       OpenAlea WebSite : http://openalea.gforge.inria.fr
#
"""
Test frame manipulator
"""

__license__= "Cecill-C"
__revision__ = " $Id: __init__.py 2245 2010-02-08 17:11:34Z cokelaer $ "

from openalea.vpltk.qt import QtGui
from openalea.image.all import rainbow, FrameAnimator

qapp = QtGui.QApplication.instance()

if qapp:
	pal = rainbow(99)

	frames = []

	for i in xrange(100) :
		pix = QtGui.QPixmap(300,200)
		pix.fill(QtGui.QColor(*tuple(pal[i]) ) )
		frames.append(pix)

	w = FrameAnimator()
	w.set_frames(frames)

	w.show()


Beispiel #13
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(703, 681)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/openalea_icon.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setGeometry(QtCore.QRect(0, 21, 703, 660))
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout_4 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.splitter = QtGui.QSplitter(self.centralwidget)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setObjectName("splitter")
        self.tabWidget = QtGui.QTabWidget(self.splitter)
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtGui.QWidget()
        self.tab.setGeometry(QtCore.QRect(0, 0, 679, 373))
        self.tab.setObjectName("tab")
        self.vboxlayout = QtGui.QVBoxLayout(self.tab)
        self.vboxlayout.setObjectName("vboxlayout")
        self.label_4 = QtGui.QLabel(self.tab)
        self.label_4.setOpenExternalLinks(True)
        self.label_4.setObjectName("label_4")
        self.vboxlayout.addWidget(self.label_4)
        self.hboxlayout = QtGui.QHBoxLayout()
        self.hboxlayout.setObjectName("hboxlayout")
        self.radioRecommended = QtGui.QRadioButton(self.tab)
        self.radioRecommended.setChecked(True)
        self.radioRecommended.setObjectName("radioRecommended")
        self.hboxlayout.addWidget(self.radioRecommended)
        self.radioAll = QtGui.QRadioButton(self.tab)
        self.radioAll.setObjectName("radioAll")
        self.hboxlayout.addWidget(self.radioAll)
        self.radioUpdate = QtGui.QRadioButton(self.tab)
        self.radioUpdate.setObjectName("radioUpdate")
        self.hboxlayout.addWidget(self.radioUpdate)
        self.radioInstalled = QtGui.QRadioButton(self.tab)
        self.radioInstalled.setObjectName("radioInstalled")
        self.hboxlayout.addWidget(self.radioInstalled)
        self.vboxlayout.addLayout(self.hboxlayout)
        self.packageList = QtGui.QListWidget(self.tab)
        self.packageList.setAlternatingRowColors(True)
        self.packageList.setSelectionMode(
            QtGui.QAbstractItemView.MultiSelection)
        self.packageList.setSortingEnabled(True)
        self.packageList.setObjectName("packageList")
        self.vboxlayout.addWidget(self.packageList)
        self.hboxlayout1 = QtGui.QHBoxLayout()
        self.hboxlayout1.setObjectName("hboxlayout1")
        self.checkAll = QtGui.QPushButton(self.tab)
        self.checkAll.setFlat(True)
        self.checkAll.setObjectName("checkAll")
        self.hboxlayout1.addWidget(self.checkAll)
        self.ClearAll = QtGui.QPushButton(self.tab)
        self.ClearAll.setFlat(True)
        self.ClearAll.setObjectName("ClearAll")
        self.hboxlayout1.addWidget(self.ClearAll)
        spacerItem = QtGui.QSpacerItem(521, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.hboxlayout1.addItem(spacerItem)
        self.vboxlayout.addLayout(self.hboxlayout1)
        self.hboxlayout2 = QtGui.QHBoxLayout()
        self.hboxlayout2.setSpacing(6)
        self.hboxlayout2.setContentsMargins(0, 0, 0, 0)
        self.hboxlayout2.setObjectName("hboxlayout2")
        self.proceedButton = QtGui.QPushButton(self.tab)
        self.proceedButton.setObjectName("proceedButton")
        self.hboxlayout2.addWidget(self.proceedButton)
        self.refreshButton = QtGui.QPushButton(self.tab)
        self.refreshButton.setObjectName("refreshButton")
        self.hboxlayout2.addWidget(self.refreshButton)
        self.vboxlayout.addLayout(self.hboxlayout2)
        self.tabWidget.addTab(self.tab, "")
        self.OtherEggs = QtGui.QWidget()
        self.OtherEggs.setGeometry(QtCore.QRect(0, 0, 679, 373))
        self.OtherEggs.setObjectName("OtherEggs")
        self.vboxlayout1 = QtGui.QVBoxLayout(self.OtherEggs)
        self.vboxlayout1.setObjectName("vboxlayout1")
        self.label = QtGui.QLabel(self.OtherEggs)
        self.label.setOpenExternalLinks(True)
        self.label.setObjectName("label")
        self.vboxlayout1.addWidget(self.label)
        self.hboxlayout3 = QtGui.QHBoxLayout()
        self.hboxlayout3.setObjectName("hboxlayout3")
        self.requestEdit = QtGui.QLineEdit(self.OtherEggs)
        self.requestEdit.setObjectName("requestEdit")
        self.hboxlayout3.addWidget(self.requestEdit)
        self.fileButton = QtGui.QPushButton(self.OtherEggs)
        self.fileButton.setObjectName("fileButton")
        self.hboxlayout3.addWidget(self.fileButton)
        self.vboxlayout1.addLayout(self.hboxlayout3)
        spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
                                        QtGui.QSizePolicy.Expanding)
        self.vboxlayout1.addItem(spacerItem1)
        self.hboxlayout4 = QtGui.QHBoxLayout()
        self.hboxlayout4.setObjectName("hboxlayout4")
        self.customInstallButton = QtGui.QPushButton(self.OtherEggs)
        self.customInstallButton.setObjectName("customInstallButton")
        self.hboxlayout4.addWidget(self.customInstallButton)
        self.vboxlayout1.addLayout(self.hboxlayout4)
        self.tabWidget.addTab(self.OtherEggs, "")
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setGeometry(QtCore.QRect(0, 0, 679, 373))
        self.tab_2.setObjectName("tab_2")
        self.vboxlayout2 = QtGui.QVBoxLayout(self.tab_2)
        self.vboxlayout2.setObjectName("vboxlayout2")
        self.label_2 = QtGui.QLabel(self.tab_2)
        self.label_2.setObjectName("label_2")
        self.vboxlayout2.addWidget(self.label_2)
        self.locationList = QtGui.QListWidget(self.tab_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.locationList.sizePolicy().hasHeightForWidth())
        self.locationList.setSizePolicy(sizePolicy)
        self.locationList.setObjectName("locationList")
        self.vboxlayout2.addWidget(self.locationList)
        self.hboxlayout5 = QtGui.QHBoxLayout()
        self.hboxlayout5.setSpacing(6)
        self.hboxlayout5.setContentsMargins(0, 0, 0, 0)
        self.hboxlayout5.setObjectName("hboxlayout5")
        self.addLocButton = QtGui.QPushButton(self.tab_2)
        self.addLocButton.setObjectName("addLocButton")
        self.hboxlayout5.addWidget(self.addLocButton)
        self.removeLocButton = QtGui.QPushButton(self.tab_2)
        self.removeLocButton.setObjectName("removeLocButton")
        self.hboxlayout5.addWidget(self.removeLocButton)
        self.vboxlayout2.addLayout(self.hboxlayout5)
        self.tabWidget.addTab(self.tab_2, "")
        self.customPackagePage = QtGui.QWidget()
        self.customPackagePage.setGeometry(QtCore.QRect(0, 0, 679, 373))
        self.customPackagePage.setObjectName("customPackagePage")
        self.gridLayout_2 = QtGui.QGridLayout(self.customPackagePage)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.label_5 = QtGui.QLabel(self.customPackagePage)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_5.sizePolicy().hasHeightForWidth())
        self.label_5.setSizePolicy(sizePolicy)
        self.label_5.setObjectName("label_5")
        self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 5)
        self.label_6 = QtGui.QLabel(self.customPackagePage)
        self.label_6.setObjectName("label_6")
        self.gridLayout_2.addWidget(self.label_6, 1, 0, 1, 1)
        self.customPackageNameEdit = QtGui.QLineEdit(self.customPackagePage)
        self.customPackageNameEdit.setObjectName("customPackageNameEdit")
        self.gridLayout_2.addWidget(self.customPackageNameEdit, 1, 1, 1, 4)
        self.label_7 = QtGui.QLabel(self.customPackagePage)
        self.label_7.setObjectName("label_7")
        self.gridLayout_2.addWidget(self.label_7, 2, 0, 1, 1)
        self.customPackageVersionEdit = QtGui.QLineEdit(self.customPackagePage)
        self.customPackageVersionEdit.setObjectName("customPackageVersionEdit")
        self.gridLayout_2.addWidget(self.customPackageVersionEdit, 2, 1, 1, 1)
        spacerItem2 = QtGui.QSpacerItem(291, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem2, 2, 2, 1, 2)
        self.label_8 = QtGui.QLabel(self.customPackagePage)
        self.label_8.setObjectName("label_8")
        self.gridLayout_2.addWidget(self.label_8, 3, 0, 1, 1)
        self.customPackageDirEdit = QtGui.QLineEdit(self.customPackagePage)
        self.customPackageDirEdit.setObjectName("customPackageDirEdit")
        self.gridLayout_2.addWidget(self.customPackageDirEdit, 3, 1, 1, 3)
        self.customPackageDirButton = QtGui.QPushButton(self.customPackagePage)
        self.customPackageDirButton.setObjectName("customPackageDirButton")
        self.gridLayout_2.addWidget(self.customPackageDirButton, 3, 4, 1, 1)
        self.customCppPackageFrame = QtGui.QGroupBox(self.customPackagePage)
        self.customCppPackageFrame.setEnabled(True)
        self.customCppPackageFrame.setCheckable(True)
        self.customCppPackageFrame.setChecked(False)
        self.customCppPackageFrame.setObjectName("customCppPackageFrame")
        self.gridLayout_3 = QtGui.QGridLayout(self.customCppPackageFrame)
        self.gridLayout_3.setSpacing(1)
        self.gridLayout_3.setContentsMargins(4, 1, 4, 1)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.label_9 = QtGui.QLabel(self.customCppPackageFrame)
        self.label_9.setObjectName("label_9")
        self.gridLayout_3.addWidget(self.label_9, 0, 0, 1, 1)
        self.customPackageIncludeEdit = QtGui.QLineEdit(
            self.customCppPackageFrame)
        self.customPackageIncludeEdit.setObjectName("customPackageIncludeEdit")
        self.gridLayout_3.addWidget(self.customPackageIncludeEdit, 0, 1, 1, 1)
        self.customPackageIncludeButton = QtGui.QPushButton(
            self.customCppPackageFrame)
        self.customPackageIncludeButton.setObjectName(
            "customPackageIncludeButton")
        self.gridLayout_3.addWidget(self.customPackageIncludeButton, 0, 2, 1,
                                    1)
        self.label_11 = QtGui.QLabel(self.customCppPackageFrame)
        self.label_11.setObjectName("label_11")
        self.gridLayout_3.addWidget(self.label_11, 1, 0, 1, 1)
        self.customPackageLibEdit = QtGui.QLineEdit(self.customCppPackageFrame)
        self.customPackageLibEdit.setObjectName("customPackageLibEdit")
        self.gridLayout_3.addWidget(self.customPackageLibEdit, 1, 1, 1, 1)
        self.customPackageLibButton = QtGui.QPushButton(
            self.customCppPackageFrame)
        self.customPackageLibButton.setObjectName("customPackageLibButton")
        self.gridLayout_3.addWidget(self.customPackageLibButton, 1, 2, 1, 1)
        self.label_13 = QtGui.QLabel(self.customCppPackageFrame)
        self.label_13.setObjectName("label_13")
        self.gridLayout_3.addWidget(self.label_13, 2, 0, 1, 1)
        self.customPackageBinEdit = QtGui.QLineEdit(self.customCppPackageFrame)
        self.customPackageBinEdit.setObjectName("customPackageBinEdit")
        self.gridLayout_3.addWidget(self.customPackageBinEdit, 2, 1, 1, 1)
        self.customPackageBinButton = QtGui.QPushButton(
            self.customCppPackageFrame)
        self.customPackageBinButton.setObjectName("customPackageBinButton")
        self.gridLayout_3.addWidget(self.customPackageBinButton, 2, 2, 1, 1)
        self.gridLayout_2.addWidget(self.customCppPackageFrame, 4, 0, 1, 5)
        self.customPythonPackageFrame = QtGui.QGroupBox(self.customPackagePage)
        self.customPythonPackageFrame.setEnabled(True)
        self.customPythonPackageFrame.setCheckable(True)
        self.customPythonPackageFrame.setChecked(False)
        self.customPythonPackageFrame.setObjectName("customPythonPackageFrame")
        self.gridLayout = QtGui.QGridLayout(self.customPythonPackageFrame)
        self.gridLayout.setSpacing(2)
        self.gridLayout.setContentsMargins(4, 0, 2, 4)
        self.gridLayout.setObjectName("gridLayout")
        self.label_12 = QtGui.QLabel(self.customPythonPackageFrame)
        self.label_12.setObjectName("label_12")
        self.gridLayout.addWidget(self.label_12, 0, 0, 1, 1)
        self.customPythonPackageEdit = QtGui.QLineEdit(
            self.customPythonPackageFrame)
        self.customPythonPackageEdit.setObjectName("customPythonPackageEdit")
        self.gridLayout.addWidget(self.customPythonPackageEdit, 0, 1, 1, 1)
        self.customPythonPackageButton = QtGui.QPushButton(
            self.customPythonPackageFrame)
        self.customPythonPackageButton.setObjectName(
            "customPythonPackageButton")
        self.gridLayout.addWidget(self.customPythonPackageButton, 0, 2, 1, 1)
        self.pythonNamespaceFrame = QtGui.QGroupBox(
            self.customPythonPackageFrame)
        self.pythonNamespaceFrame.setCheckable(True)
        self.pythonNamespaceFrame.setChecked(False)
        self.pythonNamespaceFrame.setObjectName("pythonNamespaceFrame")
        self.horizontalLayout = QtGui.QHBoxLayout(self.pythonNamespaceFrame)
        self.horizontalLayout.setSpacing(2)
        self.horizontalLayout.setContentsMargins(4, 1, 4, 4)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_10 = QtGui.QLabel(self.pythonNamespaceFrame)
        self.label_10.setObjectName("label_10")
        self.horizontalLayout.addWidget(self.label_10)
        self.namespaceEdit = QtGui.QLineEdit(self.pythonNamespaceFrame)
        self.namespaceEdit.setObjectName("namespaceEdit")
        self.horizontalLayout.addWidget(self.namespaceEdit)
        self.gridLayout.addWidget(self.pythonNamespaceFrame, 1, 1, 1, 1)
        self.gridLayout_2.addWidget(self.customPythonPackageFrame, 5, 0, 1, 5)
        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem3, 6, 1, 1, 2)
        self.customResetButton = QtGui.QPushButton(self.customPackagePage)
        self.customResetButton.setObjectName("customResetButton")
        self.gridLayout_2.addWidget(self.customResetButton, 6, 3, 1, 1)
        self.customApplyButton = QtGui.QPushButton(self.customPackagePage)
        self.customApplyButton.setObjectName("customApplyButton")
        self.gridLayout_2.addWidget(self.customApplyButton, 6, 4, 1, 1)
        self.tabWidget.addTab(self.customPackagePage, "")
        self.layoutWidget = QtGui.QWidget(self.splitter)
        self.layoutWidget.setObjectName("layoutWidget")
        self.vboxlayout3 = QtGui.QVBoxLayout(self.layoutWidget)
        self.vboxlayout3.setObjectName("vboxlayout3")
        self.label_3 = QtGui.QLabel(self.layoutWidget)
        self.label_3.setObjectName("label_3")
        self.vboxlayout3.addWidget(self.label_3)
        self.logText = QtGui.QTextEdit(self.layoutWidget)
        self.logText.setReadOnly(True)
        self.logText.setObjectName("logText")
        self.vboxlayout3.addWidget(self.logText)
        self.gridLayout_4.addWidget(self.splitter, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 703, 21))
        self.menubar.setObjectName("menubar")
        self.menuAuthentification = QtGui.QMenu(self.menubar)
        self.menuAuthentification.setObjectName("menuAuthentification")
        self.menu_File = QtGui.QMenu(self.menubar)
        self.menu_File.setObjectName("menu_File")
        self.menuHelp = QtGui.QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        MainWindow.setMenuBar(self.menubar)
        self.actionCookie_Session = QtGui.QAction(MainWindow)
        self.actionCookie_Session.setObjectName("actionCookie_Session")
        self.action_Quit = QtGui.QAction(MainWindow)
        self.action_Quit.setObjectName("action_Quit")
        self.action_About = QtGui.QAction(MainWindow)
        self.action_About.setObjectName("action_About")
        self.action_Web = QtGui.QAction(MainWindow)
        self.action_Web.setObjectName("action_Web")
        self.menuAuthentification.addAction(self.actionCookie_Session)
        self.menu_File.addAction(self.action_Quit)
        self.menuHelp.addAction(self.action_About)
        self.menuHelp.addAction(self.action_Web)
        self.menubar.addAction(self.menu_File.menuAction())
        self.menubar.addAction(self.menuAuthentification.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.tabWidget, self.radioRecommended)
        MainWindow.setTabOrder(self.radioRecommended, self.radioAll)
        MainWindow.setTabOrder(self.radioAll, self.radioUpdate)
        MainWindow.setTabOrder(self.radioUpdate, self.radioInstalled)
        MainWindow.setTabOrder(self.radioInstalled, self.packageList)
        MainWindow.setTabOrder(self.packageList, self.checkAll)
        MainWindow.setTabOrder(self.checkAll, self.ClearAll)
        MainWindow.setTabOrder(self.ClearAll, self.proceedButton)
        MainWindow.setTabOrder(self.proceedButton, self.refreshButton)
        MainWindow.setTabOrder(self.refreshButton, self.logText)
        MainWindow.setTabOrder(self.logText, self.requestEdit)
        MainWindow.setTabOrder(self.requestEdit, self.fileButton)
        MainWindow.setTabOrder(self.fileButton, self.customInstallButton)
        MainWindow.setTabOrder(self.customInstallButton, self.locationList)
        MainWindow.setTabOrder(self.locationList, self.addLocButton)
        MainWindow.setTabOrder(self.addLocButton, self.removeLocButton)
from openalea.vpltk.qt import QtGui
from openalea.image_wralea.gui.select_box_widget import SelectBoxWidget

qapp = QtGui.QApplication.instance()

if qapp:

    class DummyNode(object):
        def set_input(self, *args):
            pass

        def get_input(self, *args):
            pass

        def register_listener(self, *args):
            pass

    w = SelectBoxWidget(DummyNode())
    w.setPixmap(QtGui.QPixmap("4_ocean_currents.png"))

    w.show()
for this in ['SeveralAxesOnSameFigure']:
    factory = pkg.get_factory(this)
    node = factory.instantiate()

    #run_and_display(('openalea.pylab.test', 'hist'),{},pm=pm)

    view = GraphicalGraph.create_view(node)
    view.show()
    #QtGui.QPixmap.grabWindow(GtGui.QApplication.desktop().winId()).save('%s.png' % this, 'png')

    filename = 'dataflow_%s.png' % this

    # Get current workspace
    # Retreive the user layout
    rect = view.scene().sceneRect()
    matrix = view.matrix()
    rect = matrix.mapRect(rect)

    pixmap = QtGui.QPixmap(rect.width(), rect.height())
    pixmap.fill()
    painter = QtGui.QPainter(pixmap)
    painter.setRenderHint(QtGui.QPainter.Antialiasing)
    view.update()
    view.render(painter)
    #view.scene().render(painter)
    painter.end()
    pixmap.save(filename)

    view.close()
#app.exec_()