Changeset - c579174d73b2
[Not reviewed]
default
0 1 0
Drew Perttula - 19 years ago 2006-06-19 01:08:07
drewp@bigasterisk.com
go button now skips intros
1 file changed with 9 insertions and 5 deletions:
0 comments (0 inline, 0 general)
bin/ascoltami
Show inline comments
 
@@ -202,12 +202,15 @@ class Player:
 
        elif time > self.total_time.get():
 
            self.mpd.seek(seconds=time - self.total_time.get(), song=2)
 
        else:
 
            self.mpd.seek(seconds=time, song=1)
 
        self.last_autopause_time = time
 

	
 
    def skip_intro(self):
 
        self.seek_to(0)
 

	
 
    def in_post(self):
 
        return (self.current_time.get() > self.total_time.get() +
 
                self.song_pad_time)
 

	
 
    def play_pause_toggle(self):
 
        def finish(status):
 
@@ -247,12 +250,14 @@ class GoButton:
 
                    lambda: self.player.play(nextPath))
 

	
 
        if state == 'pause':
 
            return "play", self.player.play
 

	
 
        if state == 'play':
 
            if self.player.current_time.get() < 0:
 
                return "skip intro", self.player.skip_intro
 
            if self.player.in_post():
 
                return "<nothing>", lambda: None
 
            return "skip to post", self.player.skip_to_post
 
        
 
    def action(self):
 
        desc, func = self._nextAction()
 
@@ -377,13 +382,13 @@ class Seeker(tk.Frame):
 
                            ('Song',player.filename_var, "%s"),
 
                            ('State', player.state, "%s")):
 
            tk.Label(self,text=txt,
 
                     relief='raised',bd=1,font='arial 9',
 
                     **appstyle).pack(side='left',fill='y')
 
            l = tk.Label(self,width=7, anchor='w', text=var.get(),
 
                         relief='sunken',bd=1,font='arial 12 bold',
 
                         relief='ridge',bd=1,font='arial 12 bold',
 
                         padx=2,pady=2,
 
                         bg='#800000',fg='white')
 
            l.pack(side='left',expand=1, fill='x')
 

	
 
            var.trace_variable('w',
 
                               lambda a,b,c,l=l,fmt=fmt,var=var:
 
@@ -414,14 +419,13 @@ class ControlButtons(tk.Frame):
 
        for tag, txt,cmd,key in [
 
            ('stop',
 
             'Stop\nC-s', player.stop, "<Control-s>"),
 
            ('pause',
 
             'Pause\nC-p', player.play_pause_toggle, "<Control-p>"),
 
            ('skip intro',
 
             'Skip Intro\nC-i',lambda: player.seek_to(0),
 
             "<Control-i>"),
 
             'Skip Intro\nC-i', player.skip_intro, "<Control-i>"),
 
            ('skip to post',
 
             'Skip to Post\nC-t', player.skip_to_post, "<Control-t>"),
 
            ('go', 'Go\nspace', self.goButton.action, "<Key-space>"),
 
            ]:
 
            b = tk.Button(self, text=txt, command=cmd,
 
                          font='arial 16 bold',
 
@@ -474,16 +478,16 @@ songlist.pack(fill='both',exp=1)
 

	
 
    songlist = buildsonglist(root, songfiles, player)
 

	
 
    seeker = Seeker(root, player)
 
    
 
    goRow = tk.Frame(root)
 
    tk.Label(goRow, text="Go button action:",
 
    tk.Label(goRow, text="Go button action",
 
             font='arial 9', **appstyle).pack(side='left', fill='both')
 
    goStatus = tk.Label(goRow, font='arial 12 bold', **appstyle)
 
    goStatus.config(bg='#800000', fg='white')
 
    goStatus.config(bg='#800000', fg='white', relief='ridge')
 
    goStatus.pack(side='left', expand=True, fill='x')
 

	
 
    go = GoButton(player, goStatus, songfiles)
 
    
 
    buts = ControlButtons(root, go, player, root)
 

	
0 comments (0 inline, 0 general)