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

def scenic::gui::Gui::update_widgets_with_saved_config (   self )
Called once at startup.
 * Once the config file is read, and the devices have been polled
 * Sets the value of each widget according to the data stored in the configuration file.
It could be called again, once another config file has been read.

Definition at line 877 of file gui.py.

                                              :
        """
        Called once at startup.
         * Once the config file is read, and the devices have been polled
         * Sets the value of each widget according to the data stored in the configuration file.
        It could be called again, once another config file has been read.
        """
        def _get_config(attribute_name):
            value = getattr(self.app.config, attribute_name)
            log.debug(" * %s: %s" % (attribute_name, value))
            return value

        self._widgets_changed_by_user = False
        log.debug("Changing widgets value according to configuration.")
        #print(self.app.config.__dict__)
        # VIDEO:
        self.video_send_enabled_widget.set_active(_get_config("video_send_enabled"))
        self.video_receive_enabled_widget.set_active(_get_config("video_recv_enabled"))
        _set_combobox_choices(self.video_capture_size_widget, ALL_SUPPORTED_SIZE)
        _set_combobox_value(self.video_capture_size_widget, _get_config("video_capture_size"))
        _set_combobox_value(self.video_display_widget, _get_config("video_display"))
        _set_combobox_value(self.aspect_ratio_widget, _get_config("video_aspect_ratio"))
        self.video_fullscreen_widget.set_active(_get_config("video_fullscreen"))
        self.video_deinterlace_widget.set_active(_get_config("video_deinterlace"))
        self.video_jitterbuffer_widget.set_value(_get_config("video_jitterbuffer")) # spinbutton
        self.video_bitrate_widget.set_value(_get_config("video_bitrate")) # spinbutton
        self.preview_in_window_widget.set_active(_get_config("preview_in_window"))
        # VIDEO SOURCE AND DEVICE:
        if self.app.config.video_source == "videotestsrc":
            video_source = "Color bars"
        elif self.app.config.video_source == "v4l2src":
            video_source = self.app.config.video_device
        _set_combobox_value(self.video_source_widget, video_source)
        log.debug(' * video_source: %s' % (video_source))
        # VIDEO CODEC:
        video_codec = _get_key_for_value(VIDEO_CODECS, self.app.config.video_codec)
        _set_combobox_value(self.video_codec_widget, video_codec)
        log.debug(' * video_codec: %s' % (video_codec))
        
        # ADDRESSBOOK:
        # Init addressbook contact list:
        self.app.address_book.selected_contact = None
        self.app.address_book.current_contact_is_new = False
        if len(self.app.address_book.contact_list) > 0:
            for contact in self.app.address_book.contact_list:
                contact_markup = format_contact_markup(contact)
                self.contact_tree.append([contact_markup])
            self.selection.select_path(self.app.address_book.selected)
            self.edit_contact_widget.set_sensitive(True)
            self.remove_contact_widget.set_sensitive(True)
            self.invite_contact_widget.set_sensitive(True)
        else:
            self.edit_contact_widget.set_sensitive(False)
            self.remove_contact_widget.set_sensitive(False)
            self.invite_contact_widget.set_sensitive(False)
        # change invite button with the name of the selected contact
        self.update_invite_button_with_contact_name()

        # AUDIO:
        self.audio_send_enabled_widget.set_active(_get_config("audio_send_enabled"))
        self.audio_receive_enabled_widget.set_active(_get_config("audio_recv_enabled"))
        self.audio_video_synchronized_widget.set_active(_get_config("audio_video_synchronized"))
        self.audio_numchannels_widget.set_value(_get_config("audio_channels")) # spinbutton
        self.audio_input_buffer_widget.set_value(_get_config("audio_input_buffer"))
        self.audio_output_buffer_widget.set_value(_get_config("audio_output_buffer"))
        self.audio_jitterbuffer_widget.set_value(_get_config("audio_jitterbuffer"))
        self.audio_jack_enable_autoconnect_widget.set_active(_get_config("audio_jack_enable_autoconnect"))
        # source, codec
        try:
            audio_source_readable = _get_key_for_value(AUDIO_SOURCES, self.app.config.audio_source)
        except ValueError:
            audio_source_readable = _get_key_for_value(AUDIO_SOURCES, "jackaudiosrc")
            log.warning("changed audiosource to jackaudiosrc, since it was set to an invalid value")
        log.debug(" * audio_source: %s" % (audio_source_readable))
        _set_combobox_value(self.audio_source_widget, audio_source_readable)
        audio_codec = _get_key_for_value(AUDIO_CODECS, self.app.config.audio_codec)
        log.debug(" * audio_codec: %s" % (audio_codec))
        _set_combobox_value(self.audio_codec_widget, audio_codec)
        self.make_audio_jitterbuffer_enabled_or_not()
        
        # MIDI:
        log.debug("MIDI jitterbuffer: %s" % (self.app.config.midi_jitterbuffer))
        if self.app.midi_is_supported():
            self.midi_send_enabled_widget.set_active(_get_config("midi_send_enabled"))
            self.midi_recv_enabled_widget.set_active(_get_config("midi_recv_enabled"))
            _set_combobox_value(self.midi_input_device_widget, _get_config("midi_input_device"))
            _set_combobox_value(self.midi_output_device_widget, _get_config("midi_output_device"))
            self.midi_jitterbuffer_widget.set_value(self.app.config.midi_jitterbuffer)
        else:
            self.midi_send_enabled_widget.set_active(False)
            self.midi_recv_enabled_widget.set_active(False)
        self.make_midi_widget_sensitive_or_not()
            

        # IMPORTANT: (to be done last)
        self._widgets_changed_by_user = True


Generated by  Doxygen 1.6.0   Back to index