示例#1
0
    def startFilm(self, film_settings=None):
        # Disable live mode check box
        self.ui.liveModeCheckBox.setEnabled(False)

        # Pause live view mode (if running)
        if self.ui.liveModeCheckBox.isChecked():
            self.stopCamera()
        self.stopLiveView()

        self.filming = True
        self.film_name = os.path.join(self.parameters.get("film.directory"),
                                      str(self.ui.filenameLabel.text()))
        self.film_name = self.film_name[:-len(self.ui.filetypeComboBox.
                                              currentText())]

        if film_settings is None:
            film_settings = filmSettings.FilmSettings(
                self.parameters.get("film.acq_mode"),
                self.parameters.get("film.frames"))
            save_film = self.ui.saveMovieCheckBox.isChecked()
        else:
            save_film = True

        self.writer = None
        self.ui.recordButton.setText("Stop")
        try:
            # Film file prep
            if save_film:
                self.writer = writers.createFileWriter(
                    self.ui.filetypeComboBox.currentText(), self.film_name,
                    self.parameters, self.camera.getFeedNamesToSave())
                self.camera.startFilm(self.writer, film_settings)
                self.ui.recordButton.setStyleSheet(
                    "QPushButton { color: red }")
            else:
                self.camera.startFilm(None, film_settings)
                self.ui.recordButton.setStyleSheet(
                    "QPushButton { color: orange }")
                self.film_name = False

            # Modules.
            for module in self.modules:
                module.startFilm(self.film_name,
                                 self.ui.autoShuttersCheckBox.isChecked())

        except halModule.StartFilmException as error:  # Handle any start Film errors
            error_message = "startFilm() in HAL encountered an error: \n" + str(
                error)
            hdebug.logText(error_message)

            # Handle error returning to Dave. The subsequent call to stopFilm() will handle sending this message
            if self.tcp_requested_movie:
                message = self.tcp_message
                message.setError(True, error_message)

        # Disable parameters radio buttons.
        self.parameters_box.startFilm()

        # go...
        self.startCamera()
示例#2
0
    def startFilm(self, film_settings = None):
        self.filming = True
        self.film_name = self.parameters.get("film.directory") + str(self.ui.filenameLabel.text())
        self.film_name = self.film_name[:-len(self.ui.filetypeComboBox.currentText())]

        if not film_settings:
            film_settings = filmSettings.FilmSettings(self.parameters.get("film.acq_mode"),
                                                      self.parameters.get("film.frames"))
            save_film = self.ui.saveMovieCheckBox.isChecked()
        else:
            save_film = True

        # Film file prep.
        self.writer = False
        self.ui.recordButton.setText("Stop")
        if save_film:
            if (self.ui_mode == "dual"):
                self.writer = writers.createFileWriter(self.ui.filetypeComboBox.currentText(),
                                                       self.film_name,
                                                       self.parameters,
                                                       ["camera1", "camera2"])
            else:
                self.writer = writers.createFileWriter(self.ui.filetypeComboBox.currentText(),
                                                       self.film_name,
                                                       self.parameters,
                                                       ["camera1"])
            self.camera.startFilm(self.writer, film_settings)
            self.ui.recordButton.setStyleSheet("QPushButton { color: red }")
        else:
            self.camera.startFilm(None, film_settings)
            self.ui.recordButton.setStyleSheet("QPushButton { color: orange }")
            self.film_name = False

        # Modules.
        for module in self.modules:
            module.startFilm(self.film_name, self.ui.autoShuttersCheckBox.isChecked())

        # Disable parameters radio buttons.
        self.parameters_box.startFilm()

        # Enable record button so that TCP requested films can be stopped.
        #if self.tcp_requested_movie:
        #    self.ui.recordButton.setEnabled(True)

        # go...
        self.startCamera()
示例#3
0
    def startFilm(self, film_settings = None):
        self.filming = True
        self.film_name = self.parameters.get("directory") + str(self.ui.filenameLabel.text())
        self.film_name = self.film_name[:-len(self.ui.filetypeComboBox.currentText())]

        if not film_settings:
            film_settings = filmSettings.FilmSettings(self.parameters.get("acq_mode"),
                                                      self.parameters.get("frames"))
            save_film = self.ui.saveMovieCheckBox.isChecked()
        else:
            save_film = True

        # Film file prep.
        self.writer = False
        self.ui.recordButton.setText("Stop")
        if save_film:
            if (self.ui_mode == "dual"):
                self.writer = writers.createFileWriter(self.ui.filetypeComboBox.currentText(),
                                                       self.film_name,
                                                       self.parameters,
                                                       ["camera1", "camera2"])
            else:
                self.writer = writers.createFileWriter(self.ui.filetypeComboBox.currentText(),
                                                       self.film_name,
                                                       self.parameters,
                                                       ["camera1"])
            self.camera.startFilm(self.writer, film_settings)
            self.ui.recordButton.setStyleSheet("QPushButton { color: red }")
        else:
            self.camera.startFilm(None, film_settings)
            self.ui.recordButton.setStyleSheet("QPushButton { color: orange }")
            self.film_name = False

        # Modules.
        for module in self.modules:
            module.startFilm(self.film_name, self.ui.autoShuttersCheckBox.isChecked())

        # Disable parameters radio buttons.
        self.parameters_box.startFilm()

        # Enable record button so that TCP requested films can be stopped.
        #if self.tcp_requested_movie:
        #    self.ui.recordButton.setEnabled(True)

        # go...
        self.startCamera()
示例#4
0
    def startFilm(self, film_settings = None):
        # Disable live mode check box
        self.ui.liveModeCheckBox.setEnabled(False)
        
        # Pause live view mode (if running)
        if self.ui.liveModeCheckBox.isChecked():
            self.stopCamera()
        self.stopLiveView()
        
        self.filming = True
        self.film_name = os.path.join(self.parameters.get("film.directory"), str(self.ui.filenameLabel.text()))
        self.film_name = self.film_name[:-len(self.ui.filetypeComboBox.currentText())]

        if film_settings is None:
            film_settings = filmSettings.FilmSettings(self.parameters.get("film.acq_mode"),
                                                      self.parameters.get("film.frames"))
            save_film = self.ui.saveMovieCheckBox.isChecked()
        else:
            save_film = True

        self.writer = None
        self.ui.recordButton.setText("Stop")
        try:
            # Film file prep
            if save_film:
                self.writer = writers.createFileWriter(self.ui.filetypeComboBox.currentText(),
                                                       self.film_name,
                                                       self.parameters,
                                                       self.camera.getFeedNamesToSave())
                self.camera.startFilm(self.writer, film_settings)
                self.ui.recordButton.setStyleSheet("QPushButton { color: red }")
            else:
                self.camera.startFilm(None, film_settings)
                self.ui.recordButton.setStyleSheet("QPushButton { color: orange }")
                self.film_name = False

            # Modules.
            for module in self.modules:
                module.startFilm(self.film_name, self.ui.autoShuttersCheckBox.isChecked())
                
        except halModule.StartFilmException as error: # Handle any start Film errors
            error_message = "startFilm() in HAL encountered an error: \n" + str(error)
            hdebug.logText(error_message)

            # Handle error returning to Dave. The subsequent call to stopFilm() will handle sending this message
            if self.tcp_requested_movie:
                message = self.tcp_message
                message.setError(True, error_message)

        # Disable parameters radio buttons.
        self.parameters_box.startFilm()

        # go...
        self.startCamera()
示例#5
0
    def startFilm(self, film_settings = None):
        self.filming = True
        self.film_name = self.parameters.directory + str(self.ui.filenameLabel.text())
        self.film_name = self.film_name[:-len(self.ui.filetypeComboBox.currentText())]

        if not film_settings:
            film_settings = filmSettings.FilmSettings(self.parameters.acq_mode,
                                                      self.parameters.frames)
            save_film = self.ui.saveMovieCheckBox.isChecked()
        else:
            save_film = True

        # film file prep
        self.writer = False
        self.ui.recordButton.setText("Stop")
        if save_film:
            if (self.ui_mode == "dual"):
                self.writer = writers.createFileWriter(self.ui.filetypeComboBox.currentText(),
                                                       self.film_name,
                                                       self.parameters,
                                                       ["camera1", "camera2"])
            else:
                self.writer = writers.createFileWriter(self.ui.filetypeComboBox.currentText(),
                                                       self.film_name,
                                                       self.parameters,
                                                       ["camera1"])
            self.camera.startFilm(self.writer, film_settings)
            self.ui.recordButton.setStyleSheet("QPushButton { color: red }")
        else:
            self.camera.startFilm(None, film_settings)
            self.ui.recordButton.setStyleSheet("QPushButton { color: orange }")
            self.film_name = False

        # modules
        for module in self.modules:
            module.startFilm(self.film_name, self.ui.autoShuttersCheckBox.isChecked())

        # go...
        self.startCamera()