def __init__(self, **kwargs): super(MTKeyboard, self).__init__(**kwargs) self.pos = (15,15) self.buttoncolor = (.2,.9,0,.5) self.matrix_size = (32,13) self.size = (600,455) self.downcolor = (0, .5, 1, 1) self.__rawNoteData = kwargs.get('rawNoteData') self.__notesMatrix = kwargs.get('notesMatrix') self.displayRawNoteData() EventManager.getInstance().register(self,self.__showPlayBar)
def bpm(self, *largs): self.clear() c = self.btn1 x = c.x y = c.y self.remove_widget(c) btn = MTButton(label='Bpm', size = (100,60),pos = (x,y), cls=('simple','pcolored')) btn.push_handlers(on_press=self.clear) self.add_widget(btn) l1 = MTBoxLayout(orientation='vertical',padding = 10, spacing = 3, pos= (180,263)) m = Showslider(cls=('simple', 'colored'), orientation='vertical', value=EventManager.getInstance().getBPM()) m.connect('on_value_change',self.bpmSlider_value_change) l1.add_widget(m) self.add_widget(l1)
def __init__(self, **kwargs): kwargs.setdefault('instrument', 0) self.filename = kwargs.get('filename') img = Loader.image(self.filename) x = int(random.uniform(300, 600)) y = int(random.uniform(100, 500)) # make sequence for this instrument self.seq = EventManager.getInstance().createSequence() ''' TODO auswahl des instruments muss hier noch rein ''' self.seq.setInstrument(kwargs.get('instrument')) self.volume = Constants.SEQUENCE_START_VOLUME # this is used to ensure that the on_touch_up handler just # executes one time. see on_touch_up event handler self.touch_up_oneTime = 0.0 super(MusicBubble, self).__init__(image=img, pos=(x,y), scale=0.8, **kwargs) self.register_event_type('on_tap')
def volumeSlider_value_change(self,value): try: EventManager.getInstance().setVolume(value) except: pass
def bpmSlider_value_change(self,value): try: EventManager.getInstance().setBPM(value) except: pass