def add_manually(self, *args): game = Game(self.view.selected_game) add_game_dialog = AddGameDialog(self.window, game) add_game_dialog.run() if add_game_dialog.saved: self.view.set_installed(game) self.sidebar_treeview.update()
def run_no_installer_dialog(self): """Open dialog for 'no script available' situation.""" dlg = NoInstallerDialog(self) if dlg.result == dlg.MANUAL_CONF: game = Game(self.game_ref) game_dialog = AddGameDialog(self, game) game_dialog.run() if game_dialog.saved: self.notify_install_success() elif dlg.result == dlg.NEW_INSTALLER: installer_url = settings.SITE_URL + "games/%s/" % self.game_ref webbrowser.open(installer_url)
def fetch_script(window, game_ref): """Downloads install script(s) for matching game_ref""" request = urllib2.Request(url=settings.INSTALLER_URL % game_ref) try: request = urllib2.urlopen(request) script_contents = request.read() except IOError: dlg = NoInstallerDialog(window) if dlg.result == 1: game = Game(game_ref) game_dialog = AddGameDialog(window, game) game_dialog.run() if game_dialog.installed: window.notify_install_success() elif dlg.result == 2: installer_url = settings.SITE_URL + "games/%s/" % game_ref webbrowser.open(installer_url) return # Data should be JSON here, but JSON is also valid YAML. # At some point we will be dropping the YAML parser and load installer # data with json.loads return yaml.safe_load(script_contents)
def fetch_script(window, game_ref): """Downloads install script(s) for matching game_ref""" request = urllib2.Request(url=settings.INSTALLER_URL % game_ref) try: request = urllib2.urlopen(request) script_contents = request.read() except IOError: dlg = NoInstallerDialog(window) if dlg.result == dlg.MANUAL_CONF: game = Game(game_ref) game_dialog = AddGameDialog(window, game) game_dialog.run() if game_dialog.saved: window.notify_install_success() elif dlg.result == dlg.NEW_INSTALLER: installer_url = settings.SITE_URL + "games/%s/" % game_ref webbrowser.open(installer_url) return # Data should be JSON here, but JSON is also valid YAML. # At some point we will be dropping the YAML parser and load installer # data with json.loads return yaml.safe_load(script_contents)
def add_game(self, _widget, _data=None): """Add a new game.""" add_game_dialog = AddGameDialog(self.window) add_game_dialog.run() if add_game_dialog.saved: self.add_game_to_view(add_game_dialog.game.id)
def add_game(self, _widget, _data=None): """Add a new game.""" add_game_dialog = AddGameDialog(self) add_game_dialog.run() if add_game_dialog.runner_name and add_game_dialog.slug: self.add_game_to_view(add_game_dialog.slug)
def add_manually(self, *args): game = Game(self.view.selected_game) add_game_dialog = AddGameDialog(self, game) add_game_dialog.run() if add_game_dialog.installed: self.view.set_installed(game)