Changeset - 8169d88d4eb4
[Not reviewed]
default
0 3 0
Drew Perttula - 13 years ago 2012-06-13 06:07:27
drewp@bigasterisk.com
fix 1..5 keys. add more readme
Ignore-this: a5491a5e6de3facfda724a8b7d730ef8
3 files changed with 33 insertions and 17 deletions:
0 comments (0 inline, 0 general)
light9/curvecalc/curvecalc.glade
Show inline comments
 
@@ -688,13 +688,13 @@
 
    <property name="step_increment">1</property>
 
    <property name="page_increment">10</property>
 
  </object>
 
  <object class="GtkTextBuffer" id="help">
 
    <property name="text">Mousewheel zoom; C-p play/pause music at mouse
 
Over a curve: C to collapse; R to rebuild canvas widget
 
Curve point bindings: B1 drag point; C-B1 curve add point; S-B1 sketch points; 1..5 add point at time; B1 drag select points
 
Curve point bindings: B1 drag point; C-B1 curve add point; S-B1 sketch points; 1..5 add point at time cursor; B1 drag select points
 
Available in functions: nsin/ncos period=amp=1; within(a,b) bef(x) aft(x) compare to time; smoove(x) cubic smoothstep; chan(name); curvename(t) eval curve</property>
 
  </object>
 
  <object class="GtkImage" id="image2">
 
    <property name="visible">True</property>
 
    <property name="can_focus">False</property>
 
    <property name="stock">gtk-refresh</property>
light9/curvecalc/curveview.py
Show inline comments
 
@@ -108,20 +108,13 @@ class Curveview(object):
 

	
 
        # todo: hold control to get a [+] cursor
 
        #        def curs(ev):
 
        #            print ev.state
 
        #        self.bind("<KeyPress>",curs)
 
        #        self.bind("<KeyRelease-Control_L>",lambda ev: curs(0))
 
        
 
        if 0:
 
            for x in range(1, 6):
 
                def add_kb_marker_point(evt, x=x):
 
                    self.add_point((self.current_time(), (x - 1) / 4.0))
 

	
 
                self.bind("<Key-%s>" % x, add_kb_marker_point)
 

	
 
      
 
        # this binds on c-a-b1, etc
 
        if 0:
 
            self.regionzoom = RegionZoom(self, self.world_from_screen,
 
                                         self.screen_from_world)
 

	
 
        self.sketch = None # an in-progress sketch
 
@@ -145,12 +138,13 @@ class Curveview(object):
 
        sometimes after windows get resized, canvas gets stuck with a
 
        weird offset. I can't find where it is, so for now we support
 
        rebuilding the canvas widget
 
        """
 
        if hasattr(self, 'widget'):
 
            self.widget.destroy()
 
            self._time = -999
 
            print "rebuilding canvas"
 

	
 
        self.timelineLine = self.curveGroup = None
 
        self.widget = gtk.EventBox()
 
        self.widget.set_can_focus(True)
 
        self.widget.add_events(gtk.gdk.KEY_PRESS_MASK |
 
@@ -187,22 +181,22 @@ class Curveview(object):
 
        self.widget.connect("event", self.onAny)
 

	
 
    def onAny(self, w, event):
 
        print "   %s on %s" % (event, w)
 
        
 
    def onFocusIn(self, *args):
 
        print "focusin", args
 
        self.widget.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("red"))
 

	
 
    def onFocusOut(self, widget=None, event=None):
 
        #if event:
 
        #    import pdb;pdb.set_trace()
 
        print "focusout now", event.get_state() if event else 0
 
        self.widget.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("gray30"))
 

	
 
    def onKeyPress(self, *args):
 
        print "canvas key", args
 
    def onKeyPress(self, widget, event):
 
        print "canvas key", event
 
        if event.string in '12345':
 
            x = int(event.string)
 
            self.add_point((self.current_time(), (x - 1) / 4.0))
 

	
 
    def onExpose(self, *args):
 
        if self.culled:
 
            self.update_curve()
 

	
 
    def onDelete(self):
 
@@ -225,12 +219,15 @@ class Curveview(object):
 
            self.new_point_at_mouse(event)
 
        elif event.get_state() & gtk.gdk.SHIFT_MASK:
 
            self.sketch_press(event)
 
        else:
 
            self.select_press(event)
 

	
 
        # this stops some other handler that wants to unfocus 
 
        return True
 

	
 
    def playPause(self):
 
        """
 
        user has pressed ctrl-p over a curve view, possibly this
 
        one. Returns the time under the mouse if we know it, or else
 
        None
 

	
readme
Show inline comments
 
on dash:
 
Mini instructions:
 

	
 
% buildout2.7
 

	
 
% export LIGHT9_SHOW=path/to/light9/show/dance2011
 

	
 
Edit $LIGHT9_SHOW/config.n3 to set :musicRoot and the values under sh:netHome 
 

	
 
% bin/dmxserver --dummy
 
(leave that shell)
 

	
 
dash(pts/35):/my/dl/modified/mpd% src/mpd --no-daemon --verbose
 
% bin/ascoltami2
 
(leave that shell)
 

	
 
Browse to http://localhost:8040/ to see the music player.
 

	
 
% bin/curvecalc --reload http://light9.bigasterisk.com/show/dance2011/song16
 
(gui opens)
 

	
 
See bin/listsongs for a way to make zsh autocomplete on the last
 
argument to bin/curvecalc
 

	
 

	
 

	
 
--------------------------------
 

	
 
curvecalc upgrades:
 

	
0 comments (0 inline, 0 general)