示例#1
0
 def disableNextButton(self):
     if((CameraService.existPiCamera() or CameraService.existCameras())
             and self.hasPageTitlePicturePictures()
             and self.hasPageCapturePhotoLastPicture()
             and self.hasPageCapturePhotoLoadungGifs()):
         self.nextButton.setDisabled(False)
     else:
         self.nextButton.setDisabled(True)
示例#2
0
    def executeBefore(self):
        print("Start Video")
        self.videoLabel.setPixmap(QPixmap())
        if CfgService.get(CfgKey.GREENSCREEN_IS_ACTIVE):
            background = GreenscreenBackgroundService(
                self.globalVariable).getBackgroundAsHsv(
                    GreenscreenBackgroundService.VIDEO_KEY,
                    CfgService.get(CfgKey.PI_CAMERA_VIDEO_RESOLUTION))
            self.videoThread = CameraService.initialAndStartVideo(
                self.windowsize, self.globalVariable,
                self.setVideoStreamToLabel, background)
        else:
            self.videoThread = CameraService.initialAndStartVideo(
                self.windowsize, self.globalVariable,
                self.setVideoStreamToLabel)

        self.countdown = CfgService.get(
            CfgKey.PAGE_CAMERAPREVIEW_COUNTER_START_VALUE)
        self.timer.start(
            CfgService.get(CfgKey.PAGE_CAMERAPREVIEW_COUNTER_PERIOD_LENGTH))
示例#3
0
 def executeBefore(self):
     randomPicture = self.getRandomPicture()
     randomPicture.scaledToHeight(self.windowsize.height())
     if CfgService.get(CfgKey.GREENSCREEN_IS_ACTIVE):
         background = GreenscreenBackgroundService(
             self.globalVariable).getBackgroundAsHsv(
                 GreenscreenBackgroundService.PICTURE_KEY,
                 CfgService.get(CfgKey.PI_CAMERA_PHOTO_RESOLUTION))
         self.capturePhotoThread = CameraService.initialPhoto(
             self.globalVariable, background)
     else:
         self.capturePhotoThread = CameraService.initialPhoto(
             self.globalVariable)
     self.capturePhotoThread.start()
     self.counterLabel.setPixmap(
         randomPicture.scaledToHeight(self.windowsize.height()))
     self.countdown = CfgService.get(
         CfgKey.PAGE_CAPTUREPHOTO_TIMER_START_VALUE)
     self.timer.start(
         CfgService.get(CfgKey.PAGE_CAPTUREPHOTO_TIMER_PERIOD_LENGTH))
     self.isLoading = False
示例#4
0
    def setHints(self):
        self.textArea.clear()
        self.textArea.append(textValue[TextKey.PAGE_HINTS_ESCAPE_HINT])
        self.textArea.append("")
        self.textArea.append(textValue[TextKey.PAGE_HINTS_RECONFIG_HINT])
        self.textArea.append("")

        if not CameraService.existCameras() and not CameraService.existPiCamera():
            self.textArea.append(textValue[TextKey.PAGE_HINTS_NO_CAMERA_WARN])
            self.textArea.append("")
        elif not CameraService.existSelectedCamera() and not CameraService.existPiCamera():
            self.textArea.append(textValue[TextKey.PAGE_HINTS_NO_SELECTED_CAMERA_WARN])
            self.textArea.append("")
            #Erfolgsfaelle###########################################################################
        elif CameraService.existPiCamera():
            cameraInfoText = textValue[TextKey.PAGE_HINTS_SELECTED_PICAMERA_HINT]
            self.textArea.append(cameraInfoText)
            self.textArea.append("")
        else:
            cameraInfoText = textValue[TextKey.PAGE_HINTS_SELECTED_CAMERA_HINT] % (str(CameraService.getCameraIndex()),CameraService.getCameraName(), CameraService.getCameraDescription())
            self.textArea.append(cameraInfoText)
            self.textArea.append("")

        if not FileFolderService.hasFolderContent(CfgService.get(CfgKey.PAGE_TITLEPICTURE_BUTTON_IMAGE_FOLDER)):
            warn = textValue[TextKey.PAGE_HINTS_NO_PICTURES_FOUND_WARN] % (CfgService.get(CfgKey.PAGE_TITLEPICTURE_BUTTON_IMAGE_FOLDER))
            self.textArea.append(warn)
            self.textArea.append("")

        if not FileFolderService.hasFolderContent(CfgService.get(CfgKey.PAGE_CAPTUREPHOTO_LAST_IMAGE_FOLDER)):
            warn = textValue[TextKey.PAGE_HINTS_NO_PICTURES_FOUND_WARN] % (CfgService.get(CfgKey.PAGE_CAPTUREPHOTO_LAST_IMAGE_FOLDER))
            self.textArea.append(warn)
            self.textArea.append("")

        if not FileFolderService.hasFolderContent(CfgService.get(CfgKey.PAGE_CAPTUREPHOTO_LOADING_GIF_FOLDER)):
            warn = textValue[TextKey.PAGE_HINTS_NO_PICTURES_FOUND_WARN] % (CfgService.get(CfgKey.PAGE_CAPTUREPHOTO_LOADING_GIF_FOLDER))
            self.textArea.append(warn)
            self.textArea.append("")

        #Printer hint
        self.textArea.append(textValue[TextKey.PAGE_HINTS_PRINTER_STATUS_LABEL]+self.printerService.getPrinterStatus())
示例#5
0
    def executeBefore(self):
        posToleranceValues = CfgService.getIntList(CfgKey.GREENSCREEN_MAX_HSV_CV2_COLOR)
        self.posHTextField.setText(str(posToleranceValues[0]))
        self.posSTextField.setText(str(posToleranceValues[1]))
        self.posVTextField.setText(str(posToleranceValues[2]))
        negToleranceValues = CfgService.getIntList(CfgKey.GREENSCREEN_MIN_HSV_CV2_COLOR)
        self.negHTextField.setText(str(negToleranceValues[0]))
        self.negSTextField.setText(str(negToleranceValues[1]))
        self.negVTextField.setText(str(negToleranceValues[2]))

        self.minMaxStore = [negToleranceValues,posToleranceValues]
        background = GreenscreenBackgroundService(self.globalVariable).getBlackBackgroundAsHsv(CfgService.get(CfgKey.PI_CAMERA_VIDEO_RESOLUTION))
        self.videoThread = CameraService.initialAndStartVideo(QSize(self.windowSize.width()/2,self.windowSize.height()/2),self.globalVariable,self.setVideoStreamToLabel,background,self.setHsvPixelToLabel)
示例#6
0
 def executeBefore(self):
     print("Start Video")
     self.videoThread = CameraService.initialAndStartVideo(
         self.windowsize, self.globalVariable, self.setVideoStreamToLabel)
示例#7
0
    def __init__(self, pages: AllPages, windowsize: QSize,
                 globalPagesVariable: GlobalPagesVariableService):
        super().__init__(pages, windowsize)
        self.globalPagesVariable = globalPagesVariable
        self.greenscreenColorRangeService = GreenscreenColorRangeService()
        self.camera = CameraService.initGreenscreenCalibrationCam(
            QSize(windowsize.width() / 2,
                  windowsize.height() / 2))
        mainLayout = QVBoxLayout()
        mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(mainLayout)

        #Titel
        mainLayout.addWidget(
            self.getTitleAsQLabel(TextKey.PAGE_GREENSCREEN_COLOR_PICKER_TITLE))

        #Monitoring:
        colorLayout = QHBoxLayout()
        mainLayout.addLayout(colorLayout)

        self.averageColorLabel = QLineEdit()
        self.averageColorLabel.setReadOnly(True)
        colorLayout.addWidget(self.averageColorLabel)

        self.minColorLabel = QLineEdit()
        self.minColorLabel.setReadOnly(True)
        colorLayout.addWidget(self.minColorLabel)

        self.maxColorLabel = QLineEdit()
        self.maxColorLabel.setReadOnly(True)
        colorLayout.addWidget(self.maxColorLabel)

        #Hinweis:
        self.hintLabel = QLabel()
        mainLayout.addWidget(self.hintLabel)

        #Picture
        mainLayout.addStretch()
        self.picture = QLabel()
        self.picture.setAlignment(Qt.AlignCenter)
        mainLayout.addWidget(self.picture)

        #Buttons   ##################################################################################################
        mainLayout.addStretch()
        navigationTopLayout = QHBoxLayout()
        mainLayout.addLayout(navigationTopLayout)

        toleranceButton = QPushButton(
            textValue[TextKey.PAGE_GREENSCREEN_COLOR_PICKER_TOLERANCE_BUTTON])
        toleranceButton.clicked.connect(self._toleranceButtonEvent)
        self.setNavigationbuttonStyle(toleranceButton)
        navigationTopLayout.addWidget(toleranceButton)

        self.capturePhotoButton = QPushButton(textValue[
            TextKey.PAGE_GREENSCREEN_COLOR_PICKER_CAPTURE_PHOTO_BUTTON])
        self.capturePhotoButton.clicked.connect(self._capturePhotoEvent)
        self.setNavigationbuttonStyle(self.capturePhotoButton)
        navigationTopLayout.addWidget(self.capturePhotoButton)

        #Bottom ------------------------------------------------
        navigationBottomLayout = QHBoxLayout()
        mainLayout.addLayout(navigationBottomLayout)

        backButton = QPushButton(textValue[TextKey.PAGE_CONFIG_BACKBUTTON])
        backButton.clicked.connect(self._backPageSelectEvent)
        self.setNavigationbuttonStyle(backButton)
        navigationBottomLayout.addWidget(backButton)

        self.saveButton = QPushButton(
            textValue[TextKey.PAGE_GREENSCREEN_COLOR_PICKER_SAVE_BUTTON])
        self.saveButton.clicked.connect(self._saveEvent)
        self.setNavigationbuttonStyle(self.saveButton)
        navigationBottomLayout.addWidget(self.saveButton)