comparison bin/curvecalc @ 699:d12bc8919d6e

ported the zoom control Ignore-this: edce8350a21280aebf2a0e69cd7335ea
author Drew Perttula <drewp@bigasterisk.com>
date Sun, 10 Jun 2012 05:33:25 +0000
parents 2aac2ef23495
children d5692ab6bc2a
comparison
equal deleted inserted replaced
698:2aac2ef23495 699:d12bc8919d6e
24 import logging 24 import logging
25 log = logging.getLogger() 25 log = logging.getLogger()
26 26
27 import run_local 27 import run_local
28 from light9 import showconfig, prof 28 from light9 import showconfig, prof
29 from light9.curvecalc.zoomcontrol import Zoomcontrol
30 from light9.curvecalc.curve import Curveset 29 from light9.curvecalc.curve import Curveset
31 from light9.curvecalc import curveview 30 from light9.curvecalc import curveview
32 from light9.curvecalc.musicaccess import Music, currentlyPlayingSong 31 from light9.curvecalc.musicaccess import Music, currentlyPlayingSong
33 from light9.wavelength import wavelength 32 from light9.wavelength import wavelength
34 from light9.uihelpers import toplevelat 33 from light9.uihelpers import toplevelat
62 self.add_subterms_for_song(song, curveset, subterms, 61 self.add_subterms_for_song(song, curveset, subterms,
63 wtree.get_object("subterms") 62 wtree.get_object("subterms")
64 ) 63 )
65 64
66 def refreshCurveView(): 65 def refreshCurveView():
67 m = os.path.getmtime(curveview.__file__.replace('.pyc', '.py')) 66 mtimes = [os.path.getmtime(f) for f in [
68 67 'light9/curvecalc/curveview.py',
69 if not hasattr(self, 'curvesetView') or self.curvesetView._mtime != m: 68 'light9/curvecalc/zoomcontrol.py',
69 ]]
70
71 if (not hasattr(self, 'curvesetView') or
72 self.curvesetView._mtimes != mtimes):
70 print "reload curveview.py" 73 print "reload curveview.py"
71 curvesVBox = wtree.get_object("curves") 74 curvesVBox = wtree.get_object("curves")
75 zoomControlBox = wtree.get_object("zoomControlBox")
72 [curvesVBox.remove(c) for c in curvesVBox.get_children()] 76 [curvesVBox.remove(c) for c in curvesVBox.get_children()]
77 [zoomControlBox.remove(c) for c in
78 zoomControlBox.get_children()]
73 try: 79 try:
74 linecache.clearcache() 80 linecache.clearcache()
75 reload(curveview) 81 reload(curveview)
76 # mem problem somewhere; need to hold a ref to this 82 # mem problem somewhere; need to hold a ref to this
77 self.curvesetView = curveview.Curvesetview( 83 self.curvesetView = curveview.Curvesetview(
78 curvesVBox, curveset) 84 curvesVBox, zoomControlBox, curveset)
79 self.curvesetView._mtime = m 85 self.curvesetView._mtimes = mtimes
80 86
81 # curvesetview must already exist, since this 87 # curvesetview must already exist, since this
82 # makes 'add_curve' signals for all the initial 88 # makes 'add_curve' signals for all the initial
83 # curves 89 # curves
84 curveset.load(basename=os.path.join( 90 curveset.load(basename=os.path.join(
95 reactor.callLater(1, refreshCurveView) 101 reactor.callLater(1, refreshCurveView)
96 refreshCurveView() 102 refreshCurveView()
97 103
98 self.makeStatusLines(wtree.get_object("status")) 104 self.makeStatusLines(wtree.get_object("status"))
99 105
100 #zc = Zoomcontrol(root) 106 def onSeeCurrentTime(self, item):
107 dispatcher.send("see time")
108
109 def onSeeTimeUntilEnd(self, item):
110 dispatcher.send("see time until end")
111
112 def onZoomAll(self, item):
113 dispatcher.send("show all")
101 114
102 def onPlayPause(self, item): 115 def onPlayPause(self, item):
103 # since the X coord in a curveview affects the handling, one 116 # since the X coord in a curveview affects the handling, one
104 # of them may be able to pick this up 117 # of them may be able to pick this up
105 results = dispatcher.send("onPlayPause") 118 results = dispatcher.send("onPlayPause")