Ejemplo n.º 1
0
 def _make_smallinfo(self, info):
     infotable = Table()
     infotable.append(TableRow(TableHeader('Small Information', colspan=2)))
     for k, v in info.items():
         row = TableRow()
         cell = TableCell('%s:' % k.capitalize())
         row.set(cell)
         cell = TableCell(v)
         row.append(cell)
         infotable.append(row)
     self.maintable.append(TableRow(TableCell(infotable)))
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
    def make_action_table(self, name):
        atable = Table(class_='ActionTable')
        available_row = TableRow()
        status = self.filehandler.get_game_status(name)
        align = dict(valign='center', align='center')
        if status:
            available_cell = TableCell(Bold('available'), bgcolor='DarkSeaGreen4', **align)
        else:
            available_cell = TableCell(Bold('unavailable'), bgcolor='Red', **align)
        filemanage_anchors = self._make_filemanage_anchors(name, status)
        filemanage_cell = TableCell(filemanage_anchors)

        available_row.append(available_cell)
        available_row.append(filemanage_cell)
        atable.append(available_row)
        edit_row = TableRow()
        edit_anchor = Anchor("edit this game's data", href=make_url('edit', name))
        edit_row.append(TableCell(edit_anchor))
        atable.append(edit_row)
        return atable
Ejemplo n.º 4
0
    def make_action_table(self, name):
        atable = Table(class_='ActionTable')
        available_row = TableRow()
        status = self.filehandler.get_game_status(name)
        align = dict(valign='center', align='center')
        if status:
            available_cell = TableCell(Bold('available'), bgcolor='DarkSeaGreen4', **align)
        else:
            available_cell = TableCell(Bold('unavailable'), bgcolor='Red', **align)
        filemanage_anchors = Paragraph()
        if not status:
            filemanage_anchor = Anchor('prepare game', href=make_url('prepare', name))
            filemanage_anchors.append(filemanage_anchor)
            filemanage_anchors.append(Break())
            filemanage_anchor = Anchor('prepare game as fresh install',
                                       href=make_url('prepare-fresh', name))
            filemanage_anchors.append(filemanage_anchor)
            
        else:
            filemanage_anchor = Anchor('clean up game area', href=make_url('cleanup', name))
            filemanage_anchors.append(filemanage_anchor)
            filemanage_anchors.append(Break())
            filemanage_anchors.append(Break())
            filemanage_anchor = Anchor('backup extra files', href=make_url('backup', name))
            filemanage_anchors.append(filemanage_anchor)
            filemanage_anchors.append(Break())
            filemanage_anchors.append(Break())
            filemanage_anchor = Anchor('Audit game from fresh install',
                                       href=make_url('audit-install', name))
            filemanage_anchors.append(filemanage_anchor)
        filemanage_cell = TableCell(filemanage_anchors)

        available_row.append(available_cell)
        available_row.append(filemanage_cell)
        atable.append(available_row)
        edit_row = TableRow()
        edit_anchor = Anchor("edit this game's data", href=make_url('edit', name))
        edit_row.append(TableCell(edit_anchor))
        atable.append(edit_row)
        return atable
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
0
 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