import os
from eventutils import EventHandlerMixin, event_handler
from itertools import cycle
import os
from eventutils import EventHandlerMixin, event_handler
from itertools import cycle
-from pygame.locals import MOUSEBUTTONDOWN, MOUSEBUTTONUP, USEREVENT
+from pygame.locals import USEREVENT
TIMEOUT = USEREVENT + 1
class WarpingCursor(pygame.sprite.Sprite, EventHandlerMixin):
TIMEOUT = USEREVENT + 1
class WarpingCursor(pygame.sprite.Sprite, EventHandlerMixin):
def __init__(self, theme='black', duration=75, blink=True):
pygame.sprite.Sprite.__init__(self)
def __init__(self, theme='black', duration=75, blink=True):
pygame.sprite.Sprite.__init__(self)
+ pygame.mouse.set_visible(False)
imagesPath, images = WarpingCursor._get_theme_images(theme)
flashImage = images.pop(images.index('flash.png'))
flashImagePath = os.path.sep.join([imagesPath, flashImage])
imagesPath, images = WarpingCursor._get_theme_images(theme)
flashImage = images.pop(images.index('flash.png'))
flashImagePath = os.path.sep.join([imagesPath, flashImage])
self.image = self.images[0]
self.rect = pygame.Rect((0,0), (self.width, self.height))
self.image = self.images[0]
self.rect = pygame.Rect((0,0), (self.width, self.height))
self.blink = blink
if blink :
self.blink = blink
if blink :
def loadNext(self, event) :
if self.blink :
self.image = self.iterator.next()
def loadNext(self, event) :
if self.blink :
self.image = self.iterator.next()
- @event_handler(MOUSEBUTTONDOWN)
+ @event_handler(pygame.MOUSEBUTTONDOWN)
def flashOn(self, event) :
self.blink=False
self.image = self.flashImage
def flashOn(self, event) :
self.blink=False
self.image = self.flashImage
- @event_handler(MOUSEBUTTONUP)
+ @event_handler(pygame.MOUSEBUTTONUP)
def flashOff(self, event) :
self.blink = True
self.loadNext(event)
def flashOff(self, event) :
self.blink = True
self.loadNext(event)
-
- def update(self) :
- surface = pygame.display.get_surface()
- surface.blit(self.image, self.rect)
+
+ @event_handler(pygame.MOUSEMOTION)
+ def move(self, event) :
+ x, y = event.rel
+ self.rect.centerx += x
+ self.rect.centery += y
+ #self.rect.move_ip(*rel)
import types
# TODO : positionner cette constance en fonction de la résolution d'affichage
# externaliser la conf.
import types
# TODO : positionner cette constance en fonction de la résolution d'affichage
# externaliser la conf.
FIRST_HUE = 0.6
OFF_LUMINANCE = 0.2
OFF_SATURATION = 1
FIRST_HUE = 0.6
OFF_LUMINANCE = 0.2
OFF_SATURATION = 1
distinctNotes : notes disctinctes présentes dans la chanson
triées du plus grave au plus aigu.
"""
distinctNotes : notes disctinctes présentes dans la chanson
triées du plus grave au plus aigu.
"""
- print '__init__ _PlayingScreenBase'
super(_PlayingScreenBase, self).__init__()
self.distinctNotes = distinctNotes
self.keyboardLength = 0
super(_PlayingScreenBase, self).__init__()
self.distinctNotes = distinctNotes
self.keyboardLength = 0
def _initCursor(self) :
self.cursor = WarpingCursor()
def _initCursor(self) :
self.cursor = WarpingCursor()
def highlightColumn(self, index) :
def highlightColumn(self, index) :
def run(self):
self._running = True
clock = pygame.time.Clock()
def run(self):
self._running = True
clock = pygame.time.Clock()
EventDispatcher.dispatchEvents()
EventDispatcher.dispatchEvents()
+ dirty = self.draw(pygame.display.get_surface())
+ pygame.display.update(dirty)
clock.tick(50)
@event_handler(pygame.KEYDOWN)
clock.tick(50)
@event_handler(pygame.KEYDOWN)
class SongPlayingScreenTest(_PlayingScreenBase) :
def __init__(self) :
class SongPlayingScreenTest(_PlayingScreenBase) :
def __init__(self) :
- print '__init__ SongPlayingScreenTest'
class C:pass
o = C()
o.midi=1
class C:pass
o = C()
o.midi=1