Files
@ fe9dff7dbffd
Branch filter:
Location: light9/bin/musictime - annotation
fe9dff7dbffd
1.7 KiB
text/plain
added C-l to launch subcomposer- in progress
keyboardcomposer will probably launch subcomposer correctly,
but i don't even know if KC blocks or not (untested), and
the SC is certainly a child process of the KC, which is
undesirable. We think that some sort of setpgrp call in
the child may fix that.
keyboardcomposer will probably launch subcomposer correctly,
but i don't even know if KC blocks or not (untested), and
the SC is certainly a child process of the KC, which is
undesirable. We think that some sort of setpgrp call in
the child may fix that.
58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 4072d93f02c5 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 | #!/usr/bin/env python
import run_local
import light9.networking
import Tkinter as tk
import xmlrpclib, socket, time
class MusicTime:
def __init__(self, url):
self.player = xmlrpclib.Server(url)
def get_music_time(self):
playtime = None
while not playtime:
try:
playtime = self.player.gettime()
except socket.error, e:
print "Server error %s, waiting" % e
time.sleep(2)
return playtime
class MusicTimeTk(tk.Frame, MusicTime):
def __init__(self, master, url):
tk.Frame.__init__(self)
MusicTime.__init__(self, url)
self.timevar = tk.DoubleVar()
self.timelabel = tk.Label(self, textvariable=self.timevar, bd=2,
relief='raised', width=10, padx=2, pady=2, anchor='w')
self.timelabel.pack(expand=1, fill='both')
def print_time(evt, *args):
self.timevar.set(self.get_music_time())
print self.timevar.get(), evt.keysym
self.timelabel.bind('<KeyPress>', print_time)
self.timelabel.bind('<1>', print_time)
self.timelabel.focus()
self.update_time()
def update_time(self):
self.timevar.set(self.get_music_time())
self.after(100, self.update_time)
if __name__ == "__main__":
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-u", "--url", default=light9.networking.musicUrl())
options, args = parser.parse_args()
root = tk.Tk()
root.title("Time")
MusicTimeTk(root, options.url).pack(expand=1, fill='both')
try:
tk.mainloop()
except KeyboardInterrupt:
root.destroy()
|