def play(self, obj, pause=1, fade=0, fade_duration=0.5, duration=None): if not isinstance(obj, list): obj = [obj] if len(obj) == 0: return if fade: self.fade_in_start(obj[0], fade_duration) if pause: anim.pause() anim.set(self.anim, obj[0]) if duration is None: d = obj[0].length else: d = duration linear(d, self.t, 0.0, obj[0].length) for i in obj[1:]: if pause: anim.pause() anim.set(self.anim, i) if duration is None: d = i.length else: d = duration linear(d, self.t, 0.0, i.length) if fade: if pause: anim.pause() self.fade_out_end(obj[-1], fade_duration)
def play( self, obj, pause = 1, fade = 0, fade_duration = 0.5, duration = None ): if not isinstance( obj, list ): obj = [obj] if len(obj) == 0: return if fade: self.fade_in_start( obj[0], fade_duration ) if pause: anim.pause() anim.set( self.anim, obj[0] ) if duration is None: d = obj[0].length else: d = duration linear( d, self.t, 0.0, obj[0].length ) for i in obj[1:]: if pause: anim.pause() anim.set( self.anim, i ) if duration is None: d = i.length else: d = duration linear( d, self.t, 0.0, i.length ) if fade: if pause: anim.pause() self.fade_out_end( obj[-1], fade_duration )
def remove_item( self, duration = 0.0, trans = transition.default ): if anim.defining_animation(): before = anim.get( self.items ) if not before: return if duration: trans( duration, self.show, len(before)-1 ) anim.set( self.items, before[:-1] ) else: self._startitemlist.pop()
def remove_item(self, duration=0.0, trans=transition.default): if anim.defining_animation(): before = anim.get(self.items) if not before: return if duration: trans(duration, self.show, len(before) - 1) anim.set(self.items, before[:-1]) else: self._startitemlist.pop()
def add_item( self, level, text, duration = 0.0, trans = transition.default ): if anim.defining_animation(): before = anim.get( self.items ) after = before + [(level,text)] anim.set( self.items, after ) if duration: trans( duration, self.show, len(after) ) else: anim.set( self.show, len(after) ) else: self._startitemlist.append( (level, text) )
def add_item(self, level, text, duration=0.0, trans=transition.default): if anim.defining_animation(): before = anim.get(self.items) after = before + [(level, text)] anim.set(self.items, after) if duration: trans(duration, self.show, len(after)) else: anim.set(self.show, len(after)) else: self._startitemlist.append((level, text))
def view( self, rect, duration = 0.0, trans = transition.default ): if duration <= 0.0: anim.set( self.rect, rect ) else: trans( duration, self.rect, rect )
def fade_out_end( self, obj, duration ): if isinstance( obj, list ): obj = obj[-1] anim.set( self.anim, obj ) anim.set( self.t, obj.length ) linear( duration, self._alpha, 0.0 )
def fade_in_start( self, obj, duration ): if isinstance( obj, list ): obj = obj[0] anim.set( self.anim, obj ) anim.set( self.t, 0.0 ) linear( duration, self._alpha, 0.0, 1.0 )
def clear( self ): anim.set( self.anim, None )
def show( self, obj, t = 0.0 ): if isinstance( obj, list ): obj = obj[0] print 'showing', obj anim.set( self.anim, obj ) anim.set( self.t, t )
def view(self, rect, duration=0.0, trans=transition.default): if duration <= 0.0: anim.set(self.rect, rect) else: trans(duration, self.rect, rect)
def fade_out_end(self, obj, duration): if isinstance(obj, list): obj = obj[-1] anim.set(self.anim, obj) anim.set(self.t, obj.length) linear(duration, self._alpha, 0.0)
def fade_in_start(self, obj, duration): if isinstance(obj, list): obj = obj[0] anim.set(self.anim, obj) anim.set(self.t, 0.0) linear(duration, self._alpha, 0.0, 1.0)
def clear(self): anim.set(self.anim, None)
def show(self, obj, t=0.0): if isinstance(obj, list): obj = obj[0] print 'showing', obj anim.set(self.anim, obj) anim.set(self.t, t)