Exemple #1
0
    def initWins(self):
        # viewer main form
        newWin = QMainWindow(self.mainWin)
        newWin.setAttribute(Qt.WA_DeleteOnClose)
        newWin.setContextMenuPolicy(Qt.CustomContextMenu)
        self.newWin = newWin
        # image list
        listWdg = dragQListWidget()
        listWdg.setWrapping(False)
        listWdg.setSelectionMode(QAbstractItemView.ExtendedSelection)
        listWdg.setContextMenuPolicy(Qt.CustomContextMenu)
        listWdg.label = None
        listWdg.setViewMode(QListWidget.IconMode)
        # set icon and listWdg sizes
        listWdg.setIconSize(QSize(self.iconSize, self.iconSize))
        listWdg.setMaximumSize(160000, self.iconSize + 20)
        listWdg.setDragDropMode(QAbstractItemView.DragDrop)
        listWdg.customContextMenuRequested.connect(self.contextMenu)
        # dock the form
        dock = stateAwareQDockWidget(window)
        dock.setWidget(newWin)
        dock.setWindowFlags(newWin.windowFlags())
        dock.setWindowTitle(newWin.windowTitle())
        dock.setAttribute(Qt.WA_DeleteOnClose)
        self.dock = dock
        window.addDockWidget(Qt.BottomDockWidgetArea, dock)
        newWin.setCentralWidget(listWdg)
        self.listWdg = listWdg
        self.newWin.setWhatsThis("""<b>Library Viewer</b><br>
To <b>open context menu</b> right click on an icon or a selection.<br>
To <b>open an image</b> drag it onto the main window.<br>
<b>Rating</b> is shown as 0 to 5 stars below each icon.<br>
""")  # end setWhatsThis
Exemple #2
0
    def showToneSpline(self):
        """
        On first call, init and show the Tone Curve form.
        Otherwise, show the form.
        Return True if called for the first time, False otherwise.
        @return:
        @rtype: boolean
        """
        axeSize = 200
        if self.toneForm is None:
            form = graphicsToneForm.getNewWindow(targetImage=self.targetImage, axeSize=axeSize, layer=self.layer, parent=self,
                                                  curveType='cubic')
            form.setWindowFlags(Qt.WindowStaysOnTopHint)
            form.setAttribute(Qt.WA_DeleteOnClose, on=False)
            form.setWindowTitle('Cam Tone Curve')
            form.setButtonText('Reset Curve')
            # get base curve from profile
            toneCurve = dngProfileToneCurve(self.dngDict.get('ProfileToneCurve', []))
            form.baseCurve = [QPointF(x*axeSize, -y*axeSize) for x, y in zip(toneCurve.dataX, toneCurve.dataY)]

            def f():
                layer = self.layer
                layer.bufCache_HSV_CV32 = None
                layer.applyToStack()
                layer.parentImage.onImageChanged()
            form.scene().quadricB.curveChanged.sig.connect(f)
            self.toneForm = form
            dockT = stateAwareQDockWidget(self.parent())
            dockT.setWindowFlags(form.windowFlags())
            dockT.setWindowTitle(form.windowTitle())
            dockT.setStyleSheet(
                "QGraphicsView{margin: 10px; border-style: solid; border-width: 1px; border-radius: 1px;}")
            window = self.parent().parent()
            window.addDockWidget(Qt.LeftDockWidgetArea, dockT)
            self.dockT = dockT
            dockT.setWidget(form)
            showFirst = True
            form.setWhatsThis(
                            """<b>Camera Profile Tone Curve</b><br>
                            The profile curve, if any, is applied as a starting point for user adjustments,
                            after raw post-processing.
                            Its input and output are in <b>linear</b> gamma.
                            The curve is shown in red and cannot be changed.<br>
                            A user curve, shown in black, is editable and is applied right after the
                            former.<br>         
                            """
            )  # end of setWhatsThis
        else:
            form = self.toneForm
            showFirst = False
        form.scene().setSceneRect(-25, -axeSize - 25, axeSize + 50, axeSize + 50)
        self.dockT.showNormal()
        return showFirst
    def setContrastSpline(self, a, b, d, T):
        """
        Updates and displays the contrast spline viewer.
        The form is created only once.
        (Cf also rawForm.setCoBrSat.setContrastSpline).
        @param a: x_coordinates
        @type a:
        @param b: y-coordinates
        @type b:
        @param d: tangent slopes
        @type d:
        @param T: spline
        @type T: ndarray dtype=float
        """
        axeSize = 200
        if self.contrastForm is None:
            form = graphicsSplineForm.getNewWindow(targetImage=None, axeSize=axeSize, layer=self.layer, parent=None)
            form.setAttribute(Qt.WA_DeleteOnClose, on=False)
            form.setWindowTitle('Contrast Curve')
            form.setMaximumSize(300, 400)
            self.contrastForm = form
            window = self.parent().parent()
            dock = stateAwareQDockWidget(self.parent())
            dock.setWidget(form)
            dock.setWindowFlags(form.windowFlags())
            dock.setWindowTitle(form.windowTitle())
            dock.setStyleSheet("QGraphicsView{margin: 10px; border-style: solid; border-width: 1px; border-radius: 1px;}")
            window.addDockWidget(Qt.LeftDockWidgetArea, dock)
            self.dock = dock

            # curve changed slot
            def f():
                self.layer.applyToStack()
                self.layer.parentImage.onImageChanged()
            form.scene().quadricB.curveChanged.sig.connect(f)
        else:
            form = self.contrastForm
        # update the curve
        form.scene().setSceneRect(-25, -axeSize-25, axeSize+50, axeSize+50)
        form.scene().quadricB.setCurve(a*axeSize, b*axeSize,d, T*axeSize)
        self.dock.showNormal()
Exemple #4
0
 def addSubcontrol(self, parent=None):
     dock = stateAwareQDockWidget(parent)
     self.subControls.append(dock)
     return dock