def __init__( self, theme ): self.theme = 2 self.currentImage = -1 self.nextImage = 0 self.fadeTime = 2900 self.lobbyControlAlign = CENTER self.lobbyControlFont = 'font' self.lobbyControlImgPos = ( .5, .55 ) self.lobbyControlImgScale = .15 self.lobbyControlPos = ( .5, .15 ) self.lobbyControlScale = .0015 self.lobbyDisabledColor = ( .6, .6, .6 ) self.lobbyGameModeAlign = CENTER self.lobbyGameModeColor = Theme.hexToColor( '#2891a6' ) self.lobbyGameModeFont = 'font' self.lobbyGameModePos = ( .115, .715 ) self.lobbyGameModeScale = .0015 self.lobbyHeaderColor = Theme.hexToColor( '#2891a6' ) self.lobbyKeyboardImgPos = ( .8, .95 ) self.lobbyKeyboardImgScale = .1 self.lobbyOptionAlign = CENTER self.lobbyOptionColor = Theme.hexToColor( '#2891a6' ) self.lobbyOptionFont = 'font' self.lobbyOptionPos = ( .5, .26 ) self.lobbyOptionScale = .0015 self.lobbyOptionSpace = .035 self.lobbyPanelAvatarDimension = ( 0, 0 ) self.lobbyPanelNameAlign = LEFT self.lobbyPanelNameFont = 'font' self.lobbyPanelNamePos = ( 0, 0 ) self.lobbyPanelNameScale = .1 self.lobbyPanelPos = ( .1, .24 ) self.lobbyPanelSize = ( .15, .53 ) self.lobbyPanelSpacing = .215 self.lobbyPartPos = ( .5, .84 ) self.lobbyPartScale = .094 self.lobbySaveCharAlign = CENTER self.lobbySaveCharColor = Theme.hexToColor( '#2891a6' ) self.lobbySaveCharFont = 'font' self.lobbySaveCharScale = .0015 self.lobbySelectedColor = Theme.hexToColor( '#ffffff' ) self.lobbySelectLength = 4 self.lobbySubtitleText = _( 'CHOOSE YOUR CHARACTER' ) self.lobbySubtitleTextAlign = CENTER self.lobbySubtitleTextFont = 'font' self.lobbySubtitleTextPos = ( .5, .715 ) self.lobbySubtitleTextScale = .00098 self.lobbyTitleText = _( 'LOBBY -' ) self.lobbyTitleTextAlign = CENTER self.lobbyTitleTextFont = 'font' self.lobbyTitleTextPos = ( .05, .715 ) self.lobbyTitleTextScale = .0015
def __init__( self, theme ): self.theme = theme self.partDiffControlAlign = LEFT self.partDiffControlFont = 'font' self.partDiffControlPos = ( .25, .25 ) self.partDiffControlScale = .0015 self.partDiffGameModeAlign = LEFT self.partDiffGameModeColor = Theme.hexToColor( '#2891a6' ) self.partDiffGameModeFont = 'font' self.partDiffGameModePos = ( -5, 0 ) self.partDiffGameModeScale = .0015 self.partDiffHeaderColor = Theme.hexToColor( '#000000' ) self.partDiffKeyboardImgPos = ( 0, 0 ) self.partDiffKeyboardImgScale = .1 self.partDiffOptionAlign = LEFT self.partDiffOptionColor = Theme.hexToColor( '#2891a6' ) self.partDiffOptionFont = 'font' self.partDiffOptionPos = ( 0, 1 ) self.partDiffOptionScale = .0015 self.partDiffOptionSpace = 0 self.partDiffPanelNameAlign = LEFT self.partDiffPanelNameFont = 'font' self.partDiffPanelNamePos = ( 0, 0 ) self.partDiffPanelNameScale = .001 self.partDiffPanelPos = ( .05, .05 ) self.partDiffPanelSize = ( .05, .1 ) self.partDiffPanelSpacing = .24 # PART ICON self.partDiffPartPos = ( -0.352, 0 ) self.partDiffPartScale = .035 self.partDiffSelectedColor = Theme.hexToColor( '#ffffff' ) self.partDiffSubtitleText = _( ' ' ) self.partDiffSubtitleTextAlign = LEFT self.partDiffSubtitleTextFont = 'font' self.partDiffSubtitleTextPos = ( .5, .15 ) self.partDiffSubtitleTextScale = .0015 self.partDiffTitleText = _( 'SELECT PART+DIFFICULTY' ) self.partDiffTitleTextAlign = LEFT self.partDiffTitleTextFont = 'font' self.partDiffTitleTextPos = ( .5, .95 ) self.partDiffTitleTextScale = .002
def renderForeground( self, scene ): font = scene.fontDict['songListFont'] ( w, h ) = scene.geometry font = scene.fontDict['songListFont'] ( c1, c2, c3 ) = self.song_sort_color glColor3f( c1, c2, c3 ) text = _( 'SORTED BY' ) + ' ' if scene.sortOrder == 0: text = text + ( 'SONG NAME' ) elif scene.sortOrder == 1: text = text + ( 'ARTIST' ) elif scene.sortOrder == 2: text = text + ( 'PLAY COUNT' ) elif scene.sortOrder == 3: text = text + ( 'ALBUM NAME' ) elif scene.sortOrder == 4: text = text + ( 'GENRE' ) elif scene.sortOrder == 5: text = text + ( 'YEAR' ) elif scene.sortOrder == 6: text = text + ( 'BAND DIFFICULTY' ) elif scene.sortOrder == 7: text = text + ( 'INSTRUMENT DIFFICULTY' ) else: text = text + ( 'SONG COLLECTION' ) font.render( text, ( .18, .106 ), scale = 0.0015 ) scene.drawImage(scene.img_6thlayer, scale = (1.0, -1.0), coord = (w/2,h/2), stretched = 3) if scene.searching: font.render( scene.searchText, ( .5, .7 ), align = 1 )
def renderUnselectedItem(self, scene, i, n): ( w, h ) = scene.geometry font = scene.fontDict['songListFont'] font = scene.fontDict['songListFont'] if not scene.items or scene.itemIcons is None: return item = scene.items[i] if scene.img_tier: imgwidth = scene.img_tier.width1() imgheight = scene.img_tier.height1() wfactor = 1160.0/imgwidth hfactor = 60.00/imgheight if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo): scene.drawImage(scene.img_tier, scale = (wfactor,-hfactor), coord = (w/2.8762, ((-n*.0565)*h )+ h/1.235), stretched = 11) icon = None if isinstance( item, Song.LibraryInfo ): try: icon = scene.itemIcons['Library'] wfactor = 0.02 scene.drawImage( icon, scale = ( wfactor, -wfactor ), coord = ( w / 1.025, h - 0.055 * h * ( n + 1 ) - 0.2 * h ), stretched = 11 ) except KeyError: pass elif isinstance( item, Song.RandomSongInfo ): try: icon = scene.itemIcons['Random'] wfactor = 0.02 scene.drawImage( icon, scale = ( wfactor, -wfactor ), coord = ( w / 1.025, h - 0.055 * h * ( n + 1 ) - 0.2 * h ), stretched = 11 ) except KeyError: pass if isinstance( item, Song.SongInfo ) or isinstance( item, Song.LibraryInfo ): ( c1, c2, c3 ) = self.song_name_text_color glColor4f( c1, c2, c3, 1 ) elif isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ): ( c1, c2, c3 ) = self.career_title_color glColor4f( c1, c2, c3, 1 ) elif isinstance( item, Song.RandomSongInfo ): ( c1, c2, c3 ) = self.song_name_text_color glColor4f( c1, c2, c3, 1 ) text = item.name if isinstance( item, Song.SongInfo ) and item.getLocked(): text = _( '-- Locked --' ) maxwidth = .43 scale = 0.0016 ( wt, ht ) = font.getStringSize( text, scale = scale ) while wt > maxwidth: tlength = len( text ) - 2 text = text[:tlength] + '...' ( wt, ht ) = font.getStringSize( text, scale = scale ) if wt < maxwidth: break font.render( text, ( .07, .043 * ( n + 1 ) + .098 ), scale = scale ) if isinstance( item, Song.SongInfo ): score = _( "Nil" ) stars = 0 name = "" if not item.getLocked(): try: difficulties = item.partDifficulties[scene.scorePart.id] except KeyError: difficulties = [] for d in difficulties: if d.id == scene.scoreDifficulty.id: scores = item.getHighscores( d, part = scene.scorePart ) if scores: ( score, stars, name, scoreExt ) = scores[0] try: ( notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore, ) = scoreExt except ValueError: ( notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2, ) = scoreExt break else: ( score, stars, name ) = ( 0, 0, '---' ) if score == _( 'Nil' ) and scene.nilShowNextScore: for d in difficulties: scores = item.getHighscores( d, part = scene.scorePart ) if scores: ( score, stars, name, scoreExt ) = scores[0] try: ( notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore, ) = scoreExt except ValueError: ( notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2, ) = scoreExt break else: ( score, stars, name ) = ( 0, 0, '---' ) else: ( score, stars, name ) = ( _( 'Nil' ), 0, '---' ) scale = 0.0010 if score != _( 'Nil' ) and score > 0 \ and notesTotal != 0: text = '%.1f%%' % (float( notesHit ) / notesTotal * 100.0) font.render( text, ( 0.56, .043 * ( n + 1 ) + .098 ), scale = scale, align = 2 ) if scene.img_starwhite and scene.img_stargold: imgwidth = scene.img_starwhite.width1() wfactor1 = 2.0 / imgwidth if stars == 6: for k in range( 0, 5 ): scene.drawImage( scene.img_stargold, scale = ( wfactor1 * 1.2, -wfactor1 * 1.2), coord = ( ( .58 + .025 * k ) * w, ((-n*.0565)*h )+ h/1.235), stretched = 11 ) else: for k in range( 0, stars ): scene.drawImage( scene.img_starwhite, scale = ( wfactor1 * 1.2, -wfactor1 * 1.2), coord = ( ( .58 + .025 * k ) * w, ((-n*.0565)*h )+ h/1.235), stretched = 11 )
def renderMoreInfo( self, scene ): if not scene.items: return if not scene.selectedItem: return item = scene.selectedItem i = scene.selectedIndex y = 0 ( w, h ) = scene.geometry font = scene.fontDict['songListFont'] self.theme.fadeScreen( .25 ) if scene.moreInfoTime < 500: y = 1.0 - float( scene.moreInfoTime ) / 500.0 yI = y * h if scene.img_panel: scene.drawImage( scene.img_panel, scale = ( 1.0, -1.0 ), coord = ( w * .5, h * .5 + yI ), stretched = 0 ) if scene.img_tabs: r0 = ( 0, 1.0 / 3.0, 0, .5 ) r1 = ( 1.0 / 3.0, 2.0 / 3.0, 0, .5 ) r2 = ( 2.0 / 3.0, 1.0, 0, .5 ) if scene.infoPage == 0: r0 = ( 0, 1.0 / 3.0, .5, 1.0 ) scene.drawImage( scene.img_tab1, scale = ( .5, -.5 ), coord = ( w * .5, h * .5 + yI ) ) text = item.name if item.artist != '': text += ' by %s' % item.artist if item.year != '': text += ' (%s)' % item.year scale = font.scaleText( text, .08, 0.00160001 ) font.render( text, ( .08, .25 - y ), scale = scale, align = 1 ) if scene.itemLabels[i]: imgwidth = scene.itemLabels[i].width1() wfactor = 75.000 / imgwidth scene.drawImage( scene.itemLabels[i], ( wfactor, - wfactor ), ( w * .375, h * .5 + yI ), stretched = 11 ) elif scene.img_empty_label: imgwidth = scene.img_empty_label.width1() wfactor = 75.000 / imgwidth scene.drawImage( scene.img_empty_label, ( wfactor, - wfactor ), ( w * .375, h * .5 + yI ), stretched = 11 ) text = item.album if text == '': text = _( 'No Album' ) scale = font.scaleText( text, 0.2, 0.0016 ) font.render( text, ( .56, .305 - y ), scale = scale ) text = item.genre if text == '': text = _( 'No Genre' ) scale = font.scaleText( text, 0.2, 0.0016 ) font.render( text, ( .56, .35 - y ), scale = scale ) elif scene.infoPage == 1: r1 = ( 1.0 / 3.0, 2.0 / 3.0, .5, 1.0 ) scene.drawImage( scene.img_tab2, scale = ( .5, -.5 ), coord = ( w * .5, h * .5 + yI ) ) elif scene.infoPage == 2: r2 = ( 2.0 / 3.0, 1.0, .5, 1.0 ) scene.drawImage( scene.img_tab3, scale = ( .5, -.5 ), coord = ( w * .5, h * .5 + yI ) ) scene.drawImage( scene.img_tabs, scale = ( .5 * ( 1.0 / 3.0 ), - .25 ), coord = ( w * .36, h * .72 + yI ), rect = r0 ) scene.drawImage( scene.img_tabs, scale = ( .5 * ( 1.0 / 3.0 ), - .25 ), coord = ( w * .51, h * .72 + yI ), rect = r1 ) scene.drawImage( scene.img_tabs, scale = ( .5 * ( 1.0 / 3.0 ), - .25 ), coord = ( w * .66, h * .72 + yI ), rect = r2 )
def renderSelectedItem( self, scene, n ): ( w, h ) = scene.geometry font = scene.fontDict['songListFont'] item = scene.selectedItem if not item: return if isinstance( item, Song.BlankSpaceInfo ): return if scene.img_tier: imgwidth = scene.img_tier.width1() imgheight = scene.img_tier.height1() wfactor = 1160.0/imgwidth hfactor = 60.00/imgheight if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo): scene.drawImage(scene.img_tier, scale = (wfactor,-hfactor), coord = (w/2.8762, ((-n*.0565)*h )+ h/1.235), stretched = 11) if scene.img_selected: imgwidth = scene.img_selected.width1() imgheight = scene.img_selected.height1() wfactor = 1160.0/imgwidth hfactor = 60.00/imgheight scene.drawImage(scene.img_selected, scale = (wfactor,-hfactor), coord = (w/2.8762, ((-n*.0565)*h )+ h/1.235), stretched = 11) icon = None if isinstance( item, Song.SongInfo ) and scene.practiceMode: ( c1, c2, c3 ) = self.song_name_selected_color glColor3f( c1, c2, c3 ) text = _( 'Practice' ) elif isinstance( item, Song.LibraryInfo ): ( c1, c2, c3 ) = self.library_selected_color glColor3f( c1, c2, c3 ) if item.songCount == 1: text = _( 'There Is 1 Song In This Setlist.' ) elif item.songCount > 1: text = _( 'There Are %d Songs In This Setlist.' ) % item.songCount else: text = '' else: text = '' font.render( text, ( 0.05, .155 ), scale = 0.0015, align = 2 ) if isinstance( item, Song.SongInfo ) or isinstance( item, Song.LibraryInfo ) or isinstance( item, Song.RandomSongInfo ): ( c1, c2, c3 ) = self.song_name_selected_color glColor4f( c1, c2, c3, 1 ) if isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ): ( c1, c2, c3 ) = self.career_title_color glColor4f( c1, c2, c3, 1 ) text = item.name maxwidth = .43 scale = 0.0016 ( wt, ht ) = font.getStringSize( text, scale = scale ) while wt > maxwidth: tlength = len( text ) - 2 text = text[:tlength] + '...' ( wt, ht ) = font.getStringSize( text, scale = scale ) if wt < maxwidth: break font.render( text, ( .07, .043 * ( n + 1 ) + .098 ), scale = scale ) if isinstance( item, Song.SongInfo ): score = _( "Nil" ) stars = 0 name = "" if not item.getLocked(): try: difficulties = item.partDifficulties[scene.scorePart.id] except KeyError: difficulties = [] for d in difficulties: if d.id == scene.scoreDifficulty.id: scores = item.getHighscores( d, part = scene.scorePart ) if scores: ( score, stars, name, scoreExt ) = scores[0] try: ( notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore, ) = scoreExt except ValueError: ( notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2, ) = scoreExt break else: ( score, stars, name ) = ( 0, 0, '---' ) if score == _( 'Nil' ) and scene.nilShowNextScore: for d in difficulties: scores = item.getHighscores( d, part = scene.scorePart ) if scores: ( score, stars, name, scoreExt ) = scores[0] try: ( notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore, ) = scoreExt except ValueError: ( notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2, ) = scoreExt break else: ( score, stars, name ) = ( 0, 0, '---' ) else: ( score, stars, name ) = ( _( 'Nil' ), 0, '---' ) scale = 0.0010 if score != _( 'Nil' ) and score > 0 and notesTotal != 0: text = '%.1f%%' % ( float( notesHit ) / notesTotal * 100.0) ( w, h ) = font.getStringSize( text, scale = scale ) font.render( text, ( 0.56, .043 * ( n + 1 ) + .098 ), scale = scale, align = 2 ) if scene.img_starwhite and scene.img_stargold: ( w, h ) = scene.geometry imgwidth = scene.img_starwhite.width1() wfactor1 = 2.0 / imgwidth if stars == 6: for k in range( 0, 5 ): scene.drawImage( scene.img_stargold, scale = ( wfactor1 * 1.2, -wfactor1 * 1.2), coord = ( ( .58 + .025 * k ) * w, ((-n*.0565)*h )+ h/1.235), stretched = 11 ) else: for k in range( 0, stars ): scene.drawImage( scene.img_starwhite, scale = ( wfactor1 * 1.2, -wfactor1 * 1.2), coord = ( ( .58 + .025 * k ) * w, ((-n*.0565)*h )+ h/1.235), stretched = 11 )
def renderSelectedInfo(self, scene): if not scene.selectedItem: return font = scene.engine.data.font screenw, screenh = scene.engine.view.geometry[2:4] v = 0 try: lfont = scene.engine.data.lfont except: lfont = font # here we reset the rendering... without pushing the matrices. (they be thar) # (otherwise copying engine.view.setOrthogonalProjection) glMatrixMode(GL_PROJECTION) glLoadIdentity() viewport = glGetIntegerv(GL_VIEWPORT) w = viewport[2] - viewport[0] h = viewport[3] - viewport[1] h *= (float(w) / float(h)) / (4.0 / 3.0) glOrtho(0, 1, h/w, 0, -100, 100) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glEnable(GL_COLOR_MATERIAL) self.theme.setBaseColor(1) if scene.songLoader: font.render(_("Loading Preview..."), (.05, .7), scale = 0.001) #x = .6 x = self.song_cdscore_xpos y = .15 self.theme.setSelectedColor(1) c1,c2,c3 = self.song_name_selected_color glColor3f(c1,c2,c3) item = scene.selectedItem angle = scene.itemRenderAngles[scene.selectedIndex] f = ((90.0 - angle) / 90.0) ** 2 cText = item.name if (isinstance(item, Song.SongInfo) and item.getLocked()): cText = _("-- Locked --") fh = lfont.getHeight()*0.0016 lfont.render(cText, (x, y), scale = 0.0016) if isinstance(item, Song.SongInfo): self.theme.setBaseColor(1) c1,c2,c3 = self.artist_selected_color glColor3f(c1,c2,c3) if not item.year == "": yeartag = ", "+item.year else: yeartag = "" cText = item.artist + yeartag if (item.getLocked()): cText = "" # avoid giving away artist of locked song # evilynux - Use font w/o outline lfont.render(cText, (x, y+fh), scale = 0.0016) if item.count: self.theme.setSelectedColor(1) c1,c2,c3 = self.song_name_selected_color glColor3f(c1,c2,c3) count = int(item.count) if count == 1: text = _("Played %d time") % count else: text = _("Played %d times") % count if item.getLocked(): text = item.getUnlockText() elif scene.careerMode and not item.completed: text = _("Play To Advance.") font.render(text, (x, y+2*fh), scale = 0.001) else: text = _("Never Played") if item.getLocked(): text = item.getUnlockText() elif scene.careerMode and not item.completed: text = _("Play To Advance.") lfont.render(text, (x, y+3*fh), scale = 0.001) self.theme.setSelectedColor(1 - v) c1,c2,c3 = self.songlistcd_score_color glColor3f(c1,c2,c3) scale = 0.0011 #x = .6 x = self.song_cdscore_xpos y = .42 try: difficulties = item.partDifficulties[scene.scorePart.id] except KeyError: difficulties = [] if len(difficulties) > 3: y = .42 elif len(difficulties) == 0: score, stars, name = "---", 0, "---" for d in difficulties: scores = item.getHighscores(d, part = scene.scorePart) if scores: score, stars, name, scoreExt = scores[0] try: notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore = scoreExt except ValueError: notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2 = scoreExt handicap = 0 handicapLong = "None" originalScore = score else: score, stars, name = "---", 0, "---" self.theme.setBaseColor(1) font.render(Song.difficulties[d.id].text, (x, y), scale = scale) starscale = 0.02 stary = 1.0 - y/scene.engine.data.fontScreenBottom scene.engine.drawStarScore(screenw, screenh, x+.01, stary-2*fh, stars, starscale, hqStar = True) #volshebnyi self.theme.setSelectedColor(1) # evilynux - Also use hit%/noteStreak SongList option if scores: if notesTotal != 0: score = "%s %.1f%%" % (score, (float(notesHit) / notesTotal) * 100.0) if noteStreak != 0: score = "%s (%d)" % (score, noteStreak) font.render(unicode(score), (x + .15, y), scale = scale) font.render(name, (x + .15, y + fh), scale = scale) y += 2 * fh elif isinstance(item, Song.LibraryInfo): self.theme.setBaseColor(1) c1,c2,c3 = self.library_selected_color glColor3f(c1,c2,c3) if item.songCount == 1: songCount = _("One Song In This Setlist") else: songCount = _("%d Songs In This Setlist") % item.songCount font.render(songCount, (x, y + 3*fh), scale = 0.0016) elif isinstance(item, Song.RandomSongInfo): self.theme.setBaseColor(1 - v) c1,c2,c3 = self.song_name_selected_color glColor3f(c1,c2,c3) font.render(_("(Random Song)"), (x, y + 3*fh), scale = 0.0016) #MFH CD list text = scene.scorePart.text scale = 0.00250 #glColor3f(1, 1, 1) c1,c2,c3 = self.song_name_selected_color glColor3f(c1,c2,c3) w, h = font.getStringSize(text, scale=scale) font.render(text, (0.95-w, 0.000), scale=scale)
def renderSelectedInfo(self, scene): if not scene.selectedItem: return font = scene.engine.data.font screenw, screenh = scene.engine.view.geometry[2:4] v = 0 try: lfont = scene.engine.data.lfont except: lfont = font # here we reset the rendering... without pushing the matrices. (they be thar) # (otherwise copying engine.view.setOrthogonalProjection) glMatrixMode(GL_PROJECTION) glLoadIdentity() viewport = glGetIntegerv(GL_VIEWPORT) w = viewport[2] - viewport[0] h = viewport[3] - viewport[1] h *= (float(w) / float(h)) / (4.0 / 3.0) glOrtho(0, 1, h / w, 0, -100, 100) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glEnable(GL_COLOR_MATERIAL) self.theme.setBaseColor(1) if scene.songLoader: font.render(_("Loading Preview..."), (.05, .7), scale=0.001) #x = .6 x = self.song_cdscore_xpos y = .15 self.theme.setSelectedColor(1) c1, c2, c3 = self.song_name_selected_color glColor3f(c1, c2, c3) item = scene.selectedItem angle = scene.itemRenderAngles[scene.selectedIndex] f = ((90.0 - angle) / 90.0)**2 cText = item.name if (isinstance(item, Song.SongInfo) and item.getLocked()): cText = _("-- Locked --") fh = lfont.getHeight() * 0.0016 lfont.render(cText, (x, y), scale=0.0016) if isinstance(item, Song.SongInfo): self.theme.setBaseColor(1) c1, c2, c3 = self.artist_selected_color glColor3f(c1, c2, c3) if not item.year == "": yeartag = ", " + item.year else: yeartag = "" cText = item.artist + yeartag if (item.getLocked()): cText = "" # avoid giving away artist of locked song # evilynux - Use font w/o outline lfont.render(cText, (x, y + fh), scale=0.0016) if item.count: self.theme.setSelectedColor(1) c1, c2, c3 = self.song_name_selected_color glColor3f(c1, c2, c3) count = int(item.count) if count == 1: text = _("Played %d time") % count else: text = _("Played %d times") % count if item.getLocked(): text = item.getUnlockText() elif scene.careerMode and not item.completed: text = _("Play To Advance.") font.render(text, (x, y + 2 * fh), scale=0.001) else: text = _("Never Played") if item.getLocked(): text = item.getUnlockText() elif scene.careerMode and not item.completed: text = _("Play To Advance.") lfont.render(text, (x, y + 3 * fh), scale=0.001) self.theme.setSelectedColor(1 - v) c1, c2, c3 = self.songlistcd_score_color glColor3f(c1, c2, c3) scale = 0.0011 #x = .6 x = self.song_cdscore_xpos y = .42 try: difficulties = item.partDifficulties[scene.scorePart.id] except KeyError: difficulties = [] if len(difficulties) > 3: y = .42 elif len(difficulties) == 0: score, stars, name = "---", 0, "---" for d in difficulties: scores = item.getHighscores(d, part=scene.scorePart) if scores: score, stars, name, scoreExt = scores[0] try: notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore = scoreExt except ValueError: notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2 = scoreExt handicap = 0 handicapLong = "None" originalScore = score else: score, stars, name = "---", 0, "---" self.theme.setBaseColor(1) font.render(Song.difficulties[d.id].text, (x, y), scale=scale) starscale = 0.02 stary = 1.0 - y / scene.engine.data.fontScreenBottom scene.engine.drawStarScore(screenw, screenh, x + .01, stary - 2 * fh, stars, starscale, hqStar=True) #volshebnyi self.theme.setSelectedColor(1) # evilynux - Also use hit%/noteStreak SongList option if scores: if notesTotal != 0: score = "%s %.1f%%" % (score, (float(notesHit) / notesTotal) * 100.0) if noteStreak != 0: score = "%s (%d)" % (score, noteStreak) font.render(unicode(score), (x + .15, y), scale=scale) font.render(name, (x + .15, y + fh), scale=scale) y += 2 * fh elif isinstance(item, Song.LibraryInfo): self.theme.setBaseColor(1) c1, c2, c3 = self.library_selected_color glColor3f(c1, c2, c3) if item.songCount == 1: songCount = _("One Song In This Setlist") else: songCount = _("%d Songs In This Setlist") % item.songCount font.render(songCount, (x, y + 3 * fh), scale=0.0016) elif isinstance(item, Song.RandomSongInfo): self.theme.setBaseColor(1 - v) c1, c2, c3 = self.song_name_selected_color glColor3f(c1, c2, c3) font.render(_("(Random Song)"), (x, y + 3 * fh), scale=0.0016) #MFH CD list text = scene.scorePart.text scale = 0.00250 #glColor3f(1, 1, 1) c1, c2, c3 = self.song_name_selected_color glColor3f(c1, c2, c3) w, h = font.getStringSize(text, scale=scale) font.render(text, (0.95 - w, 0.000), scale=scale)
def renderMoreInfo(self, scene): if not scene.items: return if not scene.selectedItem: return item = scene.selectedItem i = scene.selectedIndex y = 0 w, h = scene.engine.view.geometry[2:4] font = scene.engine.data.songListFont self.theme.fadeScreen(0.25) if scene.moreInfoTime < 500: y = 1.0 - (float(scene.moreInfoTime) / 500.0) yI = y * h if scene.img_panel: scene.engine.drawImage(scene.img_panel, scale=(1.0, -1.0), coord=(w * 0.5, h * 0.5 + yI), stretched=3) if scene.img_tabs: r0 = (0, (1.0 / 3.0), 0, 0.5) r1 = ((1.0 / 3.0), (2.0 / 3.0), 0, 0.5) r2 = ((2.0 / 3.0), 1.0, 0, 0.5) if scene.infoPage == 0: r0 = (0, (1.0 / 3.0), 0.5, 1.0) scene.engine.drawImage(scene.img_tab1, scale=(0.5, -0.5), coord=(w * 0.5, h * 0.5 + yI)) text = item.name if item.artist != "": text += " by %s" % item.artist if item.year != "": text += " (%s)" % item.year scale = font.scaleText(text, 0.45, 0.0015) font.render(text, (0.52, 0.25 - y), scale=scale, align=1) if scene.itemLabels[i]: imgwidth = scene.itemLabels[i].width1() wfactor = 95.000 / imgwidth scene.engine.drawImage(scene.itemLabels[i], (wfactor, -wfactor), (w * 0.375, h * 0.5 + yI)) elif scene.img_empty_label: imgwidth = scene.img_empty_label.width1() wfactor = 95.000 / imgwidth scene.engine.drawImage(scene.img_empty_label, (wfactor, -wfactor), (w * 0.375, h * 0.5 + yI)) text = item.album if text == "": text = _("No Album") scale = font.scaleText(text, 0.2, 0.0015) font.render(text, (0.56, 0.305 - y), scale=scale) text = item.genre if text == "": text = _("No Genre") scale = font.scaleText(text, 0.2, 0.0015) font.render(text, (0.56, 0.35 - y), scale=scale) elif scene.infoPage == 1: r1 = ((1.0 / 3.0), (2.0 / 3.0), 0.5, 1.0) scene.engine.drawImage(scene.img_tab2, scale=(0.5, -0.5), coord=(w * 0.5, h * 0.5 + yI)) elif scene.infoPage == 2: r2 = ((2.0 / 3.0), 1.0, 0.5, 1.0) scene.engine.drawImage(scene.img_tab3, scale=(0.5, -0.5), coord=(w * 0.5, h * 0.5 + yI)) scene.engine.drawImage( scene.img_tabs, scale=(0.5 * (1.0 / 3.0), -0.25), coord=(w * 0.36, h * 0.72 + yI), rect=r0 ) scene.engine.drawImage( scene.img_tabs, scale=(0.5 * (1.0 / 3.0), -0.25), coord=(w * 0.51, h * 0.72 + yI), rect=r1 ) scene.engine.drawImage( scene.img_tabs, scale=(0.5 * (1.0 / 3.0), -0.25), coord=(w * 0.66, h * 0.72 + yI), rect=r2 )
def renderUnselectedItem(self, scene, i, n): w, h = scene.engine.view.geometry[2:4] font = scene.engine.data.songListFont lfont = scene.engine.data.songListFont sfont = scene.engine.data.shadowfont font = scene.engine.data.songListFont if not scene.items or scene.itemIcons is None: return item = scene.items[i] y = h * (0.7825 - (0.0459 * (n + 1))) if scene.img_tier: imgwidth = scene.img_tier.width1() imgheight = scene.img_tier.height1() wfactor = 381.1 / imgwidth hfactor = 24.000 / imgheight if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo) and scene.img_tier: scene.engine.drawImage( scene.img_tier, scale=(wfactor, -hfactor), coord=(w / 1.587, h - ((0.055 * h) * (n + 1)) - (0.219 * h)), ) icon = None if isinstance(item, Song.SongInfo): if item.icon != "": try: icon = scene.itemIcons[item.icon] imgwidth = icon.width1() wfactor = 23.000 / imgwidth scene.engine.drawImage( icon, scale=(wfactor, -wfactor), coord=(w / 2.86, h - ((0.055 * (n + 1)) - (0.219 * h))) ) except KeyError: pass elif isinstance(item, Song.LibraryInfo): try: icon = scene.itemIcons["Library"] imgwidth = icon.width1() wfactor = 23.000 / imgwidth scene.engine.drawImage( icon, scale=(wfactor, -wfactor), coord=(w / 2.86, h - ((0.055 * (n + 1)) - (0.219 * h))) ) except KeyError: pass elif isinstance(item, Song.RandomSongInfo): try: icon = scene.itemIcons["Random"] imgwidth = icon.width1() wfactor = 23.000 / imgwidth scene.engine.drawImage( icon, scale=(wfactor, -wfactor), coord=(w / 2.86, h - ((0.055 * (n + 1)) - (0.219 * h))) ) except KeyError: pass if isinstance(item, Song.SongInfo) or isinstance(item, Song.LibraryInfo): c1, c2, c3 = self.song_name_text_color glColor4f(c1, c2, c3, 1) elif isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo): c1, c2, c3 = self.career_title_color glColor4f(c1, c2, c3, 1) elif isinstance(item, Song.RandomSongInfo): c1, c2, c3 = self.song_name_text_color glColor4f(c1, c2, c3, 1) text = item.name if isinstance(item, Song.SongInfo) and item.getLocked(): text = _("-- Locked --") if isinstance(item, Song.SongInfo): # MFH - add indentation when tier sorting if scene.tiersPresent or icon: text = " " + text # evilynux - Force uppercase display for Career titles maxwidth = 0.55 if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo): text = string.upper(text) scale = 0.0015 wt, ht = font.getStringSize(text, scale=scale) while wt > maxwidth: tlength = len(text) - 4 text = text[:tlength] + "..." wt, ht = font.getStringSize(text, scale=scale) if wt < 0.45: break font.render(text, (0.35, 0.0413 * (n + 1) + 0.15), scale=scale) if isinstance(item, Song.SongInfo): if not item.getLocked(): try: difficulties = item.partDifficulties[scene.scorePart.id] except KeyError: difficulties = [] for d in difficulties: if d.id == scene.scoreDifficulty.id: scores = item.getHighscores(d, part=scene.scorePart) if scores: score, stars, name, scoreExt = scores[0] try: notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore = ( scoreExt ) except ValueError: notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2 = scoreExt handicap = 0 handicapLong = "None" originalScore = score break else: score, stars, name = 0, 0, "---" else: score, stars, name = _("Nil"), 0, "---" if score == _("Nil") and scene.nilShowNextScore: # MFH for d in difficulties: # MFH - just take the first valid difficulty you can find and display it. scores = item.getHighscores(d, part=scene.scorePart) if scores: score, stars, name, scoreExt = scores[0] try: notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore = ( scoreExt ) except ValueError: notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2 = scoreExt handicap = 0 handicapLong = "None" originalScore = score break else: score, stars, name = 0, 0, "---" else: score, stars, name = _("Nil"), 0, "---" # evilynux - hit% and note streak if enabled scale = 0.0009 if score is not _("Nil") and score > 0 and notesTotal != 0: text = "%.1f%% (%d)" % ((float(notesHit) / notesTotal) * 100.0, noteStreak) font.render(text, (0.92, 0.0413 * (n + 1) + 0.163), scale=scale, align=2) text = str(score) font.render(text, (0.92, 0.0413 * (n + 1) + 0.15), scale=scale, align=2)
def renderForeground(self, scene): font = scene.engine.data.songListFont w, h = scene.engine.view.geometry[2:4] c1, c2, c3 = self.song_rb2_diff_color glColor3f(c1, c2, c3) font.render(_("DIFFICULTY"), (0.095, 0.5325), scale=0.0018) scale = 0.0014 text = _("BAND") font.render(text, (0.17, 0.5585), scale=scale, align=2) text = _("GUITAR") font.render(text, (0.17, 0.5835), scale=scale, align=2) text = _("DRUM") font.render(text, (0.17, 0.6085), scale=scale, align=2) text = _("BASS") font.render(text, (0.17, 0.6335), scale=scale, align=2) text = _("VOCALS") font.render(text, (0.17, 0.6585), scale=scale, align=2) # Add support for lead and rhythm diff # Qstick - Sorting Text text = _("SORTING:") + " " if scene.sortOrder == 0: # title text = text + _("ALPHABETICALLY BY TITLE") elif scene.sortOrder == 1: # artist text = text + _("ALPHABETICALLY BY ARTIST") elif scene.sortOrder == 2: # timesplayed text = text + _("BY PLAY COUNT") elif scene.sortOrder == 3: # album text = text + _("ALPHABETICALLY BY ALBUM") elif scene.sortOrder == 4: # genre text = text + _("ALPHABETICALLY BY GENRE") elif scene.sortOrder == 5: # year text = text + _("BY YEAR") elif scene.sortOrder == 6: # Band Difficulty text = text + _("BY BAND DIFFICULTY") elif scene.sortOrder == 7: # Band Difficulty text = text + _("BY INSTRUMENT DIFFICULTY") else: text = text + _("BY SONG COLLECTION") font.render(text, (0.13, 0.152), scale=0.0017) if scene.searchText: text = _("Filter: %s") % (scene.searchText) + "|" if not scene.matchesSearch(scene.items[scene.selectedIndex]): text += " (%s)" % _("Not found") font.render(text, (0.05, 0.7), scale=0.001) elif scene.songLoader: font.render(_("Loading Preview..."), (0.05, 0.7), scale=0.001) return if scene.img_list_button_guide: scene.engine.drawImage(scene.img_list_button_guide, scale=(0.5, -0.5), coord=(w * 0.5, 0), fit=2) if scene.songLoader: font.render(_("Loading Preview..."), (0.5, 0.7), align=1) if scene.img_list_fg: scene.engine.drawImage(scene.img_list_fg, scale=(1.0, -1.0), coord=(w / 2, h / 2), stretched=3)
def renderSelectedItem(self, scene, n): w, h = scene.engine.view.geometry[2:4] font = scene.engine.data.songListFont lfont = scene.engine.data.songListFont sfont = scene.engine.data.shadowfont item = scene.selectedItem if not item: return if isinstance(item, Song.BlankSpaceInfo): return y = h * (0.7825 - (0.0459 * (n))) if scene.img_tier: imgwidth = scene.img_tier.width1() imgheight = scene.img_tier.height1() wfactor = 381.1 / imgwidth hfactor = 24.000 / imgheight if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo): scene.engine.drawImage( scene.img_tier, scale=(wfactor, -hfactor), coord=(w / 1.587, h - ((0.055 * h) * (n + 1)) - (0.219 * h)), ) if scene.img_selected: imgwidth = scene.img_selected.width1() imgheight = scene.img_selected.height1() wfactor = 381.5 / imgwidth hfactor = 36.000 / imgheight scene.engine.drawImage( scene.img_selected, scale=(wfactor, -hfactor), coord=(w / 1.587, y * 1.2 - h * 0.213) ) icon = None if isinstance(item, Song.SongInfo): if item.icon != "": try: icon = scene.itemIcons[item.icon] imgwidth = icon.width1() wfactor = 23.000 / imgwidth scene.engine.drawImage( icon, scale=(wfactor, -wfactor), coord=(w / 2.86, h - ((0.055 * (n + 1)) - (0.219 * h))) ) except KeyError: pass c1, c2, c3 = self.song_name_selected_color glColor3f(c1, c2, c3) if item.getLocked(): text = item.getUnlockText() elif scene.careerMode and not item.completed: text = _("Play To Advance") elif scene.practiceMode: text = _("Practice") elif item.count: count = int(item.count) if count == 1: text = _("Played Once") else: text = _("Played %d times.") % count else: text = _("Quickplay") elif isinstance(item, Song.LibraryInfo): try: icon = scene.itemIcons["Library"] imgwidth = icon.width1() wfactor = 23.000 / imgwidth scene.engine.drawImage( icon, scale=(wfactor, -wfactor), coord=(w / 2.86, h - ((0.055 * (n + 1)) - (0.219 * h))) ) except KeyError: pass c1, c2, c3 = self.library_selected_color glColor3f(c1, c2, c3) if item.songCount == 1: text = _("There Is 1 Song In This Setlist.") elif item.songCount > 1: text = _("There Are %d Songs In This Setlist.") % (item.songCount) else: text = "" elif isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo): text = _("Tier") c1, c2, c3 = self.career_title_color glColor3f(c1, c2, c3) elif isinstance(item, Song.RandomSongInfo): try: icon = scene.itemIcons["Random"] imgwidth = icon.width1() wfactor = 23.000 / imgwidth scene.engine.drawImage( icon, scale=(wfactor, -wfactor), coord=(w / 2.86, h - ((0.055 * (n + 1)) - (0.219 * h))) ) except KeyError: pass text = _("Random Song") c1, c2, c3 = self.career_title_color glColor3f(c1, c2, c3) font.render(text, (0.92, 0.13), scale=0.0012, align=2) maxwidth = 0.45 if ( isinstance(item, Song.SongInfo) or isinstance(item, Song.LibraryInfo) or isinstance(item, Song.RandomSongInfo) ): c1, c2, c3 = self.song_name_selected_color glColor4f(c1, c2, c3, 1) if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo): c1, c2, c3 = self.career_title_color glColor4f(c1, c2, c3, 1) text = item.name if isinstance(item, Song.SongInfo) and item.getLocked(): text = _("-- Locked --") if isinstance(item, Song.SongInfo): # MFH - add indentation when tier sorting if scene.tiersPresent or icon: text = " " + text # evilynux - Force uppercase display for Career titles if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo): maxwidth = 0.55 text = string.upper(text) scale = 0.0015 wt, ht = font.getStringSize(text, scale=scale) while wt > maxwidth: tlength = len(text) - 4 text = text[:tlength] + "..." wt, ht = font.getStringSize(text, scale=scale) if wt < 0.45: break font.render(text, (0.35, 0.0413 * (n + 1) + 0.15), scale=scale) # add theme option for song_listCD_xpos if isinstance(item, Song.SongInfo): if not item.getLocked(): try: difficulties = item.partDifficulties[scene.scorePart.id] except KeyError: difficulties = [] for d in difficulties: if d.id == scene.scoreDifficulty.id: scores = item.getHighscores(d, part=scene.scorePart) if scores: score, stars, name, scoreExt = scores[0] try: notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore = ( scoreExt ) except ValueError: notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2 = scoreExt handicap = 0 handicapLong = "None" originalScore = score break else: score, stars, name = 0, 0, "---" else: score, stars, name = _("Nil"), 0, "---" if score == _("Nil") and scene.nilShowNextScore: # MFH for d in difficulties: # MFH - just take the first valid difficulty you can find and display it. scores = item.getHighscores(d, part=scene.scorePart) if scores: score, stars, name, scoreExt = scores[0] try: notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore = ( scoreExt ) except ValueError: notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2 = scoreExt handicap = 0 handicapLong = "None" originalScore = score break else: score, stars, name = 0, 0, "---" else: score, stars, name = _("Nil"), 0, "---" scale = 0.0009 if score is not _("Nil") and score > 0 and notesTotal != 0: text = "%.1f%% (%d)" % ((float(notesHit) / notesTotal) * 100.0, noteStreak) w, h = font.getStringSize(text, scale=scale) font.render(text, (0.92, 0.0413 * (n + 1) + 0.163), scale=scale, align=2) text = str(score) font.render(text, (0.92, 0.0413 * (n + 1) + 0.15), scale=scale, align=2)
def renderMoreInfo( self, scene ): if not scene.items: return if not scene.selectedItem: return item = scene.selectedItem i = scene.selectedIndex y = 0 ( w, h ) = scene.geometry font = scene.fontDict['songListFont'] self.theme.fadeScreen( .25 ) if scene.moreInfoTime < 500: y = 1.0 - float( scene.moreInfoTime ) / 500.0 yI = y * h if scene.img_panel: scene.drawImage( scene.img_panel, scale = ( 1.0, -1.0 ), coord = ( w * .5, h * .5 + yI ), stretched = 0 ) if scene.img_tabs: r0 = ( 0, 1.0 / 3.0, 0, .5 ) r1 = ( 1.0 / 3.0, 2.0 / 3.0, 0, .5 ) r2 = ( 2.0 / 3.0, 1.0, 0, .5 ) if scene.infoPage == 0: r0 = ( 0, 1.0 / 3.0, .5, 1.0 ) scene.drawImage( scene.img_tab1, scale = ( .5, -.5 ), coord = ( w * .5, h * .5 + yI ) ) text = item.name if item.artist != '': text += ' by %s' % item.artist if item.year != '': text += ' (%s)' % item.year scale = font.scaleText( text, .08, 0.00160001 ) font.render( text, ( .08, .25 - y ), scale = scale, align = 1 ) if scene.itemLabels[i]: imgwidth = scene.itemLabels[i].width1() wfactor = 75.000 / imgwidth scene.drawImage( scene.itemLabels[i], ( wfactor, - wfactor ), ( w * .375, h * .5 + yI ), stretched = 11 ) elif scene.img_empty_label: imgwidth = scene.img_empty_label.width1() wfactor = 75.000 / imgwidth scene.drawImage( scene.img_empty_label, ( wfactor, - wfactor ), ( w * .375, h * .5 + yI ), stretched = 11 ) text = item.album if text == '': text = _( 'No Album' ) scale = font.scaleText( text, 0.20000000000000001, 0.00160001 ) font.render( text, ( .56, .305 - y ), scale = scale ) text = item.genre if text == '': text = _( 'No Genre' ) scale = font.scaleText( text, 0.20000000000000001, 0.00160001 ) font.render( text, ( .56, .35 - y ), scale = scale ) elif scene.infoPage == 1: r1 = ( 1.0 / 3.0, 2.0 / 3.0, .5, 1.0 ) scene.drawImage( scene.img_tab2, scale = ( .5, -.5 ), coord = ( w * .5, h * .5 + yI ) ) elif scene.infoPage == 2: r2 = ( 2.0 / 3.0, 1.0, .5, 1.0 ) scene.drawImage( scene.img_tab3, scale = ( .5, -.5 ), coord = ( w * .5, h * .5 + yI ) ) scene.drawImage( scene.img_tabs, scale = ( .5 * ( 1.0 / 3.0 ), - .25 ), coord = ( w * .36, h * .72 + yI ), rect = r0 ) scene.drawImage( scene.img_tabs, scale = ( .5 * ( 1.0 / 3.0 ), - .25 ), coord = ( w * .51, h * .72 + yI ), rect = r1 ) scene.drawImage( scene.img_tabs, scale = ( .5 * ( 1.0 / 3.0 ), - .25 ), coord = ( w * .66, h * .72 + yI ), rect = r2 )
def renderForeground( self, scene ): font = scene.fontDict['songListFont'] ( w, h ) = scene.geometry if self.setlist_type == 3: font = scene.fontDict['songListFont'] ( c1, c2, c3 ) = self.song_rb2_diff_color glColor3f( c1, c2, c3 ) scale = 0.00160001 text = _( 'BAND:' ) font.render( text, ( .08, .4665 ), scale = scale ) text = _( 'GUITAR:' ) font.render( text, ( .08, .4867 ), scale = scale ) text = _( 'DRUM:' ) font.render( text, ( .08, .5069 ), scale = scale ) text = _( 'BASS:' ) font.render( text, ( .08, .5271 ), scale = scale ) text = _( 'VOCALS:' ) font.render( text, ( .08, .5473 ), scale = scale ) text = _( 'SORTING:' ) + ' ' if scene.sortOrder == 0: text = text + _( 'ALPHABETICALLY BY TITLE' ) elif scene.sortOrder == 1: text = text + _( 'ALPHABETICALLY BY ARTIST' ) elif scene.sortOrder == 2: text = text + _( 'BY PLAY COUNT' ) elif scene.sortOrder == 3: text = text + _( 'ALPHABETICALLY BY ALBUM' ) elif scene.sortOrder == 4: text = text + _( 'ALPHABETICALLY BY GENRE' ) elif scene.sortOrder == 5: text = text + _( 'BY YEAR' ) elif scene.sortOrder == 6: text = text + _( 'BY BAND DIFFICULTY' ) elif scene.sortOrder == 7: text = text + _( 'BY INSTRUMENT DIFFICULTY' ) else: text = text + _( 'BY SONG COLLECTION' ) font.render( text, ( .08, .155 ), scale = 0.00150001 ) if scene.songLoader: font.render( _( 'Loading Preview...' ), ( .05, .7 ), scale = 0.00150001 ) return if scene.img_list_button_guide: scene.drawImage( scene.img_list_button_guide, scale = ( .5, - .5 ), coord = ( w * .5, 0 ), fit = 2 ) if scene.songLoader: font.render( _( 'Loading Preview...' ), ( .5, .7 ), align = 1 ) if scene.searching: font.render( scene.searchText, ( .5, .7 ), align = 1 ) if scene.img_list_fg: scene.drawImage( scene.img_list_fg, scale = ( 1.0, -1.0 ), coord = ( w / 2, h / 2 ), stretched = 0 )
def renderSelectedItem( self, scene, n ): ( w, h ) = scene.geometry font = scene.fontDict['songListFont'] item = scene.selectedItem if not item: return if isinstance( item, Song.BlankSpaceInfo ): return if self.setlist_type == 3: y = h * ( .7825 - .0459 * n ) if scene.img_tier: imgwidth = scene.img_tier.width1() imgheight = scene.img_tier.height1() wfactor = 381.1 / imgwidth hfactor = 24.000 / imgheight if isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ): scene.drawImage( scene.img_tier, scale = ( wfactor, - hfactor ), coord = ( w / 1.587, h - 0.055 * h * ( n + 1 ) - 0.219 * h ) ) if scene.img_selected: imgwidth = scene.img_selected.width1() imgheight = scene.img_selected.height1() wfactor = 0.03 scene.drawImage( scene.img_selected, scale = ( wfactor, - wfactor ), coord = ( w / 1.587, y * 1.2 - h * .213 ), stretched = 11 ) icon = None if isinstance( item, Song.SongInfo ): if item.icon != '': try: icon = scene.itemIcons[item.icon] wfactor = 0.03 scene.drawImage( icon, scale = ( wfactor, - wfactor ), coord = ( w / 1.052, h - 0.055 * h * ( n + 1 ) - 0.20000000000000001 * h ), stretched = 11 ) except KeyError: pass ( c1, c2, c3 ) = self.song_name_selected_color glColor3f( c1, c2, c3 ) if item.getLocked(): text = item.getUnlockText() elif scene.careerMode and not item.completed: text = _( 'Play To Advance' ) elif scene.practiceMode: text = _( 'Practice' ) elif item.count: count = int( item.count ) if count == 1: text = _( 'Played Once' ) else: text = _( 'Played %d times.' ) % count else: text = _( 'Quickplay' ) elif isinstance( item, Song.LibraryInfo ): try: icon = scene.itemIcons['Library'] wfactor = 0.03 scene.drawImage( icon, scale = ( wfactor, -wfactor ), coord = ( w / 1.052, h - 0.055 * h * ( n + 1 ) - 0.20000000000000001 * h ), stretched = 11 ) except KeyError: pass ( c1, c2, c3 ) = self.library_selected_color glColor3f( c1, c2, c3 ) if item.songCount == 1: text = _( 'There Is 1 Song In This Setlist.' ) elif item.songCount > 1: text = _( 'There Are %d Songs In This Setlist.' ) \ % item.songCount else: text = '' elif isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ): text = _( 'Tier' ) ( c1, c2, c3 ) = self.career_title_color glColor3f( c1, c2, c3 ) elif isinstance( item, Song.RandomSongInfo ): try: icon = scene.itemIcons['Random'] wfactor = 0.03 scene.drawImage( icon, scale = ( wfactor, -wfactor ), coord = ( w / 1.052, h - 0.055 * h * ( n + 1 ) - 0.20000000000000001 * h ), stretched = 11 ) except KeyError: pass text = _( 'Random Song' ) ( c1, c2, c3 ) = self.career_title_color glColor3f( c1, c2, c3 ) font.render( text, ( 0.92000000000000003, .155 ), scale = 0.00150001, align = 2 ) maxwidth = 0.20000000000000001 if isinstance( item, Song.SongInfo ) or isinstance( item, Song.LibraryInfo ) or isinstance( item, Song.RandomSongInfo ): ( c1, c2, c3 ) = self.song_name_selected_color glColor4f( c1, c2, c3, 1 ) if isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ): ( c1, c2, c3 ) = self.career_title_color glColor4f( c1, c2, c3, 1 ) text = item.name if isinstance( item, Song.SongInfo ) and item.getLocked(): text = _( '-- Locked --' ) if isinstance( item, Song.SongInfo ): if scene.tiersPresent or icon: text = ' ' + text if isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ): maxwidth = 0.20000000000000001 text = string.upper( text ) scale = 0.00160001 ( wt, ht ) = font.getStringSize( text, scale = scale ) while wt > maxwidth: tlength = len( text ) - 4 text = text[:tlength] + '...' ( wt, ht ) = font.getStringSize( text, scale = scale ) if wt < .45: break font.render( text, ( .40, .0413 * ( n + 1 ) + .15 ), scale = scale ) if isinstance( item, Song.SongInfo ): score = _( "Nil" ) stars = 0 name = "" if not item.getLocked(): try: difficulties = \ item.partDifficulties[scene.scorePart.id] except KeyError: difficulties = [] for d in difficulties: if d.id == scene.scoreDifficulty.id: scores = item.getHighscores( d, part = scene.scorePart ) if scores: ( score, stars, name, scoreExt ) = \ scores[0] try: ( notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore, ) = scoreExt except ValueError: ( notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2, ) = scoreExt break else: ( score, stars, name ) = ( 0, 0, '---' ) if score == _( 'Nil' ) and scene.nilShowNextScore: for d in difficulties: scores = item.getHighscores( d, part = scene.scorePart ) if scores: ( score, stars, name, scoreExt ) = \ scores[0] try: ( notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore, ) = scoreExt except ValueError: ( notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2, ) = scoreExt break else: ( score, stars, name ) = ( 0, 0, '---' ) else: ( score, stars, name ) = ( _( 'Nil' ), 0, '---' ) scale = 0.0010 if score != _( 'Nil' ) and score > 0 \ and notesTotal != 0: text = '%.1f%% (%d)' % ( float( notesHit ) / notesTotal * 100.0, noteStreak ) ( w, h ) = font.getStringSize( text, scale = scale ) font.render( text, ( 0.92000000000000003, .0413 * ( n + 1 ) + .163 ), scale = scale, align = 2 ) text = str( score ) font.render( text, ( 0.92000000000000003, .0413 * ( n + 1 ) + .15 ), scale = scale, align = 2 )
def renderUnselectedItem( self, scene, i, n, ): ( w, h ) = scene.geometry font = scene.fontDict['songListFont'] if self.setlist_type == 3: font = scene.fontDict['songListFont'] if not scene.items or scene.itemIcons is None: return item = scene.items[i] if scene.img_tier: imgwidth = scene.img_tier.width1() imgheight = scene.img_tier.height1() wfactor = 0.02 if isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ) and scene.img_tier: scene.drawImage( scene.img_tier, scale = ( wfactor, - hfactor ), coord = ( w / 1.587, h - 0.055 * h * ( n + 1 ) - 0.219 * h ) ) icon = None if isinstance( item, Song.SongInfo ): if item.icon != '': try: icon = scene.itemIcons[item.icon] wfactor = 0.02 scene.drawImage( icon, scale = ( wfactor, - wfactor ), coord = ( w / 1.052, h - 0.055 * h * ( n + 1 ) - 0.20000000000000001 * h ), stretched = 11 ) except KeyError: pass elif isinstance( item, Song.LibraryInfo ): try: icon = scene.itemIcons['Library'] wfactor = 0.02 scene.drawImage( icon, scale = ( wfactor, -wfactor ), coord = ( w / 1.052, h - 0.055 * h * ( n + 1 ) - 0.20000000000000001 * h ), stretched = 11 ) except KeyError: pass elif isinstance( item, Song.RandomSongInfo ): try: icon = scene.itemIcons['Random'] wfactor = 0.02 scene.drawImage( icon, scale = ( wfactor, -wfactor ), coord = ( w / 1.052, h - 0.055 * h * ( n + 1 ) - 0.20000000000000001 * h ), stretched = 11 ) except KeyError: pass if isinstance( item, Song.SongInfo ) or isinstance( item, Song.LibraryInfo ): ( c1, c2, c3 ) = self.song_name_text_color glColor4f( c1, c2, c3, 1 ) elif isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ): ( c1, c2, c3 ) = self.career_title_color glColor4f( c1, c2, c3, 1 ) elif isinstance( item, Song.RandomSongInfo ): ( c1, c2, c3 ) = self.song_name_text_color glColor4f( c1, c2, c3, 1 ) text = item.name if isinstance( item, Song.SongInfo ) and item.getLocked(): text = _( '-- Locked --' ) if isinstance( item, Song.SongInfo ): if scene.tiersPresent or icon: text = ' ' + text maxwidth = .3 if isinstance( item, Song.TitleInfo ) or isinstance( item, Song.SortTitleInfo ): text = string.upper( text ) scale = 0.00160001 ( wt, ht ) = font.getStringSize( text, scale = scale ) while wt > maxwidth: tlength = len( text ) - 4 text = text[:tlength] + '...' ( wt, ht ) = font.getStringSize( text, scale = scale ) if wt < .45: break font.render( text, ( .40, .0413 * ( n + 1 ) + .15 ), scale = scale ) if isinstance( item, Song.SongInfo ): score = _( "Nil" ) stars = 0 name = "" if not item.getLocked(): try: difficulties = \ item.partDifficulties[scene.scorePart.id] except KeyError: difficulties = [] for d in difficulties: if d.id == scene.scoreDifficulty.id: scores = item.getHighscores( d, part = scene.scorePart ) if scores: ( score, stars, name, scoreExt ) = \ scores[0] try: ( notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore, ) = scoreExt except ValueError: ( notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2, ) = scoreExt break else: ( score, stars, name ) = ( 0, 0, '---' ) if score == _( 'Nil' ) and scene.nilShowNextScore: for d in difficulties: scores = item.getHighscores( d, part = scene.scorePart ) if scores: ( score, stars, name, scoreExt ) = \ scores[0] try: ( notesHit, notesTotal, noteStreak, modVersion, handicap, handicapLong, originalScore, ) = scoreExt except ValueError: ( notesHit, notesTotal, noteStreak, modVersion, oldScores1, oldScores2, ) = scoreExt break else: ( score, stars, name ) = ( 0, 0, '---' ) else: ( score, stars, name ) = ( _( 'Nil' ), 0, '---' ) scale = 0.0010 if score != _( 'Nil' ) and score > 0 \ and notesTotal != 0: text = '%.1f%% (%d)' % ( float( notesHit ) / notesTotal * 100.0, noteStreak ) font.render( text, ( 0.92000000000000003, .0413 * ( n + 1 ) + .163 ), scale = scale, align = 2 ) text = str( score ) font.render( text, ( 0.92000000000000003, .0413 * ( n + 1 ) + .15 ), scale = scale, align = 2 )