def _add_tiles_to_flowgrid(self, docs, flowgrid, amount):
     '''Adds application tiles to a FlowableGrid:
        docs = xapian documents (apps)
        flowgrid = the FlowableGrid to add tiles to
        amount = number of tiles to add from start of doc range'''
     amount = min(len(docs), amount)
     for doc in docs[0:amount]:
         tile = FeaturedTile(self.properties_helper, doc)
         tile.connect('clicked', self.on_app_clicked,
                      self.properties_helper.get_application(doc))
         flowgrid.add_child(tile)
     return
Exemple #2
0
 def _add_tiles_to_flowgrid(self, docs, flowgrid, amount):
     '''Adds application tiles to a FlowableGrid:
        docs = xapian documents (apps)
        flowgrid = the FlowableGrid to add tiles to
        amount = number of tiles to add from start of doc range'''
     amount = min(len(docs), amount)
     for doc in docs[0:amount]:
         tile = FeaturedTile(self.helper, doc)
         tile.connect('clicked', self.on_app_clicked,
                      self.helper.get_application(doc))
         flowgrid.add_child(tile)
     return
Exemple #3
0
 def add_tiles(self, properties_helper, docs, amount):
     '''Adds application tiles to an ApplicationTileGrid:
             properties_help -- an instance of the PropertiesHelper object
             docs -- xapian documents (apps)
             amount -- number of tiles to add from start of doc range
     '''
     amount = min(len(docs), amount)
     for doc in docs[0:amount]:
         tile = FeaturedTile(properties_helper, doc)
         tile.connect('clicked', self._on_app_clicked,
                      properties_helper.get_application(doc))
         self.add_child(tile)
Exemple #4
0
 def test_free_price(self):
     values = {'display_price': "Free"}
     mock_property_helper = get_mock_app_properties_helper(values)
     # we don't really need a "doc" on second input as we mock the helper
     button = FeaturedTile(mock_property_helper, None)
     self.assertEqual(
         button.price.get_label(), '<span font_desc="10">Free</span>')
Exemple #5
0
 def test_feature_tile_dup_symbol(self):
     values = {'display_price': 'US$ 1.00' }
     mock_property_helper = get_mock_app_properties_helper(values)
     # we don't really need a "doc" on second input as we mock the helper
     button = FeaturedTile(mock_property_helper, None)
     self.assertEqual(
         button.price.get_label(), '<span font_desc="10">US$ 1.00</span>')
Exemple #6
0
    def _add_tiles_to_flowgrid(self, docs, flowgrid, amount):
        '''Adds application tiles to a FlowableGrid:
           docs = xapian documents (apps)
           flowgrid = the FlowableGrid to add tiles to
           amount = number of tiles to add from start of doc range'''
        amount = min(len(docs), amount)

        cache = get_pkg_info()
        if hasattr(cache, 'prefill_cache'):
            prefill_pkgnames = [ self.db.get_pkgname(doc) for doc in docs[0:amount] ]
            cache.prefill_cache(wanted_pkgs = prefill_pkgnames, only_newest=True)

        for doc in docs[0:amount]:
            tile = FeaturedTile(self.properties_helper, doc)
            tile.connect('clicked', self.on_app_clicked,
                         self.properties_helper.get_application(doc))
            flowgrid.add_child(tile)
        return