Esempio n. 1
0
 def add_game(self, game):
     pixbuf = get_pixbuf_for_game(game['slug'], self.icon_type,
                                  game['installed'])
     name = game['name'].replace('&', "&")
     self.store.append(
         (game['id'], game['slug'], name, pixbuf, str(game['year']),
          game['runner'], game['installed']))
Esempio n. 2
0
    def add_game(self, game):
        pixbuf = get_pixbuf_for_game(game['slug'], self.icon_type,
                                     game['installed'])
        name = game['name'].replace('&', "&")
        runner = None
        platform = ''
        platform_name = ''
        runner_name = game['runner']
        runner_human_name = ''
        if runner_name:
            game_inst = Game(game['id'])
            if not game_inst.is_installed:
                return
            if runner_name in self.runner_names:
                runner_human_name = self.runner_names[runner_name]
            else:
                runner = runners.import_runner(runner_name)
                runner_human_name = runner.human_name
                self.runner_names[runner_name] = runner_human_name
            platform = game_inst.get_platform()
            if platform:
                platform_name = platform.replace(' / ', ' ')

        lastplayed = ''
        if game['lastplayed']:
            lastplayed = time.strftime("%c",
                                       time.localtime(game['lastplayed']))

        self.store.append(
            (game['id'], game['slug'], name, pixbuf, str(game['year'] or ''),
             runner_name, runner_human_name, platform, platform_name,
             lastplayed, game['installed']))
Esempio n. 3
0
 def set_icon_type(self, icon_type):
     if icon_type != self.icon_type:
         self.icon_type = icon_type
         for row in self.store:
             row[COL_ICON] = get_pixbuf_for_game(
                 row[COL_SLUG], icon_type, is_installed=row[COL_INSTALLED]
             )
         self.emit('icons-changed', icon_type)  # Obsolete, only for GridView
Esempio n. 4
0
 def set_icon_type(self, icon_type):
     if icon_type != self.icon_type:
         self.icon_type = icon_type
         for row in self.store:
             row[COL_ICON] = get_pixbuf_for_game(
                 row[COL_SLUG], icon_type, is_installed=row[COL_INSTALLED])
         self.emit('icons-changed',
                   icon_type)  # Obsolete, only for GridView
Esempio n. 5
0
 def _set_image(self, image_format):
     assert image_format in ('banner', 'icon')
     image = Gtk.Image()
     game_slug = self.game.slug if self.game else ''
     image.set_from_pixbuf(get_pixbuf_for_game(game_slug, image_format))
     if image_format == 'banner':
         self.banner_button.set_image(image)
     else:
         self.icon_button.set_image(image)
Esempio n. 6
0
 def _set_image(self, image_format):
     assert image_format in ('banner', 'icon')
     image = Gtk.Image()
     game_slug = self.game.slug if self.game else ''
     image.set_from_pixbuf(get_pixbuf_for_game(game_slug, image_format))
     if image_format == 'banner':
         self.banner_button.set_image(image)
     else:
         self.icon_button.set_image(image)
Esempio n. 7
0
 def update_image(self, game_id, is_installed=False):
     """Update game icon."""
     row = self.get_row_by_id(game_id)
     if row:
         game_slug = row[COL_SLUG]
         # get_pixbuf_for_game.cache_clear()
         game_pixpuf = get_pixbuf_for_game(game_slug,
                                           self.game_store.icon_type,
                                           is_installed)
         row[COL_ICON] = game_pixpuf
         row[COL_INSTALLED] = is_installed
         if type(self) is GameGridView:
             GLib.idle_add(self.queue_draw)
Esempio n. 8
0
 def add_game(self, game):
     pixbuf = get_pixbuf_for_game(game['slug'], self.icon_type,
                                  game['installed'])
     name = game['name'].replace('&', "&")
     self.store.append((
         game['id'],
         game['slug'],
         name,
         pixbuf,
         str(game['year']),
         game['runner'],
         game['installed']
     ))
Esempio n. 9
0
 def update_image(self, game_id, is_installed=False):
     """Update game icon."""
     row = self.get_row_by_id(game_id)
     if row:
         game_slug = row[COL_SLUG]
         # get_pixbuf_for_game.cache_clear()
         game_pixpuf = get_pixbuf_for_game(game_slug,
                                           self.game_store.icon_type,
                                           is_installed)
         row[COL_ICON] = game_pixpuf
         row[COL_INSTALLED] = is_installed
         if type(self) is GameGridView:
             GLib.idle_add(self.queue_draw)
Esempio n. 10
0
    def add_game(self, game):
        pixbuf = get_pixbuf_for_game(game['slug'], self.icon_type,
                                     game['installed'])
        name = game['name'].replace('&', "&")
        platform = game['platform']
        runner = None
        runner_name = game['runner']
        runner_human_name = ''
        if runner_name:
            runner = runners.import_runner(runner_name)
            runner_human_name = runner.human_name
        if not platform and runner:
            platform = str(runner.platform or '')

        self.store.append(
            (game['id'], game['slug'], name, pixbuf, str(game['year']),
             runner_name, runner_human_name, platform, game['installed']))
Esempio n. 11
0
    def add_game(self, game):
        pixbuf = get_pixbuf_for_game(game['slug'], self.icon_type,
                                     game['installed'])
        name = game['name'].replace('&', "&")
        runner = None
        platform = ''
        runner_name = game['runner']
        runner_human_name = ''
        if runner_name:
            game_inst = Game(game['id'])
            if not game_inst.is_installed:
                return
            if runner_name in self.runner_names:
                runner_human_name = self.runner_names[runner_name]
            else:
                runner = runners.import_runner(runner_name)
                runner_human_name = runner.human_name
                self.runner_names[runner_name] = runner_human_name
            platform = game_inst.platform

        lastplayed = ''
        if game['lastplayed']:
            lastplayed = time.strftime("%c", time.localtime(game['lastplayed']))

        self.store.append((
            game['id'],
            game['slug'],
            name,
            pixbuf,
            str(game['year'] or ''),
            runner_name,
            runner_human_name,
            platform,
            lastplayed,
            game['installed']
        ))
Esempio n. 12
0
 def set_image_pixbuf(self):
     pixbuf = get_pixbuf_for_game(self.slug,
                                  self.icon_type,
                                  self.installed)
     self.image.set_from_pixbuf(pixbuf)
Esempio n. 13
0
 def _set_icon_image(self):
     image = Gtk.Image()
     game_slug = self.game.slug if self.game else ''
     image.set_from_pixbuf(get_pixbuf_for_game(game_slug, 'banner'))
     self.banner_button.set_image(image)
Esempio n. 14
0
 def _set_icon_image(self):
     image = Gtk.Image()
     game_slug = self.game.slug if self.game else ''
     image.set_from_pixbuf(get_pixbuf_for_game(game_slug, 'banner'))
     self.banner_button.set_image(image)