Logo Search packages:      
Sourcecode: scenic version File versions  Download package

def scenic::gui::Gui::_gather_configuration (   self ) [private]
Updates the configuration with the value of each widget.

Definition at line 810 of file gui.py.

                                   :
        """
        Updates the configuration with the value of each widget.
        """
        def _set_config(attribute_name, value):
            """
            Sets a configuration entry value and prints it.
            """
            if not hasattr(self.app.config, attribute_name):
                raise RuntimeError("Config has no attribute %s" % (attribute_name))
            cast = type(getattr(self.app.config, attribute_name))
            if type(value) is not cast:
                raise RuntimeError("Wrong type for attribute %s." % (attribute_name))
            setattr(self.app.config, attribute_name, value)
            log.debug(" * %s: %s" % (attribute_name, getattr(self.app.config, attribute_name)))

        log.debug("Gathering configuration from the GUI widgets.")
        # VIDEO:
        _set_config("video_send_enabled", self.video_send_enabled_widget.get_active())
        _set_config("video_recv_enabled", self.video_receive_enabled_widget.get_active())
        _set_config("video_capture_size", _get_combobox_value(self.video_capture_size_widget))
        _set_config("video_display", _get_combobox_value(self.video_display_widget))
        video_source = _get_combobox_value(self.video_source_widget)
        if video_source == "Color bars":
            _set_config("video_source", "videotestsrc")
        else:
            #video_device = self.app.parse_v4l2_device_name(video_source)
            #if video_device is None:
            #    print "Could not find video device %s" % (video_source)
            #elif video_source.startswith("/dev/video"): # TODO: firewire!
            #TODO: check if it is a v4l2 device.
            _set_config("video_source", "v4l2src")
            _set_config("video_device", video_source) # Using the name and id as a video_device
            _set_config("video_input", self.v4l2_input_widget.get_active())  # we need to save it, but the restoration of the widget value is done when we poll the cameras
            _set_config("video_standard", _get_combobox_value(self.v4l2_standard_widget)) # same as line above
        _set_config("video_codec", VIDEO_CODECS[_get_combobox_value(self.video_codec_widget)])
        _set_config("video_aspect_ratio", _get_combobox_value(self.aspect_ratio_widget))
        _set_config("video_fullscreen", self.video_fullscreen_widget.get_active())
        _set_config("video_deinterlace",  self.video_deinterlace_widget.get_active())
        _set_config("video_jitterbuffer", self.video_jitterbuffer_widget.get_value_as_int()) # spinbutton
        _set_config("video_bitrate", float(self.video_bitrate_widget.get_value())) # spinbutton (float)
        _set_config("preview_in_window", self.preview_in_window_widget.get_active())
        
        # AUDIO:
        _set_config("audio_send_enabled", self.audio_send_enabled_widget.get_active())
        _set_config("audio_recv_enabled", self.audio_receive_enabled_widget.get_active())
        _set_config("audio_video_synchronized", self.audio_video_synchronized_widget.get_active())
        _set_config("audio_source", AUDIO_SOURCES[_get_combobox_value(self.audio_source_widget)])
        _set_config("audio_codec", AUDIO_CODECS[_get_combobox_value(self.audio_codec_widget)])
        _set_config("audio_channels", self.audio_numchannels_widget.get_value_as_int()) # spinbutton
        _set_config("audio_input_buffer", self.audio_input_buffer_widget.get_value_as_int())
        _set_config("audio_output_buffer", self.audio_output_buffer_widget.get_value_as_int())
        _set_config("audio_jitterbuffer", self.audio_jitterbuffer_widget.get_value_as_int()) # spinbutton
        _set_config("audio_jack_enable_autoconnect", self.audio_jack_enable_autoconnect_widget.get_active())
        
        # MIDI:
        if not self.app.midi_is_supported():
            log.info("MIDI is not supported, since python-portmidi is not found.")
            _set_config("midi_send_enabled", False)
            _set_config("midi_recv_enabled", False)
        else:
            _set_config("midi_send_enabled", self.midi_send_enabled_widget.get_active())
            _set_config("midi_recv_enabled", self.midi_recv_enabled_widget.get_active())
            _set_config("midi_input_device", _get_combobox_value(self.midi_input_device_widget))
            _set_config("midi_output_device", _get_combobox_value(self.midi_output_device_widget))
            _set_config("midi_jitterbuffer", self.midi_jitterbuffer_widget.get_value_as_int())
        

Generated by  Doxygen 1.6.0   Back to index