Changeset - 2d058d0bc1ea
[Not reviewed]
default
0 3 1
Drew Perttula - 14 years ago 2011-06-17 08:17:14
drewp@bigasterisk.com
zoom crushing fix; c-a-drag zoom fix
Ignore-this: db04ac435d4f1fe7ba8714e836ad7767
4 files changed with 41 insertions and 17 deletions:
0 comments (0 inline, 0 general)
light9/cursor1.xbm
Show inline comments
 
new file 100644
 
#define cursor1_width 20
 
#define cursor1_height 20
 
#define cursor1_x_hot 5
 
#define cursor1_y_hot 5
 
static char cursor1_bits[] = {
 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x07, 0x00, 
 
  0x00, 0x1d, 0x00, 0x00, 0x27, 0x00, 0x00, 0x23, 0x00, 0x80, 0x21, 0x00, 
 
  0x80, 0x21, 0x00, 0x80, 0x23, 0x00, 0x80, 0x3e, 0x00, 0x80, 0x1f, 0x00, 
 
  0x80, 0x71, 0x00, 0x80, 0x47, 0x00, 0x80, 0x7c, 0x00, 0xc0, 0x00, 0x00, 
 
  0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00, 
 
  };
light9/curve.py
Show inline comments
 
@@ -235,16 +235,16 @@ class Curveview(tk.Canvas):
 
        self.bind("<Shift-ButtonRelease-1>", self.sketch_release)
 

	
 

	
 
        self.dragging_dots = False
 
        self.selecting = False
 
        self.bind("<ButtonPress-1>",#"<Alt-Key>",
 
                  self.select_press)
 
                  self.select_press, add=True)
 
        self.bind("<Motion>", self.select_motion, add=True)
 
        self.bind("<ButtonRelease-1>", #"<Alt-KeyRelease>",
 
                  self.select_release)
 
                  self.select_release, add=True)
 

	
 
        self.bind("<ButtonPress-1>", self.check_deselect, add=True)
 

	
 
        self.bind("<Key-m>", lambda *args: self.curve.toggleMute())
 
        self.bind("<Key-c>", lambda *args: dispatcher.send('toggle collapse',
 
                                                           sender=self.curve))
 
@@ -288,12 +288,15 @@ class Curveview(tk.Canvas):
 
            self.find_index_near(ev.x, ev.y)
 
        except ValueError:
 
            self.selected_points[:] = []
 
            self.highlight_selected_dots()
 

	
 
    def select_press(self,ev):
 
        # todo: these select_ handlers are getting called on c-a-drag
 
        # zooms too. the dispatching should be more selective than
 
        # just calling both handlers all the time
 
        self.print_state("select_press")
 
        if self.dragging_dots:
 
            return
 
        if not self.selecting:
 
            self.selecting = True
 
            self.select_start = self.world_from_screen(ev.x,0)[0]
light9/zoomcontrol.py
Show inline comments
 
@@ -34,13 +34,25 @@ class Zoomcontrol(object,tk.Canvas):
 
        def fget(self): return self._end
 
        def fset(self,v):
 
            v = min(self.maxtime,v)
 
            self._end = v
 
        return locals()
 
    end = property(**end())
 
        
 

	
 
    def offset():
 
        doc = "virtual attr that adjusts start and end together"
 
        def fget(self):
 
            # work off the midpoint so that "crushing works equally
 
            # well in both directions
 
            return (self.start + self.end) / 2
 
        def fset(self, value):
 
            d = self.end-self.start
 
            self.start = value - d / 2
 
            self.end = value + d / 2
 
        return locals()
 
    offset = property(**offset())
 

	
 
    def __init__(self,master,**kw):
 
        self.maxtime=370
 
        self.start=0
 
        self.end=20
 
        tk.Canvas.__init__(self,master,width=250,height=30,
 
@@ -120,35 +132,25 @@ class Zoomcontrol(object,tk.Canvas):
 
    def press(self,ev,attr):
 
        self.adjustingattr = attr
 
        
 
    def release(self,ev):
 
        if hasattr(self,'adjustingattr'): del self.adjustingattr
 
        if hasattr(self,'lastx'): del self.lastx
 
        
 
    def adjust(self,ev,attr=None):
 

	
 
        if not hasattr(self,'adjustingattr'):
 
            return
 
        attr = self.adjustingattr
 
        
 
        if not hasattr(self,'lastx'):
 
            self.lastx = ev.x
 
        new = self.can_for_t(getattr(self,attr)) + (ev.x - self.lastx)
 
        self.lastx = ev.x
 
        setattr(self,attr,self.t_for_can(new))
 
        self.redrawzoom()
 
        
 
    def offset():
 
        doc = "virtual attr that adjusts start and end together"
 
        def fget(self):
 
            return self.start
 
        def fset(self, value):
 
            d = self.end-self.start
 
            self.start = value
 
            self.end = self.start+d
 
        return locals()
 
    offset = property(**offset())
 

	
 
    def can_for_t(self,t):
 
        return (t-self.mintime)/(self.maxtime-self.mintime)*(self.winfo_width()-30)+20
 
    def t_for_can(self,x):
 
        return (x-20)/(self.winfo_width()-30)*(self.maxtime-self.mintime)+self.mintime
 

	
 
@@ -160,12 +162,15 @@ class Zoomcontrol(object,tk.Canvas):
 
        lip = 6
 
        scan = self.can_for_t(self.start)
 
        ecan = self.can_for_t(self.end)
 
        self.coords(self.leftbrack,scan+lip,y1,scan,y1,scan,y2,scan+lip,y2)
 
        self.coords(self.rightbrack,ecan-lip,y1,ecan,y1,ecan,y2,ecan-lip,y2)
 
        self.coords(self.shade,scan+5,y1+lip,ecan-5,y2-lip)
 
        self.redrawTics()
 
        
 
    def redrawTics(self):
 
        self.delete("tics")
 
        lastx=-1000
 
        for t in range(0,int(self.maxtime)):
 
            x = self.can_for_t(t)
 
            if 0 < x < self.winfo_width() and x-lastx>30:
 
                txt=str(t)
 
@@ -190,23 +195,26 @@ class RegionZoom:
 
        for evtype, method in [("ButtonPress-1",self.press),
 
                               ("Motion",self.motion),
 
                               ("ButtonRelease-1",self.release)]:
 
            #canvas.bind("<Control-Alt-%s>" % evtype, method, add=True)
 
            if 1 or evtype != "ButtonPress-1":
 
                canvas.bind("<%s>" % evtype, method,add=True)
 

	
 
        canvas.bind("<Leave>", self.finish)
 
        self.start_t = self.old_cursor = None
 
        self.state = self.mods = None
 

	
 
    def press(self,ev):
 
        if self.state is not None:
 
            self.finish()
 

	
 
        if ev.state == 12:
 
            self.mods = "c-a"
 
        elif ev.state == 13:
 
            # todo: right now this never happens because only the
 
            # sketching handler gets the event
 
            self.mods = "c-s-a"
 
        elif ev.state == 0:
 
            return # no 
 
            self.mods = "none"
 
        else:
 
            return
 
@@ -214,19 +222,21 @@ class RegionZoom:
 
            
 
        self.start_t = self.end_t = self.world_from_screen(ev.x,0)[0]
 
        self.start_x = ev.x
 
        can = self.canvas
 

	
 
        for pos in ('start_t','end_t','hi','lo'):
 
            can.create_line(0,0,50,50, width=3, fill='black',
 
            can.create_line(0,0,50,50, width=3, fill='yellow',
 
                            tags=("regionzoom",pos))
 
        # if updatelines isn't called here, subsequent updatelines
 
        # will fail for reasons i don't understand
 
        self.updatelines()
 

	
 
        cursors.push(can, "@/home/drewp/projects/light9/cursor1.xbm")
 
        # todo: just holding the modifiers ought to turn on the zoom
 
        # cursor (which is not finished)
 
        cursors.push(can, "@light9/cursor1.xbm")
 
        
 
    def updatelines(self):
 

	
 
        # better would be a gray25 rectangle over the region
 
        
 
        can = self.canvas
show/dance2010/readme
Show inline comments
 
@@ -68,13 +68,13 @@ OK curvecalc still has a problem making 
 
        File "/usr/local/lib/python2.6/dist-packages/restkit-1.3.1-py2.6.egg/restkit/resource.py", line 135, in get
 
          return self.request("GET", path=path, headers=headers, **params)
 
        File "/usr/local/lib/python2.6/dist-packages/restkit-1.3.1-py2.6.egg/restkit/resource.py", line 231, in request
 
          raise RequestError(e)
 
      RequestError: [Errno 111] Connection refused
 
- asco stops considerably after the autostop time (according to curvecalc)
 
- CC should support zoom-crushing towards the left as well
 
OK CC should support zoom-crushing towards the left as well
 
- vidref's replay 'enabled' button should be completely sticky across sessions
 
- audio process pipeline; RDF graph should track versions of songs (padded, normalized)
 
OK vidref can loop like this if asco goes down:
 
       File "/home/drewp/projects/light9/light9/vidref/main.py", line 168, in updateLoop
 
         self.replayViews.update(position)
 
       File "/home/drewp/projects/light9/light9/vidref/replay.py", line 42, in update
0 comments (0 inline, 0 general)