Kaydet (Commit) d5d1912e authored tarafından Guido van Rossum's avatar Guido van Rossum

New getstatus() return.

Use togglepause() only if playing or paused.
üst ece6efe5
# Window interface to (some of) the CD player's vital audio functions # Window interface to (some of) the CD player's vital audio functions
import cd import cd
import CD
import stdwin import stdwin
from stdwinevents import * from stdwinevents import *
import mainloop import mainloop
...@@ -42,7 +43,13 @@ def but1(win): ...@@ -42,7 +43,13 @@ def but1(win):
update(win) update(win)
def but2(win): def but2(win):
win.player.togglepause() state = win.player.getstatus()[0]
if state == CD.READY:
win.player.play(1, 1)
elif state in (CD.PLAYING, CD.PAUSED):
win.player.togglepause()
else:
stdwin.fleep()
update(win) update(win)
def but3(win): def but3(win):
...@@ -67,13 +74,13 @@ def draw(win): ...@@ -67,13 +74,13 @@ def draw(win):
def drawstatus(win, d): def drawstatus(win, d):
left, top, right, bottom, v1, v2 = getgeo(win) left, top, right, bottom, v1, v2 = getgeo(win)
status = win.player.getstatus() state, track, curtime, abstime, totaltime, first, last, \
state = status[0] scsi_audio, cur_block, dummy = win.player.getstatus()
if 0 <= state < len(statedict): if 0 <= state < len(statedict):
message = statedict[state] message = statedict[state]
else: else:
message = `status` message = `status`
message = message + ' track ' + `status[1]` + ' of ' + `status[12]` message = message + ' track ' + `track` + ' of ' + `last`
d.erase((left, top), (right, v1)) d.erase((left, top), (right, v1))
box(d, left, top, right, v1, message) box(d, left, top, right, v1, message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment