Mercurial > code > home > repos > light9
annotate bin/musictime @ 2328:d050b8efda9d
fix bug with uninitialized effect ,and prefer a dead effect over a graph reload
author | drewp@bigasterisk.com |
---|---|
date | Thu, 01 Jun 2023 18:42:36 -0700 |
parents | 82e98aa4d159 |
children |
rev | line source |
---|---|
1940
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
1 #!bin/python |
1866
3c523c71da29
pyflakes cleanups and some refactors
Drew Perttula <drewp@bigasterisk.com>
parents:
1859
diff
changeset
|
2 import run_local # noqa |
266
58bbf9f42457
Revive MusicTime as bin/musictime, use light9.networking for music server location
David McClosky <dmcc@bigasterisk.com>
parents:
205
diff
changeset
|
3 import light9.networking |
58bbf9f42457
Revive MusicTime as bin/musictime, use light9.networking for music server location
David McClosky <dmcc@bigasterisk.com>
parents:
205
diff
changeset
|
4 |
1859
f066d6e874db
2to3 with these fixers: all idioms set_literal
drewp@bigasterisk.com
parents:
1858
diff
changeset
|
5 import tkinter as tk |
1942 | 6 from twisted.internet import reactor, tksupport, task |
1858 | 7 |
1940
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
8 from light9.ascoltami.musictime_client import MusicTime |
0 | 9 |
1940
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
10 mt = MusicTime() |
1858 | 11 |
1942 | 12 |
0 | 13 class MusicTimeTk(tk.Frame, MusicTime): |
1858 | 14 |
266
58bbf9f42457
Revive MusicTime as bin/musictime, use light9.networking for music server location
David McClosky <dmcc@bigasterisk.com>
parents:
205
diff
changeset
|
15 def __init__(self, master, url): |
0 | 16 tk.Frame.__init__(self) |
266
58bbf9f42457
Revive MusicTime as bin/musictime, use light9.networking for music server location
David McClosky <dmcc@bigasterisk.com>
parents:
205
diff
changeset
|
17 MusicTime.__init__(self, url) |
0 | 18 self.timevar = tk.DoubleVar() |
1858 | 19 self.timelabel = tk.Label(self, |
20 textvariable=self.timevar, | |
21 bd=2, | |
22 relief='raised', | |
23 width=10, | |
24 padx=2, | |
25 pady=2, | |
26 anchor='w') | |
0 | 27 self.timelabel.pack(expand=1, fill='both') |
1858 | 28 |
0 | 29 def print_time(evt, *args): |
1940
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
30 self.timevar.set(mt.getLatest().get('t', 0)) |
1859
f066d6e874db
2to3 with these fixers: all idioms set_literal
drewp@bigasterisk.com
parents:
1858
diff
changeset
|
31 print(self.timevar.get(), evt.keysym) |
1858 | 32 |
0 | 33 self.timelabel.bind('<KeyPress>', print_time) |
34 self.timelabel.bind('<1>', print_time) | |
35 self.timelabel.focus() | |
1940
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
36 task.LoopingCall(self.update_time).start(.1) |
1942 | 37 |
0 | 38 def update_time(self): |
1940
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
39 t = self.getLatest().get('t', 0) |
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
40 self.timevar.set(t) |
1858 | 41 |
1942 | 42 |
0 | 43 if __name__ == "__main__": |
205
3905d3c92aaa
twisted mainloop, more row-change keys, xmlrpc fadesub command on port 8050
drewp
parents:
0
diff
changeset
|
44 from optparse import OptionParser |
0 | 45 parser = OptionParser() |
623
46d319974176
move networking settings to config.n3
drewp@bigasterisk.com
parents:
532
diff
changeset
|
46 parser.add_option("-u", "--url", default=light9.networking.musicPlayer.url) |
0 | 47 options, args = parser.parse_args() |
1858 | 48 |
0 | 49 root = tk.Tk() |
50 root.title("Time") | |
266
58bbf9f42457
Revive MusicTime as bin/musictime, use light9.networking for music server location
David McClosky <dmcc@bigasterisk.com>
parents:
205
diff
changeset
|
51 MusicTimeTk(root, options.url).pack(expand=1, fill='both') |
1940
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
52 tksupport.install(root, ms=20) |
cce016abe31e
sort of revive musictime. drop curvecalc time polling.
drewp@bigasterisk.com
parents:
1866
diff
changeset
|
53 reactor.run() |