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 gst
|
||||||
global player
|
global player
|
||||||
player.set_state(gst.STATE_PLAYING)
|
player.set_state(gst.STATE_PLAYING)
|
||||||
|
return get_state_locked() == gst.STATE_PLAYING
|
||||||
|
|
||||||
def play():
|
def play():
|
||||||
global lock
|
global lock
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
play_locked()
|
ret = play_locked()
|
||||||
lock.release()
|
lock.release()
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def pause_locked():
|
def pause_locked():
|
||||||
global gst
|
global gst
|
||||||
global player
|
global player
|
||||||
player.set_state(gst.STATE_PAUSED)
|
player.set_state(gst.STATE_PAUSED)
|
||||||
|
return get_state_locked() == gst.STATE_PAUSED
|
||||||
|
|
||||||
def pause():
|
def pause():
|
||||||
global lock
|
global lock
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
pause_locked()
|
ret = pause_locked()
|
||||||
lock.release()
|
lock.release()
|
||||||
|
return ret
|
||||||
|
|
||||||
def stop_locked():
|
def stop_locked():
|
||||||
pause_locked()
|
pause_locked()
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Button(gtk.Button):
|
||||||
self.set_relief(gtk.RELIEF_NONE)
|
self.set_relief(gtk.RELIEF_NONE)
|
||||||
self.click_id = self.connect("clicked", self.clicked)
|
self.click_id = self.connect("clicked", self.clicked)
|
||||||
if show == True:
|
if show == True:
|
||||||
self.show()
|
Button.show(self)
|
||||||
self.set_alignment(0,0)
|
self.set_alignment(0,0)
|
||||||
|
|
||||||
def clicked(self, button):
|
def clicked(self, button):
|
||||||
|
@ -38,7 +38,12 @@ class PlayButton(Button):
|
||||||
LS.event.invite("POSTSTOP", self.show)
|
LS.event.invite("POSTSTOP", self.show)
|
||||||
def clicked(self, button):
|
def clicked(self, button):
|
||||||
LS.music.play()
|
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):
|
class PauseButton(Button):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -48,6 +53,12 @@ class PauseButton(Button):
|
||||||
LS.event.invite("POSTSTOP", self.hide)
|
LS.event.invite("POSTSTOP", self.hide)
|
||||||
def clicked(self, button):
|
def clicked(self, button):
|
||||||
LS.music.pause()
|
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):
|
class StopButton(Button):
|
||||||
|
|
Loading…
Reference in New Issue