Example #1
0
class CapturePreviewWidget(QtGui.QWidget):
    def __init__(self, parent=None, lights=[]):
        super(CapturePreviewWidget, self).__init__(parent)
        self.ui = Ui_capturePreview()
        self.ui.setupUi(self)
        # make and add the graphics scene to siplay the preview image
        self.previewGraphicsScene = QtGui.QGraphicsScene()
        self.ui.previewGraphicsView.setScene(self.previewGraphicsScene)
        self.ui.previewGraphicsView.scale(0.35, 0.35)
        if len(lights) > 0:
            self.ui.activateSingleLightComboBox.addItems(lights)
        else:
            self.ui.activateSingleLightComboBox.setEnabled(False)

    def setAutofocusLockStatus(self, locked):
        if locked:
            self.ui.autofocusLockStatusLabel.setText("Autofocus Locked")
        else:
            self.ui.autofocusLockStatusLabel.setText("Autofocus Not Locked")

    def setPreviewImage(self, pixmap):
        gitems = self.previewGraphicsScene.items()
        for gitem in gitems:
            self.previewGraphicsScene.removeItem(gitem)
        self.previewGraphicsScene.addPixmap(pixmap)
        self.previewGraphicsScene.setSceneRect(0, 0, pixmap.width(),
                                               pixmap.height())

    def setCaptureCallback(self, capturecallback):
        ''' sets the callback which will inform the app that a new image is wanted 
        capturecallback should be of form func() '''
        self.ui.newCaptureButton.clicked.connect(capturecallback)

    def setUnlockAutofocusCallback(self, callback):
        self.ui.unlockAutofocusButton.clicked.connect(callback)

    def setAutofocusCallback(self, callback):
        self.ui.lockAutofocusButton.clicked.connect(callback)

    def setActivateAllLightsCallback(self, activateAllLightsCallback):
        self.ui.activateAllLightsButton.clicked.connect(
            activateAllLightsCallback)

    def setDeactivateAllLightsCallback(self, deactivateAllLightsCallback):
        self.ui.deactivateAllLightsButton.clicked.connect(
            deactivateAllLightsCallback)

    def setActivateSingleLightIndexChangedCallback(
            self, activateSingleLightIndexChangedCallback):
        self.ui.activateSingleLightComboBox.currentIndexChanged.connect(
            activateSingleLightIndexChangedCallback)

    def getSingleLightCurrentIndex(self):
        return self.ui.activateSingleLightComboBox.currentIndex()
Example #2
0
 def __init__(self, parent=None, lights=[]):
     super(CapturePreviewWidget, self).__init__(parent)
     self.ui = Ui_capturePreview()
     self.ui.setupUi(self)
     # make and add the graphics scene to siplay the preview image
     self.previewGraphicsScene = QtGui.QGraphicsScene()
     self.ui.previewGraphicsView.setScene(self.previewGraphicsScene)
     self.ui.previewGraphicsView.scale(0.35, 0.35)
     if len(lights) > 0:
         self.ui.activateSingleLightComboBox.addItems(lights)
     else:
         self.ui.activateSingleLightComboBox.setEnabled(False)