Esempio n. 1
0
    def __filter(self, model, iter_, data):
        """Filter a single row"""
        plugin = model.get_value(iter_)
        if not plugin:
            return False

        entry, state_combo, type_combo = data

        plugin_type = type_combo.get_active_type()
        if not issubclass(plugin.cls, plugin_type):
            return False

        tag_row = state_combo.get_active_row()
        if tag_row:
            plugin_tags = plugin.tags
            tag, flag = tag_row
            enabled = plugin_enabled(plugin)
            if (flag == EnabledType.NO and plugin_tags or
                    flag == EnabledType.TAG and tag not in plugin_tags or
                    flag == EnabledType.EN and not enabled or
                    flag == EnabledType.DIS and enabled):
                return False

        filter_ = entry.get_text().lower()
        return (not filter_ or filter_ in plugin.name.lower()
                or filter_ in (plugin.description or "").lower())
Esempio n. 2
0
    def __filter(self, model, iter_, data):
        """Filter a single row"""
        plugin = model.get_value(iter_)
        if not plugin:
            return False

        entry, state_combo, type_combo = data

        plugin_type = type_combo.get_active_type()
        if not issubclass(plugin.cls, plugin_type):
            return False

        tag_row = state_combo.get_active_row()
        if tag_row:
            plugin_tags = plugin.tags
            tag, flag = tag_row
            enabled = plugin_enabled(plugin)
            if (flag == EnabledType.NO and plugin_tags or
                    flag == EnabledType.TAG and tag not in plugin_tags or
                    flag == EnabledType.EN and not enabled or
                    flag == EnabledType.DIS and enabled):
                return False

        def matches(text, filter_):
            return all(p in remove_diacritics(text.lower())
                       for p in filter_.lower().split())

        filter_ = remove_diacritics(entry.get_text())
        return (matches(plugin.name, filter_) or
                matches(plugin.id, filter_) or
                matches((plugin.description or ""), filter_))
Esempio n. 3
0
    def __filter(self, model, iter_, data):
        """Filter a single row"""
        plugin = model.get_value(iter_)
        if not plugin:
            return False

        entry, state_combo, type_combo = data

        plugin_type = type_combo.get_active_type()
        if not issubclass(plugin.cls, plugin_type):
            return False

        tag_row = state_combo.get_active_row()
        if tag_row:
            plugin_tags = plugin.tags
            tag, flag = tag_row
            enabled = plugin_enabled(plugin)
            if (flag == EnabledType.NO and plugin_tags
                    or flag == EnabledType.TAG and tag not in plugin_tags
                    or flag == EnabledType.EN and not enabled
                    or flag == EnabledType.DIS and enabled):
                return False

        filter_ = entry.get_text().lower()
        return (not filter_ or filter_ in plugin.name.lower()
                or filter_ in (plugin.description or "").lower())
Esempio n. 4
0
 def do_key_press_event(self, event):
     if is_accel(event, "space", "KP_Space"):
         selection = self.get_selection()
         fmodel, fiter = selection.get_selected()
         plugin = fmodel.get_value(fiter)
         if plugin.can_enable:
             self._emit_toggled(fmodel.get_path(fiter),
                                not plugin_enabled(plugin))
         self.get_model().iter_changed(fiter)
     else:
         Gtk.TreeView.do_key_press_event(self, event)
Esempio n. 5
0
 def do_key_press_event(self, event):
     if is_accel(event, "space", "KP_Space"):
         selection = self.get_selection()
         fmodel, fiter = selection.get_selected()
         plugin = fmodel.get_value(fiter)
         if plugin.can_enable:
             self._emit_toggled(fmodel.get_path(fiter),
                                not plugin_enabled(plugin))
         self.get_model().iter_changed(fiter)
     else:
         Gtk.TreeView.do_key_press_event(self, event)
Esempio n. 6
0
    def __filter(self, model, iter_, data):
        plugin = model.get_value(iter_)
        if not plugin:
            return False

        entry, combo = data

        tag = combo.get_active_tag()
        if tag:
            plugin_tags = plugin.tags
            tag, flag = tag
            enabled = plugin_enabled(plugin)
            if flag == ComboType.NO and plugin_tags or \
                flag == ComboType.TAG and not tag in plugin_tags or \
                flag == ComboType.EN and not enabled or \
                flag == ComboType.DIS and enabled:
                return False

        filter_ = entry.get_text().lower()
        if not filter_ or filter_ in plugin.name.lower() or \
                filter_ in (plugin.description or "").lower():
            return True
        return False
Esempio n. 7
0
    def __filter(self, model, iter_, data):
        plugin = model.get_value(iter_)
        if not plugin:
            return False

        entry, combo = data

        tag = combo.get_active_tag()
        if tag:
            plugin_tags = plugin.tags
            tag, flag = tag
            enabled = plugin_enabled(plugin)
            if flag == ComboType.NO and plugin_tags or \
                flag == ComboType.TAG and not tag in plugin_tags or \
                flag == ComboType.EN and not enabled or \
                flag == ComboType.DIS and enabled:
                return False

        filter_ = entry.get_text().lower()
        if not filter_ or filter_ in plugin.name.lower() or \
                filter_ in (plugin.description or "").lower():
            return True
        return False