def make_title_screenshot_table(self, gamedata): name = gamedata['name'] screenshot = self.app.game_datahandler.get_title_screenshot_filename(name) status = os.path.exists(screenshot) # a quick hack to get khtml to use the current image # thanks to Russell Valentine for this if self.app.myconfig.getboolean('mainwindow', 'use_khtml_part'): screenshot = '%s?test=%s' % (screenshot, time.time()) print screenshot tableatts = dict(class_='titlescreenshottable', width='100%') ss_table = Table(**tableatts) lbl = TableHeader('Title Screenshot', colspan=0, align='center') row = TableRow(lbl) ss_table.set(row) ss_row = TableRow() ss_cell = TableCell(align='center') ss_table.append(ss_row) ss_row.append(ss_cell) if not status: ss_cell.set('Screenshot unavailable') else: img = Image(src=screenshot, width='320', height='240') ss_cell.set(img) ss_update_row = TableRow() ss_update_cell = TableCell() ss_update_row.append(ss_update_cell) if status: anchor = Anchor('Update Screenshot', href=make_url('set_title_screenshot', name)) else: anchor = Anchor('Select Screenshot', href=make_url('set_title_screenshot', name)) ss_update_cell.set(anchor) ss_table.append(ss_update_row) return ss_table
def _make_filemanage_anchors(self, name, status): filemanage_anchors = Table() if not status: row = self._make_filemanage_anchor_row(name, 'Prepare game', 'prepare') filemanage_anchors.set(row) row = self._make_filemanage_anchor_row(name, 'Fresh install', 'prepare-fresh') filemanage_anchors.append(row) else: row = self._make_filemanage_anchor_row(name, 'Launch game', 'launch') filemanage_anchors.set(row) row = self._make_filemanage_anchor_row(name, 'Clean up game area', 'cleanup') filemanage_anchors.append(row) row = self._make_filemanage_anchor_row(name, 'Backup extra files', 'backup') filemanage_anchors.append(row) row = self._make_filemanage_anchor_row(name, 'Audit game', 'audit-install') filemanage_anchors.append(row) return filemanage_anchors
def make_weblinks_table(self): gamedata = self.gamedata name = gamedata['name'] tableatts = dict(class_='weblinkstable', width='100%', border=0, cellspacing=0) wl_table = Table(**tableatts) # setup header lbl = TableHeader('Web Links', colspan=0, align='center') row = TableRow(lbl) wl_table.set(row) weblinks = gamedata['weblinks'].keys() weblinks.sort() for weblink in weblinks: row = TableRow() # make a command url to tell the infobrowser # to launch a web browser with the real url # instead of using the game name we use the # site name here url = make_url('open_weblink', weblink) anchor = Anchor(weblink, href=url) cell = TableCell(anchor) row.append(cell) wl_table.append(row) return wl_table
def make_dosbox_data_table(self): gamedata = self.gamedata tableatts = dict(class_='dosboxdatatable', width='100%', border=0, cellspacing=0) dosbox_data_table = Table(**tableatts) # setup header dosbox_data_lbl = TableHeader('Dosbox data', colspan=0, align='center') dosbox_data_row = TableRow(dosbox_data_lbl) dosbox_data_table.set(dosbox_data_row) # setup dosboxpath dosboxpath_lbl = TableCell('dosbox path:') dosboxpath = TableCell(gamedata['dosboxpath']) dosboxpath_row = TableRow() dosboxpath_row.append(dosboxpath_lbl) dosboxpath_row.append(dosboxpath) dosbox_data_table.append(dosboxpath_row) # setup launchcmd launchcmd_lbl = TableCell('launch command:') launchcmd = TableCell(gamedata['launchcmd']) launchcmd_row = TableRow() launchcmd_row.append(launchcmd_lbl) launchcmd_row.append(launchcmd) dosbox_data_table.append(launchcmd_row) return dosbox_data_table