Beispiel #1
0
    def __init__(self):
        FreeseerApp.__init__(self)

        self.controller = RecordingController()
        self.config = self.controller.config
        self.db = self.controller.db

        self.resize(550, 450)

        # Setup custom widgets
        self.mainWidget = RecordingWidget()
        self.setCentralWidget(self.mainWidget)
        self.reportWidget = ReportDialog()
        self.reportWidget.setModal(True)
        self.clientWidget = ClientDialog(self.config.configdir, self.db)
        self.configToolApp = ConfigToolApp(self)
        self.configToolApp.setWindowModality(QtCore.Qt.ApplicationModal)
        self.configToolApp.setWindowFlags(QtCore.Qt.Dialog)
        self.talkEditorApp = TalkEditorApp(self)
        self.talkEditorApp.setWindowModality(QtCore.Qt.ApplicationModal)
        self.talkEditorApp.setWindowFlags(QtCore.Qt.Dialog)

        self.statusBar().addPermanentWidget(self.mainWidget.statusLabel)

        # Initialize geometry, to be used for restoring window positioning.
        self.geometry = None
        self.current_event = None
        self.current_room = None
        self.controller.set_window_id(self.mainWidget.previewWidget.winId())
        self.controller.set_audio_feedback_handler(self.audio_feedback)

        # Set timer for recording how much time elapsed during a recording
        self.reset_timer()
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.update_timer)

        #
        # Setup Menubar
        #

        # Build the options Menu, TalkEditor and ConfigTool
        self.menuOptions = QtGui.QMenu(self.menubar)
        self.menuOptions.setObjectName(_fromUtf8("menuOptions"))
        self.menubar.insertMenu(self.menuHelp.menuAction(), self.menuOptions)
        self.actionConfigTool = QtGui.QAction(self)
        self.actionConfigTool.setShortcut("Ctrl+C")
        self.actionConfigTool.setObjectName(_fromUtf8("actionConfigTool"))
        self.actionTalkEditor = QtGui.QAction(self)
        self.actionTalkEditor.setShortcut("Ctrl+E")
        self.actionTalkEditor.setObjectName(_fromUtf8("actionTalkEditor"))
        self.menuOptions.addAction(self.actionConfigTool)
        self.menuOptions.addAction(self.actionTalkEditor)

        folderIcon = QtGui.QIcon.fromTheme("folder")
        self.actionOpenVideoFolder = QtGui.QAction(self)
        self.actionOpenVideoFolder.setShortcut("Ctrl+O")
        self.actionOpenVideoFolder.setObjectName(_fromUtf8("actionOpenVideoFolder"))
        self.actionOpenVideoFolder.setIcon(folderIcon)

        self.actionReport = QtGui.QAction(self)
        self.actionReport.setObjectName(_fromUtf8("actionReport"))

        self.actionClient = QtGui.QAction(self)
        self.actionClient.setIcon(self.icon)
        # Actions
        self.menuFile.insertAction(self.actionExit, self.actionOpenVideoFolder)
        # Hide the controller client configuration screen for Freeseer 3.0.0
        # release. This feature's not ready for public use so lets keep it
        # hidden for now.
        #self.menuFile.insertAction(self.actionExit, self.actionClient)
        self.menuHelp.addAction(self.actionReport)
        # --- End Menubar

        #
        # Systray Setup
        #
        self.systray = QtGui.QSystemTrayIcon(self.icon)
        self.systray.show()
        self.systray.menu = QtGui.QMenu()
        self.systray.setContextMenu(self.systray.menu)

        self.visibilityAction = QtGui.QAction(self)
        self.recordAction = QtGui.QAction(self)

        self.systray.menu.addAction(self.visibilityAction)
        self.systray.menu.addAction(self.recordAction)

        self.connect(self.visibilityAction, QtCore.SIGNAL('triggered()'), self.toggle_window_visibility)
        self.connect(self.recordAction, QtCore.SIGNAL('triggered()'), self.toggle_record_button)
        self.connect(self.systray, QtCore.SIGNAL('activated(QSystemTrayIcon::ActivationReason)'), self._icon_activated)
        # --- End Systray Setup

        # main tab connections
        self.connect(self.mainWidget.eventComboBox, QtCore.SIGNAL('currentIndexChanged(const QString&)'), self.load_rooms_from_event)
        self.connect(self.mainWidget.roomComboBox, QtCore.SIGNAL('currentIndexChanged(const QString&)'), self.load_dates_from_event_room)
        self.connect(self.mainWidget.dateComboBox, QtCore.SIGNAL('currentIndexChanged(const QString&)'), self.load_talks_from_date)
        self.connect(self.mainWidget.talkComboBox, QtCore.SIGNAL('currentIndexChanged(const QString&)'), self.set_talk_tooltip)
        self.connect(self.mainWidget.standbyPushButton, QtCore.SIGNAL("toggled(bool)"), self.standby)
        self.connect(self.mainWidget.recordPushButton, QtCore.SIGNAL('toggled(bool)'), self.record)
        self.connect(self.mainWidget.pauseToolButton, QtCore.SIGNAL('toggled(bool)'), self.pause)
        self.connect(self.mainWidget.audioFeedbackCheckbox, QtCore.SIGNAL('toggled(bool)'), self.toggle_audio_feedback)

        # Main Window Connections
        self.connect(self.actionConfigTool, QtCore.SIGNAL('triggered()'), self.open_configtool)
        self.connect(self.actionTalkEditor, QtCore.SIGNAL('triggered()'), self.open_talkeditor)
        self.connect(self.actionOpenVideoFolder, QtCore.SIGNAL('triggered()'), self.open_video_directory)
        self.connect(self.actionReport, QtCore.SIGNAL('triggered()'), self.show_report_widget)
        self.connect(self.actionClient, QtCore.SIGNAL('triggered()'), self.show_client_widget)

        # GUI Disabling/Enabling Connections
        self.connect(self.mainWidget.recordPushButton, QtCore.SIGNAL("toggled(bool)"), self.mainWidget.pauseToolButton.setEnabled)

        #Client Connections
        self.connect(self.clientWidget.socket, QtCore.SIGNAL('readyRead()'), self.getAction)

        #
        # ReportWidget Connections
        #
        self.connect(self.reportWidget.reportButton, QtCore.SIGNAL("clicked()"), self.report)

        self.load_settings()

        # Setup spacebar key.
        self.mainWidget.recordPushButton.setShortcut(QtCore.Qt.Key_Space)
        self.mainWidget.recordPushButton.setFocus()

        self.retranslate()
Beispiel #2
0
    def __init__(self, profile, config):
        FreeseerApp.__init__(self)

        self.db = profile.get_database()
        self.config = config
        self.controller = RecordingController(profile, self.db, self.config)

        self.recently_recorded_video = None

        self.resize(550, 450)

        # Setup custom widgets
        self.mainWidget = RecordingWidget()
        self.setCentralWidget(self.mainWidget)
        self.reportWidget = ReportDialog()
        self.reportWidget.setModal(True)
        self.autoRecordWidget = AutoRecordWidget()
        self.configToolApp = ConfigToolApp(profile, config)
        self.configToolApp.setWindowModality(QtCore.Qt.ApplicationModal)
        self.configToolApp.setWindowFlags(QtCore.Qt.Dialog)
        self.talkEditorApp = TalkEditorApp(self.config, self.db)
        self.talkEditorApp.setWindowModality(QtCore.Qt.ApplicationModal)
        self.talkEditorApp.setWindowFlags(QtCore.Qt.Dialog)

        self.statusBar().addPermanentWidget(self.mainWidget.statusLabel)

        # Initialize geometry, to be used for restoring window positioning.
        self.geometry = None
        self.current_event = None
        self.current_room = None
        self.controller.set_window_id(self.mainWidget.previewWidget.winId())
        self.controller.set_audio_feedback_handler(self.audio_feedback)

        # Set timer for recording how much time elapsed during a recording
        self.reset_timer()
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.update_timer)

        # Initialize variables for auto-recording
        self.singleID = None
        self.timeUntilStart = None
        self.timeUntilEnd = None
        self.autoTalks = None
        self.recorded = False
        self.beforeStartTimer = QtCore.QTimer(self)
        self.beforeStartTimer.timeout.connect(self.start_single_record)
        self.beforeEndTimer = QtCore.QTimer(self)
        self.beforeEndTimer.timeout.connect(self.single_auto_record)

        #
        # Setup Menubar
        #

        # Build the options Menu, TalkEditor and ConfigTool
        self.menuOptions = QtGui.QMenu(self.menubar)
        self.menuOptions.setObjectName(_fromUtf8("menuOptions"))
        self.menubar.insertMenu(self.menuHelp.menuAction(), self.menuOptions)
        self.actionConfigTool = QtGui.QAction(self)
        self.actionConfigTool.setShortcut("Ctrl+C")
        self.actionConfigTool.setObjectName(_fromUtf8("actionConfigTool"))
        self.actionTalkEditor = QtGui.QAction(self)
        self.actionTalkEditor.setShortcut("Ctrl+E")
        self.actionTalkEditor.setObjectName(_fromUtf8("actionTalkEditor"))
        self.actionAutoRecord = QtGui.QAction(self)
        leaveButtonShortcut = "Ctrl+R"
        self.actionAutoRecord.setShortcut(leaveButtonShortcut)
        self.actionAutoRecord.setCheckable(True)
        self.actionAutoRecord.setObjectName(_fromUtf8("actionAutoRecord"))
        self.menuOptions.addAction(self.actionConfigTool)
        self.menuOptions.addAction(self.actionTalkEditor)
        self.menuOptions.addAction(self.actionAutoRecord)

        folderIcon = QtGui.QIcon.fromTheme("folder")
        self.actionOpenVideoFolder = QtGui.QAction(self)
        self.actionOpenVideoFolder.setShortcut("Ctrl+O")
        self.actionOpenVideoFolder.setObjectName(
            _fromUtf8("actionOpenVideoFolder"))
        self.actionOpenVideoFolder.setIcon(folderIcon)

        self.actionReport = QtGui.QAction(self)
        self.actionReport.setObjectName(_fromUtf8("actionReport"))

        # Actions
        self.menuFile.insertAction(self.actionExit, self.actionOpenVideoFolder)
        self.menuHelp.addAction(self.actionReport)
        # --- End Menubar

        #
        # Systray Setup
        #
        self.systray = QtGui.QSystemTrayIcon(self.icon)
        self.systray.show()
        self.systray.menu = QtGui.QMenu()
        self.systray.setContextMenu(self.systray.menu)

        self.visibilityAction = QtGui.QAction(self)
        self.recordAction = QtGui.QAction(self)

        self.systray.menu.addAction(self.visibilityAction)
        self.systray.menu.addAction(self.recordAction)

        self.connect(self.visibilityAction, QtCore.SIGNAL('triggered()'),
                     self.toggle_window_visibility)
        self.connect(self.recordAction, QtCore.SIGNAL('triggered()'),
                     self.toggle_record_button)
        self.connect(
            self.systray,
            QtCore.SIGNAL('activated(QSystemTrayIcon::ActivationReason)'),
            self._icon_activated)
        # --- End Systray Setup

        # main tab connections
        self.connect(self.mainWidget.eventComboBox,
                     QtCore.SIGNAL('currentIndexChanged(const QString&)'),
                     self.load_rooms_from_event)
        self.connect(self.mainWidget.roomComboBox,
                     QtCore.SIGNAL('currentIndexChanged(const QString&)'),
                     self.load_dates_from_event_room)
        self.connect(self.mainWidget.dateComboBox,
                     QtCore.SIGNAL('currentIndexChanged(const QString&)'),
                     self.load_talks_from_date)
        self.connect(self.mainWidget.talkComboBox,
                     QtCore.SIGNAL('currentIndexChanged(const QString&)'),
                     self.set_talk_tooltip)
        self.connect(self.mainWidget.standbyButton,
                     QtCore.SIGNAL("toggled(bool)"), self.standby)
        self.connect(self.mainWidget.disengageButton,
                     QtCore.SIGNAL("clicked()"),
                     functools.partial(self.standby, state=False))
        self.connect(self.mainWidget.recordButton, QtCore.SIGNAL('clicked()'),
                     self.record)
        self.connect(self.mainWidget.pauseButton,
                     QtCore.SIGNAL('toggled(bool)'), self.pause)
        self.connect(self.mainWidget.audioFeedbackCheckbox,
                     QtCore.SIGNAL('toggled(bool)'),
                     self.toggle_audio_feedback)
        self.connect(self.mainWidget.playButton, QtCore.SIGNAL('clicked()'),
                     self.play_video)

        self.connect(self.autoRecordWidget.leaveButton,
                     QtCore.SIGNAL('clicked()'),
                     functools.partial(self.auto_record, state=False))
        self.autoRecordWidget.leaveButton.setShortcut(leaveButtonShortcut)

        # Main Window Connections
        self.connect(self.actionConfigTool, QtCore.SIGNAL('triggered()'),
                     self.open_configtool)
        self.connect(self.actionTalkEditor, QtCore.SIGNAL('triggered()'),
                     self.open_talkeditor)
        self.connect(self.actionAutoRecord, QtCore.SIGNAL('toggled(bool)'),
                     self.auto_record)
        self.connect(self.actionOpenVideoFolder, QtCore.SIGNAL('triggered()'),
                     self.open_video_directory)
        self.connect(self.actionReport, QtCore.SIGNAL('triggered()'),
                     self.show_report_widget)

        #
        # ReportWidget Connections
        #
        self.connect(self.reportWidget.reportButton,
                     QtCore.SIGNAL("clicked()"), self.report)

        self.load_settings()

        # Setup spacebar key.
        self.mainWidget.pauseButton.setShortcut(QtCore.Qt.Key_Space)
        self.mainWidget.pauseButton.setFocus()

        self.retranslate()
Beispiel #3
0
def parse_args(parser, parse_args=None):
    if len(sys.argv) == 1:  # No arguments passed
        launch_recordapp()

    args = parser.parse_args(parse_args)

    if args.app == 'record':
        if len(sys.argv) == 2:  # No 'record' arguments passed
            launch_recordapp()

        import gobject
        # Must declare after argparse otherwise GStreamer will take over the cli help
        from freeseer.frontend.record.RecordingController import RecordingController

        # TODO: Abstract the database stuff away from here as it's only
        #       used in conjunction with talks.
        if args.profile is None:  # Profile is an optional parameter
            args.profile = 'default'
        profile = settings.profile_manager.get(args.profile)
        config = profile.get_config('freeseer.conf',
                                    settings.FreeseerConfig,
                                    storage_args=['Global'],
                                    read_only=False)
        # XXX: There should only be 1 database per user. Workaround for this
        #      is to put it in the 'default' profile.
        db = settings.profile_manager.get().get_database()

        app = RecordingController(profile, db, config, cli=True)

        if args.talk:
            if app.record_talk_id(args.talk):
                sys.exit(gobject.MainLoop().run())
        elif args.filename:
            if app.record_filename(args.filename):
                sys.exit(gobject.MainLoop().run())
        elif args.show_talks:
            app.print_talks()

    elif args.app == 'config':
        if len(sys.argv) == 2:  # No 'config' arguments passed
            launch_configtool()

        from freeseer.settings import configdir
        from freeseer.framework.util import reset
        from freeseer.framework.util import reset_configuration
        from freeseer.framework.util import reset_database
        from freeseer.framework.youtube import YoutubeService

        if args.reset:
            reset(configdir)
        elif args.reset_configuration:
            reset_configuration(configdir)
        elif args.reset_database:
            reset_database(configdir)
        elif args.config_service == "youtube":
            YoutubeService.acquire_token(args.client_secrets, args.token, args)

    elif args.app == 'talk':
        if len(sys.argv) == 2:  # No 'talk' arguments passed
            launch_talkeditor()

        from freeseer.framework.presentation import Presentation

        profile = settings.profile_manager.get()
        db = profile.get_database()

        if args.action == "add":
            presentation = Presentation(args.title,
                                        speaker=args.speaker,
                                        room=args.room,
                                        event=args.event)
            db.insert_presentation(presentation)

        elif args.action == "remove":
            db.delete_presentation(args.talk_id)

        elif args.action == "clear":
            db.clear_database()

        else:
            print("Invalid option.")

    elif args.app == 'report':
        if len(sys.argv) == 2:  # No 'report' arguments passed
            launch_reporteditor()

    elif args.app == 'upload':
        if args.upload_service == 'youtube':
            youtube = YoutubeFrontend()
            youtube.upload(args.files, args.token, args.yes)