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
 
@@ -205,6 +205,9 @@ class Player:
 
            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)
 
@@ -250,6 +253,8 @@ class GoButton:
 
            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
 
@@ -380,7 +385,7 @@ class Seeker(tk.Frame):
 
                     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')
 
@@ -417,8 +422,7 @@ class ControlButtons(tk.Frame):
 
            ('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>"),
 
@@ -477,10 +481,10 @@ songlist.pack(fill='both',exp=1)
 
    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)
0 comments (0 inline, 0 general)