Beispiel #1
0
def on_combo_setting_changed(combo: Gtk.ComboBoxText,
                             items: 'OrderedDict[str, str]') -> None:
    current_value = list(items)[combo.get_active()]
    section = combo.get_section_name()
    option = combo.get_name()

    config.new(section, option, current_value)
Beispiel #2
0
    def on_effects_changed(self, combo: Gtk.ComboBoxText) -> None:
        self.primary_effect.set_sensitive(True)
        self.secondary_effect.set_sensitive(True)
        self.primary_color.set_sensitive(True)
        self.secondary_color.set_sensitive(True)
        name = combo.get_name()

        if name == "primary_effect":
            effect = list(primary_effects_dict)[combo.get_active()]

            if effect in extra_effect_block_list:
                self.extra_effect.set_active(0)
                self.extra_effect.set_sensitive(False)
            else:
                self.extra_effect.set_sensitive(True)
        elif name == "secondary_effect":
            effect = list(secondary_effects_dict)[combo.get_active()]
        else:
            effect = list(extra_effects_dict)[combo.get_active()]

        if self.primary_effect.get_active() == 0:
            self.secondary_effect.set_active(0)
            self.secondary_effect.set_sensitive(False)

        if self.extra_effect.get_active(
        ) == 0 or self.primary_effect.get_active() == 0:
            current_effect_list = [
                list(primary_effects_dict)[self.primary_effect.get_active()],
                list(extra_effects_dict)[self.extra_effect.get_active()],
            ]

            if any((effect in primary_color_effect_block_list)
                   for effect in current_effect_list):
                self.primary_color.set_sensitive(False)

            if any((effect in secondary_color_effect_block_list)
                   for effect in current_effect_list):
                self.secondary_color.set_sensitive(False)

        config.new('effects', name, effect)

        serial_message = 'le'
        serial_message += config.parser.get("effects", "extra_effect")
        serial_message += config.parser.get("effects", "secondary_effect")
        serial_message += config.parser.get("effects", "primary_effect")
        self.application.send_serial(serial_message)
Beispiel #3
0
    def on_theme_changed(self, combo: Gtk.ComboBoxText) -> None:
        theme = list(config.gtk_themes)[combo.get_active()]

        if theme == 'dark':
            self.gtk_settings_class.props.gtk_application_prefer_dark_theme = True
        else:
            self.gtk_settings_class.props.gtk_application_prefer_dark_theme = False

        config.new('general', 'theme', theme)
Beispiel #4
0
    def on_auto_effect_changed(self, combo: Gtk.ComboBoxText) -> None:
        name = combo.get_name()
        effect = list(auto_effect_dict)[combo.get_active()]

        config.new('auto_effect', name, effect)

        serial_message = 'la'
        serial_message += config.parser.get("auto_effect", name)
        self.application.send_serial(serial_message)
        sleep(1.5)
Beispiel #5
0
 def update_language(self, combo: Gtk.ComboBoxText) -> None:
     language = list(config.translations)[combo.get_active()]
     config.new('general', 'language', language)
     Gtk.Container.foreach(self, refresh_widget_text)
     Gtk.Container.foreach(self.parent_window, refresh_widget_text)