Exemplo n.º 1
0
    def add_ui(self, shell):
        action_group = ActionGroup(shell, 'EqualizerActionGroup')
        action_group.add_action(func=self.show_ui,
                                action_name='Equalize',
                                label=_('_Equalizer'),
                                action_type='app')

        self._appshell = ApplicationShell(shell)
        self._appshell.insert_action_group(action_group)
        self._appshell.add_app_menuitems(ui_string, 'EqualizerActionGroup')
Exemplo n.º 2
0
    def add_ui(self, shell):
        action_group = ActionGroup(shell, "EqualizerActionGroup")
        action_group.add_action(func=self.show_ui, action_name="Equalize", label=_("_Equalizer"), action_type="app")

        self._appshell = ApplicationShell(shell)
        self._appshell.insert_action_group(action_group)
        self._appshell.add_app_menuitems(ui_string, "EqualizerActionGroup")
Exemplo n.º 3
0
    def add_ui(self, shell):
        action_group = ActionGroup(shell, 'EqualizerActionGroup')
        action_group.add_action(func=self.show_ui,
            action_name='Equalize', label=_('_Equalizer'),
            action_type='app')

        self._appshell = ApplicationShell(shell)
        self._appshell.insert_action_group(action_group)
        self._appshell.add_app_menuitems(ui_string, 'EqualizerActionGroup')
Exemplo n.º 4
0
class ConfDialog(object):
    def __init__(self, glade_file, conf, eq, plugin):
        self.plugin = plugin
        self.eq = eq
        self.conf = conf
        gladexml = Gtk.Builder()
        gladexml.add_from_file(glade_file)

        self.dialog = gladexml.get_object('preferences_dialog')
        self.dialog.connect("response", self.dialog_response)
        self.dialog.connect("destroy", self.on_destroy)
        self.dialog.connect("close", self.on_destroy)

        box = gladexml.get_object("presetchooser")
        self.box = box

        # workarounds
        # see https://bugzilla.gnome.org/show_bug.cgi?id=650369#c4
        self.box.set_entry_text_column(0)
        self.box.set_id_column(1)

        self.read_presets()
        box.connect("changed", self.preset_change)

        self.bands = []
        for i in range(0,10):
            self.bands.append(gladexml.get_object("b" + repr(i)))
            self.bands[i].connect("value_changed", self.slider_changed)
        self.update_bands()
        conf.apply_settings(eq)

    def cleanup(self):
        self._appshell.cleanup()

    def on_destroy(self, dialog):
        dialog.hide()
        self.__init__(self.plugin.glade_f, self.conf, self.eq, self.plugin)
        return True

    def read_presets(self):
        box = self.box
        conf = self.conf
        if box:
            box.get_model().clear()

        current = conf.demangle(conf.preset)
        s_presets = sorted(Gst.Preset.get_preset_names(self.eq))
        i = 1
        box.append_text("default")
        box.set_active(0)
        for preset in s_presets:
            box.append_text(preset)
            if (preset == current):
                box.set_active(i)
            i += 1

    def update_bands(self):
        for i in range(0, 10):
            self.bands[i].set_value(self.conf.config[i])

    def get_dialog(self):
        return self.dialog

    def dialog_response(self, dialog, response):
        if (response == -4):
            self.conf.write_settings()
            dialog.hide()

        if (response == -6):
            self.conf.reset_all()
            self.box.set_active(0)

        if (response == -8 or response == -6):
            if self.box.get_active_text() == "default":
                self.conf.config = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
            else:
                Gst.Preset.load_preset(self.eq, self.box.get_active_text())
                self.conf.config = list(self.eq.get_property('band' + str(i)) for i in range(0,10))

            self.update_bands()

    def preset_change(self, entry):
        new_preset = entry.get_active_text()
        if new_preset != '':
            self.conf.change_preset(entry.get_active_text(), self.eq)
            self.update_bands()

    def slider_changed(self, hscale):
        eq = self.eq
        if eq == None:
            return
        i = self.bands.index(hscale)
        val = self.bands[i].get_value()
        self.conf.config[i] = val
        eq.set_property('band' + repr(i), val)
        self.conf.write_settings()

    def add_ui(self, shell):
        action_group = ActionGroup(shell, 'EqualizerActionGroup')
        action_group.add_action(func=self.show_ui,
            action_name='Equalize', label=_('_Equalizer'),
            action_type='app')

        self._appshell = ApplicationShell(shell)
        self._appshell.insert_action_group(action_group)
        self._appshell.add_app_menuitems(ui_string, 'EqualizerActionGroup')
        
    def show_ui(self, *args):
        self.read_presets()
        self.get_dialog().present()
Exemplo n.º 5
0
class ConfDialog(object):
    def __init__(self, glade_file, conf, eq, plugin):
        self.plugin = plugin
        self.eq = eq
        self.conf = conf
        gladexml = Gtk.Builder()
        gladexml.add_from_file(glade_file)

        self.dialog = gladexml.get_object('preferences_dialog')
        self.dialog.connect("response", self.dialog_response)
        self.dialog.connect("destroy", self.on_destroy)
        self.dialog.connect("close", self.on_destroy)

        box = gladexml.get_object("presetchooser")
        self.box = box

        # workarounds
        # see https://bugzilla.gnome.org/show_bug.cgi?id=650369#c4
        self.box.set_entry_text_column(0)
        self.box.set_id_column(1)

        self.read_presets()
        box.connect("changed", self.preset_change)

        self.bands = []
        for i in range(0, 10):
            self.bands.append(gladexml.get_object("b" + ` i `))
            self.bands[i].connect("value_changed", self.slider_changed)
        self.update_bands()
        conf.apply_settings(eq)

    def cleanup(self):
        self._appshell.cleanup()

    def on_destroy(self, dialog):
        dialog.hide()
        self.__init__(self.plugin.glade_f, self.conf, self.eq, self.plugin)
        return True

    def read_presets(self):
        box = self.box
        conf = self.conf
        if box:
            box.get_model().clear()

        current = conf.demangle(conf.preset)
        s_presets = sorted(Gst.Preset.get_preset_names(self.eq))
        i = 1
        box.append_text("default")
        box.set_active(0)
        for preset in s_presets:
            box.append_text(preset)
            if (preset == current):
                box.set_active(i)
            i += 1

    def update_bands(self):
        for i in range(0, 10):
            self.bands[i].set_value(self.conf.config[i])

    def get_dialog(self):
        return self.dialog

    def dialog_response(self, dialog, response):
        if (response == -4):
            self.conf.write_settings()
            dialog.hide()

        if (response == -6):
            self.conf.reset_all()
            self.box.set_active(0)

        if (response == -8 or response == -6):
            if self.box.get_active_text() == "default":
                self.conf.config = [
                    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
                ]
            else:
                Gst.Preset.load_preset(self.eq, self.box.get_active_text())
                self.conf.config = list(
                    self.eq.get_property('band' + str(i))
                    for i in range(0, 10))

            self.update_bands()

    def preset_change(self, entry):
        new_preset = entry.get_active_text()
        if new_preset != '':
            self.conf.change_preset(entry.get_active_text(), self.eq)
            self.update_bands()

    def slider_changed(self, hscale):
        eq = self.eq
        if eq == None:
            return
        i = self.bands.index(hscale)
        val = self.bands[i].get_value()
        self.conf.config[i] = val
        eq.set_property('band' + ` i `, val)
        self.conf.write_settings()

    def add_ui(self, shell):
        action_group = ActionGroup(shell, 'EqualizerActionGroup')
        action_group.add_action(func=self.show_ui,
                                action_name='Equalize',
                                label=_('_Equalizer'),
                                action_type='app')

        self._appshell = ApplicationShell(shell)
        self._appshell.insert_action_group(action_group)
        self._appshell.add_app_menuitems(ui_string, 'EqualizerActionGroup')

    def show_ui(self, *args):
        self.read_presets()
        self.get_dialog().present()