Beispiel #1
0
    def cb_record_mode_toggled(self, widget):
        noSelection = False
        if widget.get_active():
            self.current_mode = widget
            if self.noSelectNextModeActive == True:
                self.noSelectNextModeActive = False
                noSelection = True
        else:
            self.last_mode = widget

        if widget.get_name() == "MODE_AREA" and widget.get_active():
            logger.debug("Area ON.")
            if noSelection != True:
                self.area_window = AreaWindow()
                self.tmp_sig1 = self.area_window.connect(
                    "area-selected", self.cb_area_selected)
                self.tmp_sig2 = self.area_window.connect(
                    "area-canceled", self.cb_area_canceled)
            self.record_mode = MODE_AREA

        if widget.get_name() == "MODE_AREA" and not widget.get_active():
            logger.debug("Area OFF.")
            if self.area_window:
                self.area_window.disconnect(self.tmp_sig1)
                self.area_window.disconnect(self.tmp_sig2)
                self.area_window.window.destroy()
                self.area_window = None

        if widget.get_name() == "MODE_FULL" and widget.get_active():
            logger.debug("Capture full screen.")
            self.record_mode = MODE_FULL

        if widget.get_name() == "MODE_ALL" and widget.get_active():
            logger.debug("Capture all screens.")
            self.record_mode = MODE_ALL

        if widget.get_name() == "MODE_WIN" and widget.get_active():
            logger.debug("Window capture ON.")
            if noSelection != True:
                self.select_window = SelectWindow()
                self.tmp_sig3 = self.select_window.connect(
                    "window-selected", self.cb_window_selected)
                self.tmp_sig4 = self.select_window.connect(
                    "window-canceled", self.cb_window_canceled)
                self.chk_borders_pic.set_sensitive(True)
            self.record_mode = MODE_WIN

        if widget.get_name() == "MODE_WIN" and not widget.get_active():
            logger.debug("Window capture OFF.")
            self.chk_borders_pic.set_sensitive(False)
            if self.select_window:
                self.select_window.disconnect(self.tmp_sig3)
                self.select_window.disconnect(self.tmp_sig4)
                self.select_window.window.destroy()
                self.select_window = None
Beispiel #2
0
    def __init__(self, datadir, dist, debug, mode, preferences=False):
        GObject.GObject.__init__(self)
        logger.debug("Setting variables.{0}".format(datadir))

        self.mode = mode
        self.take = 0

        prefs.datadir = datadir
        prefs.debug = debug
        prefs.dist = dist
        prefs.get_sound_files()

        if preferences:
            logger.debug("Preferences requested.")
            from kazam.frontend.preferences import Preferences
            from kazam.pulseaudio.pulseaudio import pulseaudio_q
            prefs.pa_q = pulseaudio_q()
            prefs.pa_q.start()
            prefs.get_audio_sources()

            self.preferences_window = Preferences()
            self.preferences_window.connect("prefs-quit", self.cb_prefs_quit)
            self.preferences_window.open()

        else:
            self.old_path = None

            if HW.combined_screen:
                self.video_source = HW.combined_screen
            else:
                screen = HW.get_current_screen()
                self.video_source = HW.screens[screen]

            self.grabber = Grabber()
            self.grabber.connect("flush-done", self.cb_flush_done)
            self.grabber.connect("save-done", self.cb_save_done)

            if self.mode == MODE_AREA:
                logger.debug("Area ON.")
                from kazam.frontend.window_area import AreaWindow
                self.area_window = AreaWindow()
                self.area_window.connect("area-selected",
                                         self.cb_area_selected)
                self.area_window.connect("area-canceled",
                                         self.cb_area_canceled)
                self.area_window.window.show_all()
            elif self.mode == MODE_ALL:
                self.grabber.setup_sources(self.video_source, None, None)
                logger.debug("Grabbing screen")
                self.grabber.grab()
            elif self.mode == MODE_ACTIVE:
                self.grabber.setup_sources(self.video_source,
                                           None,
                                           None,
                                           active=True)
                logger.debug("Grabbing screen")
                self.grabber.grab()
            elif self.mode == MODE_WIN:
                logger.debug("Window Selection ON.")
                from kazam.frontend.window_select import SelectWindow
                self.select_window = SelectWindow()
                self.select_window.connect("window-selected",
                                           self.cb_window_selected)
                self.select_window.connect("window-canceled",
                                           self.cb_window_canceled)
                self.select_window.window.show_all()
            elif self.mode == MODE_GOD:
                logger.debug("Grabbing in god mode.")
                self.grabber.setup_sources(self.video_source,
                                           None,
                                           None,
                                           god=True)
                self.grabber.grab()
                self.grabber.setup_sources(self.video_source,
                                           None,
                                           None,
                                           active=True,
                                           god=True)
                self.grabber.grab()
            else:
                sys.exit(0)