def setSource(self, url): #action, key, filename = split_url(url) action, name = split_url(url) filehandler = self.app.game_fileshandler if action == 'cleanup': filehandler.cleanup_game(name) elif action == 'prepare': filehandler.prepare_game(name) elif action == 'edit': dlg = EditGameDataDialog(self, name) dlg.show() elif action == 'set_title_screenshot': self.select_title_screenshot(name) elif action == 'open_weblink': # get gamedata from doc object # to keep from excessive xml parsing gamedata = self.doc.gamedata cmd = self.app.myconfig.get('externalactions', 'launch_weblink') # for these url's, the name is the site weblink_url = gamedata['weblinks'][name] if '%s' in cmd: os.system(cmd % weblink_url) else: os.system("%s '%s'" % (cmd, weblink_url)) # now we reset the name variable to reset the page properly name = gamedata['name'] else: QMessageBox.information(self, '%s is unimplemented.' % action) # refresh the page self.set_game_info(name) # need to emit signal here for mainwin to pick up # this method is ugly if action in ['cleanup', 'prepare', 'edit']: mainwin = self.parent().parent() mainwin.refreshListView()
def edit_game_data_dialog(self, name): dlg = EditGameDataDialog(self.dialog_parent, name) # here we connect the GameDataUpdated signal to the set_game_info method dlg.connect(dlg, PYSIGNAL('GameDataUpdated'), self.set_game_info) dlg.show()