X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/79aca379ed6dffa4d71d66f513a973d2e3470c5a..d44cf918237d05fa9e0eec3f61dce8cbb8d98151:/src/minwii/widgets/column.py?ds=inline diff --git a/src/minwii/widgets/column.py b/src/minwii/widgets/column.py index 99f259f..b113529 100755 --- a/src/minwii/widgets/column.py +++ b/src/minwii/widgets/column.py @@ -7,7 +7,7 @@ $URL$ """ import pygame from math import floor -import minwii.gradients +import minwii.gradients as gradients from minwii.globals import BACKGROUND_LAYER from minwii.globals import FOREGROUND_LAYER from minwii.globals import hls_to_rgba_8bits @@ -20,14 +20,14 @@ from minwii.config import ON_COLUMN_OVERSIZING from minwii.config import ON_COLUMN_ALPHA from minwii.config import LYRICS_FONT, NOTES_FONT from minwii.config import FONT_COLOR -import minwii.events +import minwii.events as events class Column(pygame.sprite.DirtySprite) : ''' colonne utilisée pour l'affichage d'une touche du clavier de jeu. ''' - def __init__(self, group, index, hue, rect, tone) : + def __init__(self, group, index, hue, rect, tone, displayNote=True) : pygame.sprite.DirtySprite.__init__(self, group) self.index = index self.state = False @@ -43,7 +43,8 @@ class Column(pygame.sprite.DirtySprite) : w, h = rect.w, rect.h tw, th, = toneName.get_size() toneRect = pygame.Rect(((w - tw) / 2, h - th), (tw, th)) - sur.blit(toneName, toneRect) + if displayNote : + sur.blit(toneName, toneRect) self.surOff = sur self.rectOff = rect @@ -58,7 +59,8 @@ class Column(pygame.sprite.DirtySprite) : self.surOn = gradients.vertical(rectOn.size, topRgba, bottomRgba) w, h = rectOn.w, rectOn.h toneRect = pygame.Rect(((w - tw) / 2, h - th), (tw, th)) - self.surOn.blit(toneName, toneRect) + if displayNote : + self.surOn.blit(toneName, toneRect) self.rectOn = rectOn self.image = self.surOff @@ -72,9 +74,9 @@ class Column(pygame.sprite.DirtySprite) : if state : group.change_layer(self, FOREGROUND_LAYER) sur = self.surOn + rect = self.rectOn if syllabus : sur = sur.copy() - rect = self.rectOn renderedSyl = LYRICS_FONT.render(syllabus, True, FONT_COLOR) sw, sh, = renderedSyl.get_size() w, h = self.rectOn.w, self.rectOn.h