Esempio n. 1
0
 def on_install_clicked(self, _widget=None, game_ref=None):
     """Install a game"""
     if not game_ref:
         game_id = self._get_current_game_id()
         game = pga.get_game_by_field(game_id, "id")
         game_ref = game.get("slug")
         logger.debug("Installing game %s (%s)" % (game_ref, game_id))
     if not game_ref:
         return
     display.set_cursor("wait", self.window.get_window())
     InstallerDialog(game_ref, self)
Esempio n. 2
0
 def on_game_run(self, _widget=None, game_id=None):
     """Launch a game, or install it if it is not"""
     if not game_id:
         game_id = self._get_current_game_id()
     if not game_id:
         return
     display.set_cursor("wait", self.window.get_window())
     self.running_game = Game(game_id)
     if self.running_game.is_installed:
         self.running_game.play()
     else:
         game_slug = self.running_game.slug
         self.running_game = None
         InstallerDialog(game_slug, self)
Esempio n. 3
0
    def on_scripts_obtained(self, scripts, _error=None):
        if self.parent:
            display.set_cursor("default", self.parent.window.get_window())
        if not scripts:
            self.destroy()
            self.run_no_installer_dialog()
            return

        if not isinstance(scripts, list):
            scripts = [scripts]
        self.scripts = scripts
        self.show_all()
        self.close_button.hide()
        self.play_button.hide()
        self.install_button.hide()

        self.choose_installer()
Esempio n. 4
0
 def refresh_status(self):
     """Refresh status bar."""
     if self.running_game:
         name = self.running_game.name
         if self.running_game.state == self.running_game.STATE_IDLE:
             self.set_status("Preparing to launch %s" % name)
         elif self.running_game.state == self.running_game.STATE_STOPPED:
             self.set_status("Game has quit")
             display.set_cursor("default", self.window.get_window())
             self.stop_button.set_sensitive(False)
         elif self.running_game.state == self.running_game.STATE_RUNNING:
             self.set_status("Playing %s" % name)
             display.set_cursor("default", self.window.get_window())
             self.stop_button.set_sensitive(True)
     for index in range(4):
         self.joystick_icons.append(self.builder.get_object("js" + str(index) + "image"))
         if os.path.exists("/dev/input/js%d" % index):
             self.joystick_icons[index].set_visible(True)
         else:
             self.joystick_icons[index].set_visible(False)
     return True