~ubuntu-branches/ubuntu/oneiric/alarm-clock/oneiric

« back to all changes in this revision

Viewing changes to alarm-clock/VolumeFadeThread.py

  • Committer: Bazaar Package Importer
  • Author(s): Marco Rodrigues
  • Date: 2008-10-28 19:57:12 UTC
  • mto: (7.1.1 sid) (9.1.1 squeeze) (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20081028195712-e8kusg37fc1hnw0s
Tags: upstream-0.9.17
ImportĀ upstreamĀ versionĀ 0.9.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
class VolumeFade(Thread):
8
8
        def __init__(self, InitialVolume, FinalVolume, Duration, Button,
9
 
                                 RepeatTime, PlayerInstance):
 
9
                                 RepeatTime, PlayerInstance, MainClass):
10
10
 
11
11
                Thread.__init__(self)
12
12
 
 
13
                RepeatOnly = False
 
14
 
13
15
                self.setDaemon(True)
14
16
                self.InitialVolume = InitialVolume
15
17
                self.FinalVolume = FinalVolume * 10
25
27
                self.RepeatTime = RepeatTime
26
28
                self.IsRepeatingNow = False
27
29
 
 
30
                self.MainClass = MainClass
 
31
 
28
32
                if InitialVolume > FinalVolume:
29
33
                        self.FadeDirection = 0
30
34
                        self.FadeSpacing = InitialVolume - FinalVolume
64
68
 
65
69
                        time.sleep(0.01)
66
70
 
 
71
 
67
72
                        if self.PlayerInstance.get_state()[1] == gst.STATE_NULL:
68
73
                                break
69
74
 
87
92
 
88
93
 
89
94
                gtk.gdk.threads_enter()
90
 
                self.Button.set_sensitive(False)
 
95
                self.MainClass.StopTheSound()
91
96
                gtk.gdk.threads_leave()
92
97
 
93
98
 
94
 
 
95
99
        def FadeMessage(self, Bus, Message):
 
100
                if not self.MainClass.WhatPlaying == "F": return
96
101
                if Message.type == gst.MESSAGE_EOS:
97
102
                        self.PlayerInstance.set_state(gst.STATE_PAUSED)
98
103
                        self.PlayerInstance.seek_simple(self.TimeFormat, gst.SEEK_FLAG_FLUSH, 0)