Ejemplo n.º 1
0
 def __toolbar_query_changed_cb(self, toolbar, query):
     self._query = normalize_string(query.decode('utf-8'))
     self._list_view.set_filter(self._query)
     for i in range(desktop.get_number_of_views()):
         self._favorites_boxes[i].set_filter(self._query)
         toolbar.search_entry._icon_selected.append(
             self._favorites_boxes[i]._get_selected(self._query))
Ejemplo n.º 2
0
 def __toolbar_query_changed_cb(self, toolbar, query):
     self._query = normalize_string(query.decode('utf-8'))
     self._list_view.set_filter(self._query)
     for i in range(desktop.get_number_of_views()):
         self._favorites_boxes[i].set_filter(self._query)
         toolbar.search_entry._icon_selected.append(
                 self._favorites_boxes[i]._get_selected(self._query))
Ejemplo n.º 3
0
 def set_filter(self, query):
     if isinstance(self._buddy.get_nick(), bytes):
         nick = self._buddy.get_nick().decode()
     else:
         nick = self._buddy.get_nick()
     normalized_name = normalize_string(nick)
     self._filtered = (normalized_name.find(query) == -1) \
         and not self._buddy.is_owner()
     self._update_color()
Ejemplo n.º 4
0
    def set_filter(self, query):
        """Set a new query and refilter the model, return the number
        of matching activities.

        """
        self._query = normalize_string(query.decode('utf-8'))
        self.get_model().refilter()
        matches = self.get_model().iter_n_children(None)
        return matches
Ejemplo n.º 5
0
 def _get_selected(self, query):
     query = query.strip()
     selected = []
     for icon in self.get_children():
         if icon not in [self._owner_icon, self._activity_icon]:
             activity_name = icon.get_activity_name().decode('utf-8')
             normalized_name = normalize_string(activity_name)
             if normalized_name.find(query) > -1:
                 selected.append(icon)
     return selected
Ejemplo n.º 6
0
 def set_filter(self, query):
     query = query.strip()
     for icon in self.get_children():
         if icon not in [self._owner_icon, self._activity_icon]:
             activity_name = icon.get_activity_name().decode('utf-8')
             normalized_name = normalize_string(activity_name)
             if normalized_name.find(query) > -1:
                 icon.alpha = 1.0
             else:
                 icon.alpha = 0.33
Ejemplo n.º 7
0
 def set_filter(self, query):
     query = query.strip()
     for icon in self.get_children():
         if icon not in [self._owner_icon, self._activity_icon]:
             activity_name = icon.get_activity_name().decode('utf-8')
             normalized_name = normalize_string(activity_name)
             if normalized_name.find(query) > -1:
                 icon.alpha = 1.0
             else:
                 icon.alpha = 0.33
Ejemplo n.º 8
0
 def _get_selected(self, query):
     query = query.strip()
     selected = []
     for icon in self.get_children():
         if icon not in [self._owner_icon, self._activity_icon]:
             activity_name = icon.get_activity_name().decode('utf-8')
             normalized_name = normalize_string(activity_name)
             if normalized_name.find(query) > -1:
                 selected.append(icon)
     return selected
Ejemplo n.º 9
0
    def __toolbar_query_changed_cb(self, toolbar, query):
        self._query = normalize_string(query.decode("utf-8"))
        self._list_view.set_filter(self._query)

        toolbar.search_entry._icon_selected = self._list_view.get_activities_selected()

        # verify if one off the selected names is a perfect match
        # this is needed by th case of activities with names contained
        # in other activities like 'Paint' and 'MusicPainter'
        for activity in self._list_view.get_activities_selected():
            if activity["name"].upper() == query.upper():
                toolbar.search_entry._icon_selected = [activity]
                break

        # Don't change the selection if the entry has been autocompleted
        if len(toolbar.search_entry._icon_selected) == 1 and not toolbar.search_entry.get_text() == activity["name"]:
            pos = toolbar.search_entry.get_position()
            toolbar.search_entry.set_text(toolbar.search_entry._icon_selected[0]["name"])
            toolbar.search_entry.select_region(pos, -1)
Ejemplo n.º 10
0
    def __toolbar_query_changed_cb(self, toolbar, query):
        self._query = normalize_string(query.decode('utf-8'))
        self._list_view.set_filter(self._query)
        for i in range(desktop.get_number_of_views()):
            self._favorites_boxes[i].set_filter(self._query)
        toolbar.search_entry._icon_selected = \
            self._list_view.get_activities_selected()

        # verify if one off the selected names is a perfect match
        # this is needed by th case of activities with names contained
        # in other activities like 'Paint' and 'MusicPainter'
        for activity in self._list_view.get_activities_selected():
            if activity['name'].upper() == query.upper():
                toolbar.search_entry._icon_selected = [activity]
                break

        if len(toolbar.search_entry._icon_selected) == 1:
            toolbar.search_entry.set_text(
                toolbar.search_entry._icon_selected[0]['name'])
            toolbar.search_entry.set_position(-1)
    def __toolbar_query_changed_cb(self, toolbar, query):
        self._query = normalize_string(query.decode('utf-8'))
        self._list_view.set_filter(self._query)
        for i in range(desktop.get_number_of_views()):
            self._favorites_boxes[i].set_filter(self._query)
        toolbar.search_entry._icon_selected = \
            self._list_view.get_activities_selected()

        # verify if one off the selected names is a perfect match
        # this is needed by th case of activities with names contained
        # in other activities like 'Paint' and 'MusicPainter'
        for activity in self._list_view.get_activities_selected():
            if activity['name'].upper() == query.upper():
                toolbar.search_entry._icon_selected = [activity]
                break

        if len(toolbar.search_entry._icon_selected) == 1:
            toolbar.search_entry.set_text(
                toolbar.search_entry._icon_selected[0]['name'])
            toolbar.search_entry.set_position(-1)
Ejemplo n.º 12
0
    def __toolbar_query_changed_cb(self, toolbar, query):
        self._query = normalize_string(query.decode('utf-8'))
        self._list_view.set_filter(self._query)

        toolbar.search_entry._icon_selected = \
            self._list_view.get_activities_selected()

        # verify if one off the selected names is a perfect match
        # this is needed by th case of activities with names contained
        # in other activities like 'Paint' and 'MusicPainter'
        for activity in self._list_view.get_activities_selected():
            if activity['name'].upper() == query.upper():
                toolbar.search_entry._icon_selected = [activity]
                break

        # Don't change the selection if the entry has been autocompleted
        if len(toolbar.search_entry._icon_selected) == 1 \
           and not toolbar.search_entry.get_text() == activity['name']:
            pos = toolbar.search_entry.get_position()
            toolbar.search_entry.set_text(
                toolbar.search_entry._icon_selected[0]['name'])
            toolbar.search_entry.select_region(pos, -1)
Ejemplo n.º 13
0
 def __model_visible_cb(self, model, tree_iter, data):
     title = model[tree_iter][ListModel.COLUMN_TITLE]
     title = normalize_string(title.decode('utf-8'))
     return title is not None and title.find(self._query) > -1
Ejemplo n.º 14
0
 def set_filter(self, query):
     normalized_name = normalize_string(self._display_name.decode('utf-8'))
     self._filtered = normalized_name.find(query) == -1
     self._update_icon()
     self._update_color()
Ejemplo n.º 15
0
 def set_filter(self, query):
     normalized_name = normalize_string(self._display_name.decode('utf-8'))
     self._filtered = normalized_name.find(query) == -1
     self._update_icon()
     self._update_color()
Ejemplo n.º 16
0
 def __toolbar_query_changed_cb(self, toolbar, query):
     self._query = normalize_string(query.decode('utf-8'))
     self._list_view.set_filter(self._query)
     self._favorites_box.set_filter(self._query)
Ejemplo n.º 17
0
 def test_normalize(self):
     for line in codecs.open("../testCases/normalize.txt", "r", "utf-8"):
         if not line.startswith("#"):
             before = line[:line.index(",")]
             after = line[line.index(",") + 1:-1]
             self.assertEquals(normalize.normalize_string(before), after)
Ejemplo n.º 18
0
 def set_filter(self, query):
     normalized_name = normalize_string(
         self._buddy.get_nick().decode('utf-8'))
     self._filtered = (normalized_name.find(query) == -1) \
             and not self._buddy.is_owner()
     self._update_color()
Ejemplo n.º 19
0
 def __model_visible_cb(self, model, tree_iter, data):
     title = model[tree_iter][ListModel.COLUMN_TITLE]
     title = normalize_string(title.decode('utf-8'))
     return title is not None and title.find(self._query) > -1
Ejemplo n.º 20
0
 def __toolbar_query_changed_cb(self, toolbar, query):
     self._query = normalize_string(query.decode('utf-8'))
     self._list_view.set_filter(self._query)
     self._favorites_box.set_filter(self._query)
Ejemplo n.º 21
0
 def __model_visible_cb(self, model, tree_iter, data):
     title = model[tree_iter][self._model.column_title]
     title = normalize_string(title.decode('utf-8'))
     return title is not None and title.find(self._query) > -1
Ejemplo n.º 22
0
 def __toolbar_query_changed_cb(self, toolbar, query):
     self._query = normalize_string(query.decode('utf-8'))
     self._list_view.set_filter(self._query)
     for i in range(desktop.get_number_of_views()):
         self._favorites_boxes[i].set_filter(self._query)
Ejemplo n.º 23
0
 def set_filter(self, query):
     normalized_name = normalize_string(
         self._buddy.get_nick().decode('utf-8'))
     self._filtered = (normalized_name.find(query) == -1) \
         and not self._buddy.is_owner()
     self._update_color()
Ejemplo n.º 24
0
 def _toolbar_query_changed_cb(self, toolbar, query):
     self._query = normalize_string(query.decode('utf-8'))
     for icon in self.get_children():
         if hasattr(icon, 'set_filter'):
             icon.set_filter(self._query)
Ejemplo n.º 25
0
 def __toolbar_query_changed_cb(self, toolbar, query):
     self._query = normalize_string(query.decode('utf-8'))
     self._list_view.set_filter(self._query)
     for i in range(desktop.get_number_of_views()):
         self._favorites_boxes[i].set_filter(self._query)