def testShow(self):
     from PyMca5.PyMcaGui.plotting import MaskImageWidget
     widget = MaskImageWidget.MaskImageWidget()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
Exemple #2
0
    def _build(self,
               math=True,
               replace=False,
               scanwindow=False,
               selection=False):
        if math:
            if math == "kmeans":
                self._buildKMeansMath()
            else:
                self._buildMath()
        if selection:
            imageicons = True
        else:
            imageicons = False

        self.graphWidget = MaskImageWidget.MaskImageWidget(
            self,
            colormap=True,
            standalonesave=True,
            imageicons=imageicons,
            profileselection=True,
            selection=selection,
            scanwindow=scanwindow,
            aspect=True)

        self.nameBox = qt.QWidget(self)
        self.nameBox.mainLayout = qt.QHBoxLayout(self.nameBox)

        self.nameLabel = qt.QLabel(self.nameBox)

        self.nameLabel.setText("Image Name = ")
        #self.nameLabel.setText(qt.QString(qt.QChar(0x3A3)))

        self.name = qt.QLineEdit(self.nameBox)
        self.nameBox.mainLayout.addWidget(self.nameLabel)
        self.nameBox.mainLayout.addWidget(self.name)

        # The IMAGE selection
        #self.imageButtonBox = qt.QWidget(self)
        self.imageButtonBox = self.nameBox
        buttonBox = self.imageButtonBox
        #self.imageButtonBoxLayout = qt.QHBoxLayout(buttonBox)
        self.imageButtonBoxLayout = self.nameBox.mainLayout
        self.imageButtonBoxLayout.setContentsMargins(0, 0, 0, 0)
        self.imageButtonBoxLayout.setSpacing(0)
        self.addImageButton = qt.QPushButton(buttonBox)
        icon = qt.QIcon(qt.QPixmap(IconDict["rgb16"]))
        self.addImageButton.setIcon(icon)
        self.addImageButton.setText("ADD IMAGE")
        self.removeImageButton = qt.QPushButton(buttonBox)
        self.removeImageButton.setIcon(icon)
        self.removeImageButton.setText("REMOVE IMAGE")
        self.imageButtonBoxLayout.addWidget(self.addImageButton)
        self.imageButtonBoxLayout.addWidget(self.removeImageButton)
        if replace:
            self.replaceImageButton = qt.QPushButton(buttonBox)
            self.replaceImageButton.setIcon(icon)
            self.replaceImageButton.setText("REPLACE IMAGE")
            self.imageButtonBoxLayout.addWidget(self.replaceImageButton)

        #self.mainLayout.addWidget(self.nameBox)
        self.mainLayout.addWidget(self.graphWidget)
        self.mainLayout.addWidget(buttonBox)
        self.addImageButton.clicked.connect(self._addImageClicked)
        self.removeImageButton.clicked.connect(self._removeImageClicked)
        if replace:
            self.replaceImageButton.clicked.connect( \
                self._replaceImageClicked)

        #it consumes too much CPU, therefore only on click
        #self.graphWidget.graph.canvas().setMouseTracking(1)
        self.graphWidget.graphWidget.showInfo()
        self.graphWidget.graphWidget.graph.sigPlotSignal.connect(\
                                self._graphSignal)