Only change play button when playing
If no song is playing and the play button is clicked we shouldn't switch to the pause button. This could confuse users.
This commit is contained in:
parent
e67c8257c9
commit
3ed0b10aab
|
@ -127,24 +127,28 @@ def play_locked():
|
|||
global gst
|
||||
global player
|
||||
player.set_state(gst.STATE_PLAYING)
|
||||
return get_state_locked() == gst.STATE_PLAYING
|
||||
|
||||
def play():
|
||||
global lock
|
||||
lock.acquire()
|
||||
play_locked()
|
||||
ret = play_locked()
|
||||
lock.release()
|
||||
return ret
|
||||
|
||||
|
||||
def pause_locked():
|
||||
global gst
|
||||
global player
|
||||
player.set_state(gst.STATE_PAUSED)
|
||||
return get_state_locked() == gst.STATE_PAUSED
|
||||
|
||||
def pause():
|
||||
global lock
|
||||
lock.acquire()
|
||||
pause_locked()
|
||||
ret = pause_locked()
|
||||
lock.release()
|
||||
return ret
|
||||
|
||||
def stop_locked():
|
||||
pause_locked()
|
||||
|
|
|
@ -17,7 +17,7 @@ class Button(gtk.Button):
|
|||
self.set_relief(gtk.RELIEF_NONE)
|
||||
self.click_id = self.connect("clicked", self.clicked)
|
||||
if show == True:
|
||||
self.show()
|
||||
Button.show(self)
|
||||
self.set_alignment(0,0)
|
||||
|
||||
def clicked(self, button):
|
||||
|
@ -38,7 +38,12 @@ class PlayButton(Button):
|
|||
LS.event.invite("POSTSTOP", self.show)
|
||||
def clicked(self, button):
|
||||
LS.music.play()
|
||||
|
||||
def hide(self, playing):
|
||||
if playing == True:
|
||||
Button.hide(self)
|
||||
def show(self, paused):
|
||||
if paused == True:
|
||||
Button.show(self)
|
||||
|
||||
class PauseButton(Button):
|
||||
def __init__(self):
|
||||
|
@ -48,6 +53,12 @@ class PauseButton(Button):
|
|||
LS.event.invite("POSTSTOP", self.hide)
|
||||
def clicked(self, button):
|
||||
LS.music.pause()
|
||||
def hide(self, paused):
|
||||
if paused == True:
|
||||
Button.hide(self)
|
||||
def show(self, playing):
|
||||
if playing == True:
|
||||
Button.show(self)
|
||||
|
||||
|
||||
class StopButton(Button):
|
||||
|
|
Loading…
Reference in New Issue