Exemplo n.º 1
0
    def standby(self, state):
        """Prepares the GStreamer pipelines for recording

        Sets the pipeline to paused state so that initiating a recording
        does not have a delay due to GStreamer initialization.
        """
        def toggle_gui(state):
            """Toggles GUI components when standby is pressed"""
            self.mainWidget.standbyPushButton.setHidden(state)
            self.mainWidget.recordPushButton.setVisible(state)
            self.mainWidget.recordPushButton.setEnabled(state)
            self.mainWidget.pauseToolButton.setVisible(state)
            self.mainWidget.eventComboBox.setDisabled(state)
            self.mainWidget.roomComboBox.setDisabled(state)
            self.mainWidget.dateComboBox.setDisabled(state)
            self.mainWidget.talkComboBox.setDisabled(state)
            self.mainWidget.audioFeedbackCheckbox.setDisabled(state)

        if (state):  # Prepare the pipelines
            if self.load_backend():
                toggle_gui(True)
                self.controller.pause()
                self.mainWidget.statusLabel.setText("{} {} --- {} ".format(
                    self.freeSpaceString, get_free_space(self.config.videodir),
                    self.readyString))
            else:
                toggle_gui(False)
                self.mainWidget.standbyPushButton.setChecked(False)
        else:
            toggle_gui(False)
            self.mainWidget.standbyPushButton.setChecked(False)

        self.mainWidget.playPushButton.setVisible(False)
        self.mainWidget.playPushButton.setEnabled(False)
Exemplo n.º 2
0
    def standby(self, state):
        """Prepares the GStreamer pipelines for recording

        Sets the pipeline to paused state so that initiating a recording
        does not have a delay due to GStreamer initialization.
        """
        def toggle_gui(state):
            """Toggles GUI components when standby is pressed"""
            self.mainWidget.standbyPushButton.setHidden(state)
            self.mainWidget.recordPushButton.setVisible(state)
            self.mainWidget.recordPushButton.setEnabled(state)
            self.mainWidget.pauseToolButton.setVisible(state)
            self.mainWidget.eventComboBox.setDisabled(state)
            self.mainWidget.roomComboBox.setDisabled(state)
            self.mainWidget.dateComboBox.setDisabled(state)
            self.mainWidget.talkComboBox.setDisabled(state)
            self.mainWidget.audioFeedbackCheckbox.setDisabled(state)

        if (state):  # Prepare the pipelines
            if self.load_backend():
                toggle_gui(True)
                self.controller.pause()
                self.mainWidget.statusLabel.setText("{} {} --- {} ".format(self.freeSpaceString,
                                                                       get_free_space(self.config.videodir),
                                                                       self.readyString))
            else:
                toggle_gui(False)
                self.mainWidget.standbyPushButton.setChecked(False)
        else:
            toggle_gui(False)
            self.mainWidget.standbyPushButton.setChecked(False)

        self.mainWidget.playPushButton.setVisible(False)
        self.mainWidget.playPushButton.setEnabled(False)
Exemplo n.º 3
0
    def record(self, state):
        """The logic for recording and stopping recording."""

        if state:  # Start Recording.
            logo_rec = QtGui.QPixmap(":/freeseer/logo_rec.png")
            sysIcon2 = QtGui.QIcon(logo_rec)
            self.systray.setIcon(sysIcon2)
            self.controller.record()
            self.mainWidget.recordPushButton.setText(self.stopString)
            self.recordAction.setText(self.stopString)

            # Hide if auto-hide is set.
            if self.config.auto_hide:
                self.hide_window()
                self.visibilityAction.setText(self.showWindowString)
                log.debug(
                    'auto-hide is enabled, main window is now hidden in systray.'
                )

            # Start timer.
            self.timer.start(1000)

        else:  # Stop Recording.
            logo_rec = QtGui.QPixmap(":/freeseer/logo.png")
            sysIcon = QtGui.QIcon(logo_rec)
            self.systray.setIcon(sysIcon)
            self.controller.stop()
            self.mainWidget.pauseToolButton.setChecked(False)
            self.mainWidget.recordPushButton.setText(self.recordString)
            self.recordAction.setText(self.recordString)
            self.mainWidget.audioSlider.setValue(0)
            self.mainWidget.statusLabel.setText(u"{} {} --- {} ".format(
                self.freeSpaceString, get_free_space(self.config.videodir),
                self.idleString))

            # Finally set the standby button back to unchecked position.
            self.standby(False)

            # Stop and reset timer.
            self.timer.stop()
            self.reset_timer()

            #Show playback button
            self.mainWidget.playPushButton.setVisible(True)
            self.mainWidget.playPushButton.setEnabled(True)

            # Select next talk if there is one within 15 minutes.
            if self.current_event and self.current_room:
                starttime = QtCore.QDateTime().currentDateTime()
                stoptime = starttime.addSecs(900)
                talkid = self.db.get_talk_between_time(self.current_event,
                                                       self.current_room,
                                                       starttime.toString(),
                                                       stoptime.toString())

                if talkid is not None:
                    for i in range(self.mainWidget.talkComboBox.count()):
                        if talkid == self.mainWidget.talkComboBox.model(
                        ).index(i, 1).data(QtCore.Qt.DisplayRole).toString():
                            self.mainWidget.talkComboBox.setCurrentIndex(i)
Exemplo n.º 4
0
    def record(self):
        """The logic for recording and stopping recording."""

        if self.mainWidget.is_recording:  # Start Recording.
            logo_rec = QtGui.QPixmap(":/freeseer/logo_rec.png")
            sysIcon2 = QtGui.QIcon(logo_rec)
            self.systray.setIcon(sysIcon2)
            self.controller.record()
            self.mainWidget.recordButton.setToolTip(self.stopString)
            self.mainWidget.disengageButton.setEnabled(False)
            self.mainWidget.pauseButton.setEnabled(True)
            self.recordAction.setText(self.stopString)

            # Hide if auto-hide is set.
            if self.config.auto_hide:
                self.hide_window()
                self.visibilityAction.setText(self.showWindowString)
                log.debug('auto-hide is enabled, main window is now hidden in systray.')

            # Start timer.
            self.timer.start(1000)

        else:  # Stop Recording.
            logo_rec = QtGui.QPixmap(":/freeseer/logo.png")
            sysIcon = QtGui.QIcon(logo_rec)
            self.systray.setIcon(sysIcon)
            self.controller.stop()
            self.mainWidget.pauseButton.setChecked(False)
            self.mainWidget.recordButton.setToolTip(self.recordString)
            self.mainWidget.disengageButton.setEnabled(True)
            self.mainWidget.pauseButton.setEnabled(False)
            self.recordAction.setText(self.recordString)
            self.mainWidget.audioSlider.setValue(0)
            self.mainWidget.statusLabel.setText(u"{} {} --- {} ".format(self.freeSpaceString,
                                                                        get_free_space(self.config.videodir),
                                                                        self.idleString))

            # Finally set the standby button back to unchecked position.
            self.standby(False)

            # Stop and reset timer.
            self.timer.stop()
            self.reset_timer()

            #Show playback button
            self.mainWidget.playButton.setVisible(True)
            self.mainWidget.playButton.setEnabled(True)

            # Select next talk if there is one within 15 minutes.
            if self.current_event and self.current_room:
                starttime = QtCore.QDateTime().currentDateTime()
                stoptime = starttime.addSecs(900)
                talkid = self.db.get_talk_between_time(self.current_event, self.current_room,
                                                       starttime.toString(), stoptime.toString())

                if talkid is not None:
                    for i in range(self.mainWidget.talkComboBox.count()):
                        if talkid == self.mainWidget.talkComboBox.model().index(i, 1).data(QtCore.Qt.DisplayRole).toString():
                            self.mainWidget.talkComboBox.setCurrentIndex(i)
Exemplo n.º 5
0
 def update_timer(self):
     """Updates the Elapsed Time displayed.
     
     Uses the statusLabel for the display.
     """
     time = "%d:%02d" % (self.time_minutes, self.time_seconds)
     self.time_seconds += 1
     if self.time_seconds == 60:
         self.time_seconds = 0
         self.time_minutes += 1
         
     self.mainWidget.statusLabel.setText("Free Space: %s --- Elapsed Time: %s" % 
                     (get_free_space(self.config.videodir), time))
Exemplo n.º 6
0
    def update_timer(self):
        """Updates the Elapsed Time displayed.

        Uses the statusLabel for the display.
        """
        time = "%d:%02d" % (self.time_minutes, self.time_seconds)
        self.time_seconds += 1
        if self.time_seconds == 60:
            self.time_seconds = 0
            self.time_minutes += 1

        self.mainWidget.statusLabel.setText("Free Space: %s --- Elapsed Time: %s" %
                        (get_free_space(self.config.videodir), time))
Exemplo n.º 7
0
    def update_timer(self):
        """Updates the Elapsed Time displayed.

        Uses the statusLabel for the display.
        """
        frmt_time = "%d:%02d" % (self.time_minutes, self.time_seconds)
        self.time_seconds += 1
        if self.time_seconds == 60:
            self.time_seconds = 0
            self.time_minutes += 1

        self.mainWidget.statusLabel.setText(u"{} {} --- {} {} --- {}".format(
            self.elapsedTimeString, frmt_time, self.freeSpaceString,
            get_free_space(self.config.videodir), self.recordingString))
Exemplo n.º 8
0
    def update_timer(self):
        """Updates the Elapsed Time displayed.

        Uses the statusLabel for the display.
        """
        frmt_time = "%d:%02d" % (self.time_minutes, self.time_seconds)
        self.time_seconds += 1
        if self.time_seconds == 60:
            self.time_seconds = 0
            self.time_minutes += 1

        self.mainWidget.statusLabel.setText(u"{} {} --- {} {} --- {}".format(self.elapsedTimeString,
                                                                             frmt_time,
                                                                             self.freeSpaceString,
                                                                             get_free_space(self.config.videodir),
                                                                             self.recordingString))
Exemplo n.º 9
0
    def retranslate(self):
        self.setWindowTitle(
            self.app.translate(
                "RecordApp",
                "Freeseer - portable presentation recording station"))
        #
        # Reusable Strings
        #
        self.standbyString = self.app.translate("RecordApp", "Standby")
        self.disengageString = self.app.translate("RecordApp",
                                                  "Leave record-mode")
        self.standbyTooltipString = self.app.translate(
            "RecordApp", "Sets up the system for recording")
        self.disengageTooltipString = self.app.translate(
            "RecordApp",
            "Go back to edit talk information or select a different talk")
        self.autoRecordString = self.app.translate("RecordApp", "Auto Record")
        self.recordString = self.app.translate("RecordApp", "Record")
        self.pauseString = self.app.translate("RecordApp", "Pause")
        self.resumeString = self.app.translate("RecordApp", "Resume")
        self.stopString = self.app.translate("RecordApp", "Stop")
        self.stopAutoString = self.app.translate("RecordApp",
                                                 "Stop Auto Record")
        self.hideWindowString = self.app.translate("RecordApp",
                                                   "Hide Main Window")
        self.showWindowString = self.app.translate("RecordApp",
                                                   "Show Main Window")
        self.playVideoString = self.app.translate("RecordApp", "Play")

        # Status Bar messages
        self.idleString = self.app.translate("RecordApp", "Idle.")
        self.readyString = self.app.translate("RecordApp", "Ready.")
        self.recordingString = self.app.translate("RecordApp", "Recording")
        self.pausedString = self.app.translate("RecordApp",
                                               "Recording Paused.")
        self.freeSpaceString = self.app.translate("RecordApp", "Free Space:")
        self.elapsedTimeString = self.app.translate("RecordApp",
                                                    "Elapsed Time:")
        # --- End Reusable Strings

        if self.mainWidget.is_recording and self.mainWidget.pauseButton.isChecked(
        ):
            self.mainWidget.statusLabel.setText(self.pausedString)
        elif self.mainWidget.is_recording and (
                not self.mainWidget.pauseButton.isChecked()):
            self.mainWidget.statusLabel.setText(self.recordingString)
        elif self.mainWidget.standbyButton.isChecked():
            self.mainWidget.statusLabel.setText(self.readyString)
        elif self.actionAutoRecord.isChecked():
            self.mainWidget.statusLabel.setText(self.autoRecordString)
        else:
            self.mainWidget.statusLabel.setText(u"{} {} --- {} ".format(
                self.freeSpaceString, get_free_space(self.config.videodir),
                self.idleString))

        #
        # Menubar
        #
        self.menuOptions.setTitle(self.app.translate("RecordApp", "&Options"))
        self.actionConfigTool.setText(
            self.app.translate("RecordApp", "&Configuration"))
        self.actionTalkEditor.setText(
            self.app.translate("RecordApp", "&Edit Talks"))
        self.actionAutoRecord.setText(self.autoRecordString)
        self.actionOpenVideoFolder.setText(
            self.app.translate("RecordApp", "&Open Video Directory"))
        self.actionReport.setText(self.app.translate("RecordApp", "&Report"))
        # --- End Menubar

        #
        # Systray
        #
        self.visibilityAction.setText(self.hideWindowString)
        self.recordAction.setText(self.recordString)
        # --- End Systray

        #
        # RecordingWidget
        #
        self.mainWidget.disengageButton.setText(self.disengageString)
        self.mainWidget.standbyButton.setText(self.standbyString)
        self.mainWidget.standbyButton.setToolTip(self.standbyTooltipString)
        self.mainWidget.disengageButton.setToolTip(self.disengageTooltipString)
        if self.mainWidget.is_recording:
            self.mainWidget.recordButton.setToolTip(self.stopString)
        else:
            self.mainWidget.recordButton.setToolTip(self.recordString)
        self.mainWidget.pauseButton.setText(self.pauseString)
        self.mainWidget.pauseButton.setToolTip(self.pauseString)
        self.mainWidget.eventLabel.setText(
            self.app.translate("RecordApp", "Event"))
        self.mainWidget.roomLabel.setText(
            self.app.translate("RecordApp", "Room"))
        self.mainWidget.dateLabel.setText(
            self.app.translate("RecordApp", "Date"))
        self.mainWidget.talkLabel.setText(
            self.app.translate("RecordApp", "Talk"))
        # --- End RecordingWidget

        #
        # ReportWidget
        #
        self.reportWidget.setWindowTitle(
            self.app.translate("RecordApp", "Reporting Tool"))
        self.reportWidget.titleLabel.setText(
            self.app.translate("RecordApp", "Title:"))
        self.reportWidget.speakerLabel.setText(
            self.app.translate("RecordApp", "Speaker:"))
        self.reportWidget.eventLabel.setText(
            self.app.translate("RecordApp", "Event:"))
        self.reportWidget.roomLabel.setText(
            self.app.translate("RecordApp", "Room:"))
        self.reportWidget.startTimeLabel.setText(
            self.app.translate("RecordApp", "Start Time:"))
        self.reportWidget.endTimeLabel.setText(
            self.app.translate("RecordApp", "End Time:"))
        self.reportWidget.commentLabel.setText(
            self.app.translate("RecordApp", "Comment"))
        self.reportWidget.releaseCheckBox.setText(
            self.app.translate("RecordApp", "Release Received"))
        self.reportWidget.closeButton.setText(
            self.app.translate("RecordApp", "Close"))
        self.reportWidget.reportButton.setText(
            self.app.translate("RecordApp", "Report"))

        # Logic for translating the report options
        noissues = self.app.translate("RecordApp", "No Issues")
        noaudio = self.app.translate("RecordApp", "No Audio")
        novideo = self.app.translate("RecordApp", "No Video")
        noaudiovideo = self.app.translate("RecordApp", "No Audio/Video")
        self.reportWidget.options = [noissues, noaudio, novideo, noaudiovideo]
        self.reportWidget.reportCombo.clear()
        for i in self.reportWidget.options:
            self.reportWidget.reportCombo.addItem(i)
Exemplo n.º 10
0
    def retranslate(self):
        self.setWindowTitle(self.app.translate("RecordApp", "Freeseer - portable presentation recording station"))
        #
        # Reusable Strings
        #
        self.standbyString = self.app.translate("RecordApp", "Standby")
        self.disengageString = self.app.translate("RecordApp", "Leave record-mode")
        self.standbyTooltipString = self.app.translate("RecordApp", "Sets up the system for recording")
        self.disengageTooltipString = self.app.translate("RecordApp", "Go back to edit talk information or select a different talk")
        self.autoRecordString = self.app.translate("RecordApp", "Auto Record")
        self.recordString = self.app.translate("RecordApp", "Record")
        self.pauseString = self.app.translate("RecordApp", "Pause")
        self.resumeString = self.app.translate("RecordApp", "Resume")
        self.stopString = self.app.translate("RecordApp", "Stop")
        self.stopAutoString = self.app.translate("RecordApp", "Stop Auto Record")
        self.hideWindowString = self.app.translate("RecordApp", "Hide Main Window")
        self.showWindowString = self.app.translate("RecordApp", "Show Main Window")
        self.playVideoString = self.app.translate("RecordApp", "Play")

        # Status Bar messages
        self.idleString = self.app.translate("RecordApp", "Idle.")
        self.readyString = self.app.translate("RecordApp", "Ready.")
        self.recordingString = self.app.translate("RecordApp", "Recording")
        self.pausedString = self.app.translate("RecordApp", "Recording Paused.")
        self.freeSpaceString = self.app.translate("RecordApp", "Free Space:")
        self.elapsedTimeString = self.app.translate("RecordApp", "Elapsed Time:")
        # --- End Reusable Strings

        if self.mainWidget.is_recording and self.mainWidget.pauseButton.isChecked():
            self.mainWidget.statusLabel.setText(self.pausedString)
        elif self.mainWidget.is_recording and (not self.mainWidget.pauseButton.isChecked()):
            self.mainWidget.statusLabel.setText(self.recordingString)
        elif self.mainWidget.standbyButton.isChecked():
            self.mainWidget.statusLabel.setText(self.readyString)
        elif self.actionAutoRecord.isChecked():
            self.mainWidget.statusLabel.setText(self.autoRecordString)
        else:
            self.mainWidget.statusLabel.setText(u"{} {} --- {} ".format(self.freeSpaceString,
                                                                        get_free_space(self.config.videodir),
                                                                        self.idleString))

        #
        # Menubar
        #
        self.menuOptions.setTitle(self.app.translate("RecordApp", "&Options"))
        self.actionConfigTool.setText(self.app.translate("RecordApp", "&Configuration"))
        self.actionTalkEditor.setText(self.app.translate("RecordApp", "&Edit Talks"))
        self.actionAutoRecord.setText(self.autoRecordString)
        self.actionOpenVideoFolder.setText(self.app.translate("RecordApp", "&Open Video Directory"))
        self.actionReport.setText(self.app.translate("RecordApp", "&Report"))
        # --- End Menubar

        #
        # Systray
        #
        self.visibilityAction.setText(self.hideWindowString)
        self.recordAction.setText(self.recordString)
        # --- End Systray

        #
        # RecordingWidget
        #
        self.mainWidget.disengageButton.setText(self.disengageString)
        self.mainWidget.standbyButton.setText(self.standbyString)
        self.mainWidget.standbyButton.setToolTip(self.standbyTooltipString)
        self.mainWidget.disengageButton.setToolTip(self.disengageTooltipString)
        if self.mainWidget.is_recording:
            self.mainWidget.recordButton.setToolTip(self.stopString)
        else:
            self.mainWidget.recordButton.setToolTip(self.recordString)
        self.mainWidget.pauseButton.setText(self.pauseString)
        self.mainWidget.pauseButton.setToolTip(self.pauseString)
        self.mainWidget.eventLabel.setText(self.app.translate("RecordApp", "Event"))
        self.mainWidget.roomLabel.setText(self.app.translate("RecordApp", "Room"))
        self.mainWidget.dateLabel.setText(self.app.translate("RecordApp", "Date"))
        self.mainWidget.talkLabel.setText(self.app.translate("RecordApp", "Talk"))
        # --- End RecordingWidget

        #
        # ReportWidget
        #
        self.reportWidget.setWindowTitle(self.app.translate("RecordApp", "Reporting Tool"))
        self.reportWidget.titleLabel.setText(self.app.translate("RecordApp", "Title:"))
        self.reportWidget.speakerLabel.setText(self.app.translate("RecordApp", "Speaker:"))
        self.reportWidget.eventLabel.setText(self.app.translate("RecordApp", "Event:"))
        self.reportWidget.roomLabel.setText(self.app.translate("RecordApp", "Room:"))
        self.reportWidget.startTimeLabel.setText(self.app.translate("RecordApp", "Start Time:"))
        self.reportWidget.endTimeLabel.setText(self.app.translate("RecordApp", "End Time:"))
        self.reportWidget.commentLabel.setText(self.app.translate("RecordApp", "Comment"))
        self.reportWidget.releaseCheckBox.setText(self.app.translate("RecordApp", "Release Received"))
        self.reportWidget.closeButton.setText(self.app.translate("RecordApp", "Close"))
        self.reportWidget.reportButton.setText(self.app.translate("RecordApp", "Report"))

        # Logic for translating the report options
        noissues = self.app.translate("RecordApp", "No Issues")
        noaudio = self.app.translate("RecordApp", "No Audio")
        novideo = self.app.translate("RecordApp", "No Video")
        noaudiovideo = self.app.translate("RecordApp", "No Audio/Video")
        self.reportWidget.options = [noissues, noaudio, novideo, noaudiovideo]
        self.reportWidget.reportCombo.clear()
        for i in self.reportWidget.options:
            self.reportWidget.reportCombo.addItem(i)
        # --- End ReportWidget

        self.logStatusWidget.retranslate()