Ejemplo n.º 1
0
    def __filter_changed(self, bar, text, restore=False):
        self.__filter = None
        if not Query.match_all(text):
            self.__filter = Query(text, self.STAR)

        if not restore:
            self.activate()
Ejemplo n.º 2
0
    def __filter_changed(self, bar, text, restore=False):
        self.__filter = None
        if not Query.match_all(text):
            self.__filter = Query(text, self.STAR)

        if not restore:
            self.activate()
Ejemplo n.º 3
0
    def __update_filter(self, entry, text):
        self.__filter = None
        if not Query.match_all(text):
            tags = self.__model.tags + ["album"]
            self.__filter = Query(text, star=tags).search
        self.__bg_filter = background_filter()

        self.view.get_model().refilter()
Ejemplo n.º 4
0
    def __update_filter(self, entry, text):
        self.__filter = None
        if not Query.match_all(text):
            tags = self.__model.tags + ["album"]
            self.__filter = Query(text, star=tags).search
        self.__bg_filter = background_filter()

        self.view.get_model().refilter()
Ejemplo n.º 5
0
 def _get_songs(self):
     try: self._filter = Query(self._text, star=SongList.star).search
     except Query.error: pass
     else:
         if Query.match_all(self._text):
             songs = self._library.values()
             self._filter = None
         else:
             songs = filter(self._filter, self._library)
         return songs
Ejemplo n.º 6
0
 def _get_songs(self):
     try:
         self._filter = Query(self._text, star=SongList.star).search
     except Query.error:
         pass
     else:
         if Query.match_all(self._text):
             songs = self._library.values()
             self._filter = None
         else:
             songs = filter(self._filter, self._library)
         return songs
Ejemplo n.º 7
0
    def __update_filter(self, entry, text, scroll_up=True, restore=False):
        model = self.view.get_model()

        self.__filter = None
        if not Query.match_all(text):
            self.__filter = Query(text, star=["~people", "album"]).search
        self.__bg_filter = background_filter()

        self.__inhibit()

        # We could be smart and try to scroll to a selected album
        # but that introduces lots of wild scrolling. Feel free to change it.
        # Without scrolling the TV trys to stay at the same position (40% down)
        # which makes no sence so always go to the top.
        if scroll_up:
            self.view.scroll_to_point(0, 0)

        # don't filter on restore if there is nothing to filter
        if not restore or self.__filter or self.__bg_filter:
            model.refilter()

        self.__uninhibit()
Ejemplo n.º 8
0
    def __update_filter(self, entry, text, scroll_up=True, restore=False):
        model = self.view.get_model()

        self.__filter = None
        if not Query.match_all(text):
            self.__filter = Query(text, star=["~people", "album"]).search
        self.__bg_filter = background_filter()

        self.__inhibit()

        # We could be smart and try to scroll to a selected album
        # but that introduces lots of wild scrolling. Feel free to change it.
        # Without scrolling the TV trys to stay at the same position (40% down)
        # which makes no sence so always go to the top.
        if scroll_up:
            self.view.scroll_to_point(0, 0)

        # don't filter on restore if there is nothing to filter
        if not restore or self.__filter or self.__bg_filter:
            model.refilter()

        self.__uninhibit()
Ejemplo n.º 9
0
 def test_match_all(self):
     self.failUnless(Query.match_all(""))
     self.failUnless(Query.match_all("    "))
     self.failIf(Query.match_all("foo"))
 def test_match_all(self):
     self.failUnless(Query.match_all(""))
     self.failUnless(Query.match_all("    "))
     self.failIf(Query.match_all("foo"))