Exemplo n.º 1
0
 def play(self, event):
     from pygame import mixer
     if not mixer.get_init():
         mixer.init()
     if mixer.get_busy() and self.sound:
         self.sound.stop()
         return
     volume_attr = self.aguidata.get('volume')
     if volume_attr:
         volume = getattr(self.window.object, volume_attr)
     else:
         volume = 1
     try:
         sound = get_sound(self.get_control_value(), volume=volume)
         sound.play()
         self.sound = sound
     except:
         self.sound = None
     self.play_button_down = True
     self.looping = False
     wx.CallLater(0.1, self.test_button)
     event.Skip()
Exemplo n.º 2
0
    def play(self, event):
        from pygame import mixer

        if not mixer.get_init():
            mixer.init()
        if mixer.get_busy() and self.sound:
            self.sound.stop()
            return
        volume_attr = self.aguidata.get("volume")
        if volume_attr:
            volume = getattr(self.window.object, volume_attr)
        else:
            volume = 1
        try:
            sound = get_sound(self.get_control_value(), volume=volume)
            sound.play()
            self.sound = sound
        except:
            self.sound = None
        self.play_button_down = True
        self.looping = False
        wx.CallLater(0.1, self.test_button)
        event.Skip()
Exemplo n.º 3
0
 def on_first_display(self, register_type="single"):
     "Set up sounds and register for mouse events"
     self.hover_sound_object = get_sound(self.hover_sound)
     self.click_sound_object = get_sound(self.click_sound)
     self.base_look = self.owner.tint
     self.owner.mouse_register(register_type)
Exemplo n.º 4
0
 def setup(self):
     "setup(): Set up the sound. This is for ease of derivation."
     scene = PigDirector.scene #@UndefinedVariable
     self.sound_object = get_sound( self.sound, volume=self.volume)                
Exemplo n.º 5
0
 def setup(self):
     "setup(): Set up the sound. This is for ease of derivation."
     scene = PigDirector.scene  #@UndefinedVariable
     self.sound_object = get_sound(self.sound, volume=self.volume)
Exemplo n.º 6
0
 def setup_spawner(self):
     "Setup for the spawner. Subclasses should call this."
     if self.sound:
         self.sound_object = get_sound( self.sound, volume=self.volume)
     if self.spawned_objects is None:
         self.spawned_objects = weakref.WeakValueDictionary()
Exemplo n.º 7
0
 def on_first_display(self, register_type="single"):
     "Set up sounds and register for mouse events"
     self.hover_sound_object = get_sound(self.hover_sound)
     self.click_sound_object = get_sound(self.click_sound)
     self.base_look = self.owner.tint
     self.owner.mouse_register(register_type)
Exemplo n.º 8
0
 def setup_spawner(self):
     "Setup for the spawner. Subclasses should call this."
     if self.sound:
         self.sound_object = get_sound(self.sound, volume=self.volume)
     if self.spawned_objects is None:
         self.spawned_objects = weakref.WeakValueDictionary()