def __init__(self, title='[B]Box Score[/B]'): super(Score, self).__init__(title) #Geometry(Width, Height, Rows, Columns) #New Addon Windows always have 1280x720 grid #self.setGeometry(1280, 720, 27, 17) self.row_number = 7 self.hitting = [] self.pitching = [] #Create a psuedo background image #using the default skin's background image self.coverup = pyxbmct.Image(pyxbmct.Skin().background_img) self.placeControl(self.coverup, 5, 0, rowspan=self.row_number + 1, columnspan=24) # Connect a key action (Backspace) to close the window. self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
def init_stats(self): #create image to cover window to hide one team's stats #and show other team's stats over top of the image #background image = pyxbmct.Skin().background_img #Team2 data is created first #so we can place the coverup background img over it progress = xbmcgui.DialogProgressBG() progress.create("This might take a minute") self.team2header = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team2']['Name'], alignment=pyxbmct.ALIGN_CENTER) self.placeControl(self.team2header, 3, 0, columnspan=3) self.team2header.setVisible(False) self.team2.append(self.team2header) for i, player in enumerate( self.boxscore_obj['Team2']['Stats']['Players']): playerheader = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(playerheader) self.placeControl(playerheader, 4 + i, 0, columnspan=3) g2 = pyxbmct.Label('[B]%s[/B]' % player['G'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(g2) self.placeControl(g2, 4 + i, 3) a2 = pyxbmct.Label('[B]%s[/B]' % player['A'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(a2) self.placeControl(a2, 4 + i, 4) plusminus2 = pyxbmct.Label('[B]%s[/B]' % player['+/-'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(plusminus2) self.placeControl(plusminus2, 4 + i, 5) sog2 = pyxbmct.Label('[B] %s [/B]' % player['Sog'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(sog2) self.placeControl(sog2, 4 + i, 6) bs2 = pyxbmct.Label('[B]%s[/B]' % player['Bs'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(bs2) self.placeControl(bs2, 4 + i, 7) pim2 = pyxbmct.Label('[B]%s[/B]' % player['Pim'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(pim2) self.placeControl(pim2, 4 + i, 8) ht2 = pyxbmct.Label('[B]%s[/B]' % player['Ht'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(ht2) self.placeControl(ht2, 4 + i, 9) tk2 = pyxbmct.Label('[B]%s[/B]' % player['Tk'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(tk2) self.placeControl(tk2, 4 + i, 10) gv2 = pyxbmct.Label('[B]%s[/B]' % player['Gv'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(gv2) self.placeControl(gv2, 4 + i, 11) shf2 = pyxbmct.Label('[B]%s[/B]' % player['Shf'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(shf2) self.placeControl(shf2, 4 + i, 12) toi2 = pyxbmct.Label('[B]%s[/B]' % player['Tot'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(toi2) self.placeControl(toi2, 4 + i, 13) pp2 = pyxbmct.Label('[B]%s[/B]' % player['Pp'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(pp2) self.placeControl(pp2, 4 + i, 14) sh2 = pyxbmct.Label('[B]%s[/B]' % player['Sh'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(sh2) self.placeControl(sh2, 4 + i, 15) ev2 = pyxbmct.Label('[B]%s[/B]' % player['Ev'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(ev2) self.placeControl(ev2, 4 + i, 16) fw2 = pyxbmct.Label('[B]%s[/B]' % player['Fw'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(fw2) self.placeControl(fw2, 4 + i, 17) fl2 = pyxbmct.Label('[B]%s[/B]' % player['Fl'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(fl2) self.placeControl(fl2, 4 + i, 18) percent2 = pyxbmct.Label('[B]%s[/B]' % player['%'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(percent2) self.placeControl(percent2, 4 + i, 19) nextline = 5 + i #EXPERIMENTAL #Hide first row of values since #coverup leaves top of characters exposed for i in range(0, 19): self.team2[i].setVisible(False) team2totalsheader = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2totalsheader) self.placeControl(team2totalsheader, nextline, 0, columnspan=3) team2sog = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team2']['Stats']['Sog'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2sog) self.placeControl(team2sog, nextline, 6) team2pim = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team2']['Stats']['Pim'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2pim) self.placeControl(team2pim, nextline, 8) team2ht = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team2']['Stats']['Ht'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2ht) self.placeControl(team2ht, nextline, 9) team2tk = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team2']['Stats']['Tk'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2tk) self.placeControl(team2tk, nextline, 10) team2gv = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team2']['Stats']['Gv'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2gv) self.placeControl(team2gv, nextline, 11) team2fw = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team2']['Stats']['Fw'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2fw) self.placeControl(team2fw, nextline, 17) nextline += 2 team2scratchesheader = pyxbmct.Label('[B]Scratches[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2scratchesheader) self.placeControl(team2scratchesheader, nextline, 0, columnspan=3) nextline += 1 for s, scratch in enumerate( self.boxscore_obj['Team2']['Stats']['Scratches']): team2scratchedplayer = pyxbmct.Label( '[B]%s[/B]' % scratch, alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2scratchedplayer) self.placeControl(team2scratchedplayer, nextline + s, 0, columnspan=3) nextline -= 1 team2goaltending = pyxbmct.Label('[B]Goaltending[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltending) self.placeControl(team2goaltending, nextline, 4, columnspan=3) team2goaltendingsaheader = pyxbmct.Label( '[B]SA[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendingsaheader) self.placeControl(team2goaltendingsaheader, nextline, 7) team2goaltendinggaheader = pyxbmct.Label( '[B]GA[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendinggaheader) self.placeControl(team2goaltendinggaheader, nextline, 8) team2goaltendingsavesheader = pyxbmct.Label( '[B]Saves[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendingsavesheader) self.placeControl(team2goaltendingsavesheader, nextline, 9) team2goaltendingsavepercentheader = pyxbmct.Label( '[B]SV%[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendingsavepercentheader) self.placeControl(team2goaltendingsavepercentheader, nextline, 10) team2goaltendingtoiheader = pyxbmct.Label( '[B]TOI[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendingtoiheader) self.placeControl(team2goaltendingtoiheader, nextline, 11) team2ppsummary = pyxbmct.Label('[B]Power Play\nSummary[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2ppsummary) self.placeControl(team2ppsummary, nextline, 13, columnspan=2, rowspan=2) team2ppheader = pyxbmct.Label('[B]PPG / PPO[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2ppheader) self.placeControl(team2ppheader, nextline, 15, columnspan=2) tempval = '[B]%s of %s[/B]' % ( self.boxscore_obj['Team2']['Stats']['Powerplay']['Ppg'], self.boxscore_obj['Team2']['Stats']['Powerplay']['Ppo']) team2ppstats = pyxbmct.Label(tempval, alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2ppstats) self.placeControl(team2ppstats, nextline + 1, 15, columnspan=2) nextline += 1 for s, goalie in enumerate( self.boxscore_obj['Team2']['Stats']['Goaltending']): team2goaltending = pyxbmct.Label('[B]%s[/B]' % goalie['Name'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltending) self.placeControl(team2goaltending, nextline + s, 4, columnspan=3) team2goaltendingsaheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Sa'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendingsaheader) self.placeControl(team2goaltendingsaheader, nextline + s, 7) team2goaltendinggaheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Ga'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendinggaheader) self.placeControl(team2goaltendinggaheader, nextline + s, 8) team2goaltendingsavesheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Sv'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendingsavesheader) self.placeControl(team2goaltendingsavesheader, nextline + s, 9) team2goaltendingsavepercentheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Sv%'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendingsavepercentheader) self.placeControl(team2goaltendingsavepercentheader, nextline + s, 10) team2goaltendingtoiheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Tot'], alignment=pyxbmct.ALIGN_CENTER) self.team2.append(team2goaltendingtoiheader) self.placeControl(team2goaltendingtoiheader, nextline + s, 11) #EXPERIMENTAL #Create a psuedo background image #using the default skin's background image self.coverup = pyxbmct.Image(pyxbmct.Skin().background_img) self.placeControl(self.coverup, 4, 0, rowspan=self.row_number + 1, columnspan=20) #Now that we've covered up team2 stats #We can set up & show team1 stats progress.update(50, "Half-way there!") team1header = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team1']['Name'], alignment=pyxbmct.ALIGN_CENTER) self.placeControl(team1header, 3, 0, columnspan=3) self.team1.append(team1header) for i, player in enumerate( self.boxscore_obj['Team1']['Stats']['Players']): playerheader = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(playerheader) self.placeControl(playerheader, 4 + i, 0, columnspan=3) g1 = pyxbmct.Label('[B]%s[/B]' % player['G'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(g1) self.placeControl(g1, 4 + i, 3) a1 = pyxbmct.Label('[B]%s[/B]' % player['A'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(a1) self.placeControl(a1, 4 + i, 4) plusminus1 = pyxbmct.Label('[B]%s[/B]' % player['+/-'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(plusminus1) self.placeControl(plusminus1, 4 + i, 5) sog1 = pyxbmct.Label('[B] %s [/B]' % player['Sog'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(sog1) self.placeControl(sog1, 4 + i, 6) bs1 = pyxbmct.Label('[B]%s[/B]' % player['Bs'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(bs1) self.placeControl(bs1, 4 + i, 7) pim1 = pyxbmct.Label('[B]%s[/B]' % player['Pim'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(pim1) self.placeControl(pim1, 4 + i, 8) ht1 = pyxbmct.Label('[B]%s[/B]' % player['Ht'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(ht1) self.placeControl(ht1, 4 + i, 9) tk1 = pyxbmct.Label('[B]%s[/B]' % player['Tk'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(tk1) self.placeControl(tk1, 4 + i, 10) gv1 = pyxbmct.Label('[B]%s[/B]' % player['Gv'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(gv1) self.placeControl(gv1, 4 + i, 11) shf1 = pyxbmct.Label('[B]%s[/B]' % player['Shf'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(shf1) self.placeControl(shf1, 4 + i, 12) tot1 = pyxbmct.Label('[B]%s[/B]' % player['Tot'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(tot1) self.placeControl(tot1, 4 + i, 13) pp1 = pyxbmct.Label('[B]%s[/B]' % player['Pp'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(pp1) self.placeControl(pp1, 4 + i, 14) sh1 = pyxbmct.Label('[B]%s[/B]' % player['Sh'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(sh1) self.placeControl(sh1, 4 + i, 15) ev1 = pyxbmct.Label('[B]%s[/B]' % player['Ev'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(ev1) self.placeControl(ev1, 4 + i, 16) fw1 = pyxbmct.Label('[B]%s[/B]' % player['Fw'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(fw1) self.placeControl(fw1, 4 + i, 17) fl1 = pyxbmct.Label('[B]%s[/B]' % player['Fl'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(fl1) self.placeControl(fl1, 4 + i, 18) percent1 = pyxbmct.Label('[B]%s[/B]' % player['%'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(percent1) self.placeControl(percent1, 4 + i, 19) nextline = 5 + i #EXPERIMENTAL team1totalsheader = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1totalsheader) self.placeControl(team1totalsheader, nextline, 0, columnspan=3) team1sog = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team1']['Stats']['Sog'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1sog) self.placeControl(team1sog, nextline, 6) team1pim = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team1']['Stats']['Pim'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1pim) self.placeControl(team1pim, nextline, 8) team1ht = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team1']['Stats']['Ht'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1ht) self.placeControl(team1ht, nextline, 9) team1tk = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team1']['Stats']['Tk'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1tk) self.placeControl(team1tk, nextline, 10) team1gv = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team1']['Stats']['Gv'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1gv) self.placeControl(team1gv, nextline, 11) team1fw = pyxbmct.Label('[B]%s[/B]' % self.boxscore_obj['Team1']['Stats']['Fw'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1fw) self.placeControl(team1fw, nextline, 17) nextline += 2 team1scratchesheader = pyxbmct.Label('[B]Scratches[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1scratchesheader) self.placeControl(team1scratchesheader, nextline, 0, columnspan=3) nextline += 1 for s, scratch in enumerate( self.boxscore_obj['Team1']['Stats']['Scratches']): team1scratchedplayer = pyxbmct.Label( '[B]%s[/B]' % scratch, alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1scratchedplayer) self.placeControl(team1scratchedplayer, nextline + s, 0, columnspan=3) nextline -= 1 team1goaltending = pyxbmct.Label('[B]Goaltending[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltending) self.placeControl(team1goaltending, nextline, 4, columnspan=3) team1goaltendingsaheader = pyxbmct.Label( '[B]SA[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendingsaheader) self.placeControl(team1goaltendingsaheader, nextline, 7) team1goaltendinggaheader = pyxbmct.Label( '[B]GA[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendinggaheader) self.placeControl(team1goaltendinggaheader, nextline, 8) team1goaltendingsavesheader = pyxbmct.Label( '[B]Saves[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendingsavesheader) self.placeControl(team1goaltendingsavesheader, nextline, 9) team1goaltendingsavepercentheader = pyxbmct.Label( '[B]SV%[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendingsavepercentheader) self.placeControl(team1goaltendingsavepercentheader, nextline, 10) team1goaltendingtoiheader = pyxbmct.Label( '[B]TOI[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendingtoiheader) self.placeControl(team1goaltendingtoiheader, nextline, 11) team1ppsummary = pyxbmct.Label('[B]Power Play\nSummary[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1ppsummary) self.placeControl(team1ppsummary, nextline, 13, columnspan=2, rowspan=2) team1ppheader = pyxbmct.Label('[B]PPG / PPO[/B]', alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1ppheader) self.placeControl(team1ppheader, nextline, 15, columnspan=2) tempval = '%s of %s' % ( self.boxscore_obj['Team1']['Stats']['Powerplay']['Ppg'], self.boxscore_obj['Team1']['Stats']['Powerplay']['Ppo']) team1ppstats = pyxbmct.Label('[B]%s[/B]' % tempval, alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1ppstats) self.placeControl(team1ppstats, nextline + 1, 15, columnspan=2) nextline += 1 for s, goalie in enumerate( self.boxscore_obj['Team1']['Stats']['Goaltending']): team1goaltending = pyxbmct.Label('[B]%s[/B]' % goalie['Name'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltending) self.placeControl(team1goaltending, nextline + s, 4, columnspan=3) team1goaltendingsaheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Sa'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendingsaheader) self.placeControl(team1goaltendingsaheader, nextline + s, 7) team1goaltendinggaheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Ga'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendinggaheader) self.placeControl(team1goaltendinggaheader, nextline + s, 8) team1goaltendingsavesheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Sv'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendingsavesheader) self.placeControl(team1goaltendingsavesheader, nextline + s, 9) team1goaltendingsavepercentheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Sv%'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendingsavepercentheader) self.placeControl(team1goaltendingsavepercentheader, nextline + s, 10) team1goaltendingtoiheader = pyxbmct.Label( '[B]%s[/B]' % goalie['Tot'], alignment=pyxbmct.ALIGN_CENTER) self.team1.append(team1goaltendingtoiheader) self.placeControl(team1goaltendingtoiheader, nextline + s, 11) #EXPERIMENTAL progress.update(100, "Done") progress.close()
def init_stats(self): progress = xbmcgui.DialogProgressBG() progress.create("This might take a minute") team1pitchers = pyxbmct.Label('[B]Pitchers[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(team1pitchers) self.placeControl(team1pitchers, 6, 0, columnspan=2) ip1header = pyxbmct.Label('[B]IP[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(ip1header) self.placeControl(ip1header, 6, 2) ph1header = pyxbmct.Label('[B]H[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(ph1header) self.placeControl(ph1header, 6, 3) pr1header = pyxbmct.Label('[B]R[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pr1header) self.placeControl(pr1header, 6, 4) er1header = pyxbmct.Label('[B]ER[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(er1header) self.placeControl(er1header, 6, 5) pbb1header = pyxbmct.Label('[B]BB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pbb1header) self.placeControl(pbb1header, 6, 6) pk1header = pyxbmct.Label('[B]K[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pk1header) self.placeControl(pk1header, 6, 7) hr1header = pyxbmct.Label('[B]HR[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(hr1header) self.placeControl(hr1header, 6, 8) pcst1header = pyxbmct.Label('[B]PC-ST[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pcst1header) self.placeControl(pcst1header, 6, 9, columnspan=2) era1header = pyxbmct.Label('[B]ERA[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(era1header) self.placeControl(era1header, 6, 11) nextline = 0 t1pitches = 0 t1strikes = 0 t1ks = 0 for p, player in enumerate(self.boxscore_obj['Team1']['Stats']['Pitching']['Players']): player1name = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1name) self.placeControl(player1name, 7+p, 0, columnspan=2) player1ip = pyxbmct.Label('[B]%s[/B]' % player['IP'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1ip) self.placeControl(player1ip, 7+p, 2) player1h = pyxbmct.Label('[B]%s[/B]' % player['H'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1h) self.placeControl(player1h, 7+p, 3) player1r = pyxbmct.Label('[B]%s[/B]' % player['R'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1r) self.placeControl(player1r, 7+p, 4) player1er = pyxbmct.Label('[B]%s[/B]' % player['ER'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1er) self.placeControl(player1er, 7+p, 5) player1bb = pyxbmct.Label('[B]%s[/B]' % player['BB'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1bb) self.placeControl(player1bb, 7+p, 6) player1k = pyxbmct.Label('[B]%s[/B]' % player['K'], alignment=pyxbmct.ALIGN_CENTER) t1ks += int(player['K']) self.pitching.append(player1k) self.placeControl(player1k, 7+p, 7) player1hr = pyxbmct.Label('[B]%s[/B]' % player['HR'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1hr) self.placeControl(player1hr, 7+p, 8) player1pcst = pyxbmct.Label('[B]%s[/B]' % player['PC-ST'], alignment=pyxbmct.ALIGN_CENTER) t1pitches += int(player['PC-ST'].split('-')[0]) t1strikes += int(player['PC-ST'].split('-')[1]) self.pitching.append(player1pcst) self.placeControl(player1pcst, 7+p, 9, columnspan=2) era = player['ERA'] if len(era) > 4: era = era[:-1] player1era = pyxbmct.Label('[B]%s[/B]' % era, alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player1era) self.placeControl(player1era, 7+p, 11) nextline = 7+p+1 teamstats = self.boxscore_obj['Team1']['Stats']['Pitching'] pteam1lbl = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1lbl) self.placeControl(pteam1lbl, nextline, 0, columnspan=2) #pteam1ip = pyxbmct.Label('[B]%s[/B]' % teamstats['IP'], alignment=pyxbmct.ALIGN_CENTER) #self.pitching.append(pteam1ip) #self.placeControl(pteam1ip, nextline, 2) pteam1h = pyxbmct.Label('[B]%s[/B]' % teamstats['H'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1h) self.placeControl(pteam1h, nextline, 3) pteam1r = pyxbmct.Label('[B]%s[/B]' % teamstats['R'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1r) self.placeControl(pteam1r, nextline, 4) pteam1er = pyxbmct.Label('[B]%s[/B]' % teamstats['ER'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1er) self.placeControl(pteam1er, nextline, 5) pteam1bb = pyxbmct.Label('[B]%s[/B]' % teamstats['BB'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1bb) self.placeControl(pteam1bb, nextline, 6) pteam1k = pyxbmct.Label('[B]%s[/B]' % str(t1ks), alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1k) self.placeControl(pteam1k, nextline, 7) pteam1hr = pyxbmct.Label('[B]%s[/B]' % teamstats['HR'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1hr) self.placeControl(pteam1hr, nextline, 8) pteam1pcst = pyxbmct.Label('[B]%s-%s[/B]' % (str(t1pitches), str(t1strikes)), alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam1pcst) self.placeControl(pteam1pcst, nextline, 9, columnspan=2) nextline += 2 result = '[B]Pitching[/B]\n' pitchingextras = self.boxscore_obj['Team1']['Stats']['Pitching']['Extras'] for stat in pitchingextras.keys(): result += '[B]%s[/B]: \n %s\n' % (stat, pitchingextras[stat].replace('; ','\n ')) pextratextbox1 = pyxbmct.TextBox() whatsleft = self.row_number - nextline + 2 self.pitching.append(pextratextbox1) self.placeControl(pextratextbox1, nextline, 0, rowspan=whatsleft, columnspan=11) pextratextbox1.setText(result) pextratextbox1.autoScroll(3000, 2000, 2000) #Team 2 Pitching team2pitchers = pyxbmct.Label('[B]Pitchers[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(team2pitchers) self.placeControl(team2pitchers, 6, 12, columnspan=2) ip2header = pyxbmct.Label('[B]IP[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(ip2header) self.placeControl(ip2header, 6, 14) ph2header = pyxbmct.Label('[B]H[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(ph2header) self.placeControl(ph2header, 6, 15) pr2header = pyxbmct.Label('[B]R[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pr2header) self.placeControl(pr2header, 6, 16) er2header = pyxbmct.Label('[B]ER[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(er2header) self.placeControl(er2header, 6, 17) pbb2header = pyxbmct.Label('[B]BB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pbb2header) self.placeControl(pbb2header, 6, 18) pk2header = pyxbmct.Label('[B]K[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pk2header) self.placeControl(pk2header, 6, 19) hr2header = pyxbmct.Label('[B]HR[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(hr2header) self.placeControl(hr2header, 6, 20) pcst2header = pyxbmct.Label('[B]PC-ST[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pcst2header) self.placeControl(pcst2header, 6, 21, columnspan=2) era2header = pyxbmct.Label('[B]ERA[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(era2header) self.placeControl(era2header, 6, 23) nextline = 0 t2pitches = 0 t2strikes = 0 t2ks = 0 for p, player in enumerate(self.boxscore_obj['Team2']['Stats']['Pitching']['Players']): player2name = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2name) self.placeControl(player2name, 7+p, 12, columnspan=2) player2ip = pyxbmct.Label('[B]%s[/B]' % player['IP'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2ip) self.placeControl(player2ip, 7+p, 14) player2h = pyxbmct.Label('[B]%s[/B]' % player['H'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2h) self.placeControl(player2h, 7+p, 15) player2r = pyxbmct.Label('[B]%s[/B]' % player['R'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2r) self.placeControl(player2r, 7+p, 16) player2er = pyxbmct.Label('[B]%s[/B]' % player['ER'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2er) self.placeControl(player2er, 7+p, 17) player2bb = pyxbmct.Label('[B]%s[/B]' % player['BB'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2bb) self.placeControl(player2bb, 7+p, 18) player2k = pyxbmct.Label('[B]%s[/B]' % player['K'], alignment=pyxbmct.ALIGN_CENTER) t2ks += int(player['K']) self.pitching.append(player2k) self.placeControl(player2k, 7+p, 19) player2hr = pyxbmct.Label('[B]%s[/B]' % player['HR'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2hr) self.placeControl(player2hr, 7+p, 20) player2pcst = pyxbmct.Label('[B]%s[/B]' % player['PC-ST'], alignment=pyxbmct.ALIGN_CENTER) t2pitches += int(player['PC-ST'].split('-')[0]) t2strikes += int(player['PC-ST'].split('-')[1]) self.pitching.append(player2pcst) self.placeControl(player2pcst, 7+p, 21, columnspan=2) era = player['ERA'] if len(era) > 4: era = era[:-1] player2era = pyxbmct.Label('[B]%s[/B]' % era, alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(player2era) self.placeControl(player2era, 7+p, 23) nextline = 7+p+1 teamstats = self.boxscore_obj['Team2']['Stats']['Pitching'] pteam2lbl = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2lbl) self.placeControl(pteam2lbl, nextline, 12, columnspan=2) pteam2h = pyxbmct.Label('[B]%s[/B]' % teamstats['H'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2h) self.placeControl(pteam2h, nextline, 15) pteam2r = pyxbmct.Label('[B]%s[/B]' % teamstats['R'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2r) self.placeControl(pteam2r, nextline, 16) pteam2er = pyxbmct.Label('[B]%s[/B]' % teamstats['ER'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2er) self.placeControl(pteam2er, nextline, 17) pteam2bb = pyxbmct.Label('[B]%s[/B]' % teamstats['BB'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2bb) self.placeControl(pteam2bb, nextline, 18) pteam2k = pyxbmct.Label('[B]%s[/B]' % str(t2ks), alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2k) self.placeControl(pteam2k, nextline, 19) pteam2hr = pyxbmct.Label('[B]%s[/B]' % teamstats['HR'], alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2hr) self.placeControl(pteam2hr, nextline, 20) pteam2pcst = pyxbmct.Label('[B]%s-%s[/B]' % (str(t2pitches), str(t2strikes)), alignment=pyxbmct.ALIGN_CENTER) self.pitching.append(pteam2pcst) self.placeControl(pteam2pcst, nextline, 21, columnspan=2) nextline += 2 result = '[B]Pitching[/B]\n' pitchingextras = self.boxscore_obj['Team2']['Stats']['Pitching']['Extras'] for stat in pitchingextras.keys(): result += '[B]%s[/B]: \n %s\n' % (stat, pitchingextras[stat].replace('; ','\n ')) pextratextbox2 = pyxbmct.TextBox() whatsleft = self.row_number - nextline + 2 self.pitching.append(pextratextbox2) self.placeControl(pextratextbox2, nextline, 12, rowspan=whatsleft, columnspan=11) pextratextbox2.setText(result) pextratextbox2.autoScroll(3000, 2000, 2000) #Create a psuedo background image #using the default skin's background image self.coverup = pyxbmct.Image(pyxbmct.Skin().background_img) self.placeControl(self.coverup, 5, 0, rowspan=self.row_number+1, columnspan=24) #Now that we've covered up pitching stats #We can set up & show hitting stats progress.update(50, "Half-way there!") team1hitters = pyxbmct.Label('[B]Hitters[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1hitters) self.placeControl(team1hitters, 6, 0, columnspan=3) ab1header = pyxbmct.Label('[B]AB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(ab1header) self.placeControl(ab1header, 6, 3) r1header = pyxbmct.Label('[B]R[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(r1header) self.placeControl(r1header, 6, 4) h1header = pyxbmct.Label('[B]H[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(h1header) self.placeControl(h1header, 6, 5) rbi1header = pyxbmct.Label('[B]RBI[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(rbi1header) self.placeControl(rbi1header, 6, 6) bb1header = pyxbmct.Label('[B]BB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(bb1header) self.placeControl(bb1header, 6, 7) k1header = pyxbmct.Label('[B]K[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(k1header) self.placeControl(k1header, 6, 8) avg1header = pyxbmct.Label('[B]AVG[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(avg1header) self.placeControl(avg1header, 6, 9) obp1header = pyxbmct.Label('[B]OBP[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(obp1header) self.placeControl(obp1header, 6, 10) slg1header = pyxbmct.Label('[B]SLG[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(slg1header) self.placeControl(slg1header, 6, 11) nextline = 0 for p, player in enumerate(self.boxscore_obj['Team1']['Stats']['Hitting']['Players']): player1name = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1name) self.placeControl(player1name, 7+p, 0, columnspan=3) player1ab = pyxbmct.Label('[B]%s[/B]' % player['AB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1ab) self.placeControl(player1ab, 7+p, 3) player1r = pyxbmct.Label('[B]%s[/B]' % player['R'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1r) self.placeControl(player1r, 7+p, 4) player1h = pyxbmct.Label('[B]%s[/B]' % player['H'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1h) self.placeControl(player1h, 7+p, 5) player1rbi = pyxbmct.Label('[B]%s[/B]' % player['RBI'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1rbi) self.placeControl(player1rbi, 7+p, 6) player1bb = pyxbmct.Label('[B]%s[/B]' % player['BB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1bb) self.placeControl(player1bb, 7+p, 7) player1k = pyxbmct.Label('[B]%s[/B]' % player['K'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1k) self.placeControl(player1k, 7+p, 8) player1avg = pyxbmct.Label('[B]%s[/B]' % player['AVG'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1avg) self.placeControl(player1avg, 7+p, 9) player1obp = pyxbmct.Label('[B]%s[/B]' % player['OBP'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1obp) self.placeControl(player1obp, 7+p, 10) slg = player['SLG'] if len(slg) > 4: slg = slg[:-1] player1slg = pyxbmct.Label('[B]%s[/B]' % slg, alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player1slg) self.placeControl(player1slg, 7+p, 11) nextline = 7+p+1 teamstats = self.boxscore_obj['Team1']['Stats']['Hitting'] team1lbl = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1lbl) self.placeControl(team1lbl, nextline, 0, columnspan=3) team1ab = pyxbmct.Label('[B]%s[/B]' % teamstats['AB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1ab) self.placeControl(team1ab, nextline, 3) team1r = pyxbmct.Label('[B]%s[/B]' % teamstats['R'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1r) self.placeControl(team1r, nextline, 4) team1h = pyxbmct.Label('[B]%s[/B]' % teamstats['H'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1h) self.placeControl(team1h, nextline, 5) team1rbi = pyxbmct.Label('[B]%s[/B]' % teamstats['RBI'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1rbi) self.placeControl(team1rbi, nextline, 6) team1bb = pyxbmct.Label('[B]%s[/B]' % teamstats['BB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1bb) self.placeControl(team1bb, nextline, 7) team1k = pyxbmct.Label('[B]%s[/B]' % teamstats['K'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1k) self.placeControl(team1k, nextline, 8) team1avg = pyxbmct.Label('[B]%s[/B]' % teamstats['AVG'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team1avg) self.placeControl(team1avg, nextline, 9) nextline += 2 result = '[B]Batting[/B]\n' battingextras = self.boxscore_obj['Team1']['Stats']['Hitting']['Extras'] for stat in battingextras.keys(): result += '[B]%s[/B]: %s\n' % (stat, battingextras[stat]) result += '\n[B]Fielding[/B]\n' fieldingextras = self.boxscore_obj['Team1']['Stats']['Fielding'] for stat in fieldingextras.keys(): result += '[B]%s[/B]: %s\n' % (stat, fieldingextras[stat]) extratextbox1 = pyxbmct.TextBox() whatsleft = self.row_number - nextline + 2 self.hitting.append(extratextbox1) self.placeControl(extratextbox1, nextline, 0, rowspan=whatsleft, columnspan=11) extratextbox1.setText(result) extratextbox1.autoScroll(3000, 2000, 2000) #Start Team2 team2hitters = pyxbmct.Label('[B]Hitters[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2hitters) self.placeControl(team2hitters, 6, 12, columnspan=3) ab2header = pyxbmct.Label('[B]AB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(ab2header) self.placeControl(ab2header, 6, 15) r2header = pyxbmct.Label('[B]R[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(r2header) self.placeControl(r2header, 6, 16) h2header = pyxbmct.Label('[B]H[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(h2header) self.placeControl(h2header, 6, 17) rbi2header = pyxbmct.Label('[B]RBI[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(rbi2header) self.placeControl(rbi2header, 6, 18) bb2header = pyxbmct.Label('[B]BB[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(bb2header) self.placeControl(bb2header, 6, 19) k2header = pyxbmct.Label('[B]K[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(k2header) self.placeControl(k2header, 6, 20) avg2header = pyxbmct.Label('[B]AVG[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(avg2header) self.placeControl(avg2header, 6, 21) obp2header = pyxbmct.Label('[B]OBP[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(obp2header) self.placeControl(obp2header, 6, 22) slg2header = pyxbmct.Label('[B]SLG[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(slg2header) self.placeControl(slg2header, 6, 23) nextline = 0 for p, player in enumerate(self.boxscore_obj['Team2']['Stats']['Hitting']['Players']): player2name = pyxbmct.Label('[B]%s[/B]' % player['Name'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2name) self.placeControl(player2name, 7+p, 12, columnspan=3) player2ab = pyxbmct.Label('[B]%s[/B]' % player['AB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2ab) self.placeControl(player2ab, 7+p, 15) player2r = pyxbmct.Label('[B]%s[/B]' % player['R'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2r) self.placeControl(player2r, 7+p, 16) player2h = pyxbmct.Label('[B]%s[/B]' % player['H'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2h) self.placeControl(player2h, 7+p, 17) player2rbi = pyxbmct.Label('[B]%s[/B]' % player['RBI'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2rbi) self.placeControl(player2rbi, 7+p, 18) player2bb = pyxbmct.Label('[B]%s[/B]' % player['BB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2bb) self.placeControl(player2bb, 7+p, 19) player2k = pyxbmct.Label('[B]%s[/B]' % player['K'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2k) self.placeControl(player2k, 7+p, 20) player2avg = pyxbmct.Label('[B]%s[/B]' % player['AVG'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2avg) self.placeControl(player2avg, 7+p, 21) player2obp = pyxbmct.Label('[B]%s[/B]' % player['OBP'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2obp) self.placeControl(player2obp, 7+p, 22) slg = player['SLG'] if len(slg) > 4: slg = slg[:-1] player2slg = pyxbmct.Label('[B]%s[/B]' % slg, alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(player2slg) self.placeControl(player2slg, 7+p, 23) nextline = 7+p+1 teamstats = self.boxscore_obj['Team2']['Stats']['Hitting'] team2lbl = pyxbmct.Label('[B]Team[/B]', alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2lbl) self.placeControl(team2lbl, nextline, 12, columnspan=3) team2ab = pyxbmct.Label('[B]%s[/B]' % teamstats['AB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2ab) self.placeControl(team2ab, nextline, 15) team2r = pyxbmct.Label('[B]%s[/B]' % teamstats['R'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2r) self.placeControl(team2r, nextline, 16) team2h = pyxbmct.Label('[B]%s[/B]' % teamstats['H'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2h) self.placeControl(team2h, nextline, 17) team2rbi = pyxbmct.Label('[B]%s[/B]' % teamstats['RBI'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2rbi) self.placeControl(team2rbi, nextline, 18) team2bb = pyxbmct.Label('[B]%s[/B]' % teamstats['BB'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2bb) self.placeControl(team2bb, nextline, 19) team2k = pyxbmct.Label('[B]%s[/B]' % teamstats['K'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2k) self.placeControl(team2k, nextline, 20) team2avg = pyxbmct.Label('[B]%s[/B]' % teamstats['AVG'], alignment=pyxbmct.ALIGN_CENTER) self.hitting.append(team2avg) self.placeControl(team2avg, nextline, 21) nextline += 2 result = '[B]Batting[/B]\n' battingextras = self.boxscore_obj['Team2']['Stats']['Hitting']['Extras'] for stat in battingextras.keys(): result += '[B]%s[/B]: %s\n' % (stat, battingextras[stat]) result += '\n[B]Fielding[/B]\n' fieldingextras = self.boxscore_obj['Team2']['Stats']['Fielding'] for stat in fieldingextras.keys(): result += '[B]%s[/B]: %s\n' % (stat, fieldingextras[stat]) extratextbox2 = pyxbmct.TextBox() whatsleft = self.row_number - nextline + 2 self.hitting.append(extratextbox2) self.placeControl(extratextbox2, nextline, 12, rowspan=whatsleft, columnspan=11) extratextbox2.setText(result) extratextbox2.autoScroll(3000, 2000, 2000) progress.update(100, "Done") progress.close()
# PyXBMCt is a mini-framework for creating Kodi (XBMC) Python addons # with arbitrary UI made of Controls - decendants of xbmcgui.Control class. # The framework uses image textures from Kodi Confluence skin. # # Licence: GPL v.3 <http://www.gnu.org/licenses/gpl.html> """ This test case is for pyxbmct.AddonFullWindow and pyxbmct.AddonDialogWindow. One test case is used for both classes as they are so similar as they only differ visually. """ import unittest2 import mock import itertools import pyxbmct skin = pyxbmct.Skin() class TestGroup(unittest2.TestCase): """ This test case is for pyxbmct.AddonFullWindow and pyxbmct.AddonDialogWindow """ def setUp(self): window_rows = 4 window_columns = 4 window_width = 1280 window_height = 720 self._window = pyxbmct.AddonFullWindow() self._window.getWidth = mock.MagicMock(return_value=window_width)