Changeset - 566a781a4689
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 11 years ago 2014-06-16 23:56:35
drewp@bigasterisk.com
fix CC display update failure when rows are very small and you click in one and the size adjustment signal doesn't fire
Ignore-this: fcb851e0dc7eb50fc1b673d92533608a
1 file changed with 15 insertions and 10 deletions:
0 comments (0 inline, 0 general)
light9/curvecalc/curveview.py
Show inline comments
 
@@ -396,35 +396,38 @@ class Curveview(object):
 
        def sizeEvent(w, alloc):
 
            p = self.canvas.props
 
            if (alloc.width, alloc.height) != (p.x2, p.y2):
 
                p.x1, p.x2 = 0, alloc.width
 
                p.y1, p.y2 = 0, alloc.height
 
                # calling update_curve in this event usually doesn't work
 
                reactor.callLater(0, self.update_curve)
 
            return False
 
            
 
        #self.widget.connect('size-allocate', sizeEvent) # see docstring
 

	
 
        def visEvent(w, alloc):
 
            p = self.canvas.props
 
            w = self.widget.get_allocated_width()
 
            h = self.widget.get_allocated_height()
 
            if (w, h) != (p.x2, p.y2):
 
                p.x1, p.x2 = 0, w
 
                p.y1, p.y2 = 0, h
 
                self.update_curve()
 
            self.setCanvasToWidgetSize()
 
            return False
 
        self.widget.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK)
 
        self.widget.connect('visibility-notify-event', visEvent)
 
        
 

	
 
    def setCanvasToWidgetSize(self):
 
        p = self.canvas.props
 
        w = self.widget.get_allocated_width()
 
        h = self.widget.get_allocated_height()
 
        if (w, h) != (p.x2, p.y2):
 
            p.x1, p.x2 = 0, w
 
            p.y1, p.y2 = 0, h
 
            self.update_curve()
 

	
 
    def createCanvasWidget(self, parent):
 
        # this is only separate from createOuterWidgets because in the
 
        # past, i worked around display bugs by recreating the whole
 
        # canvas widget. If that's not necessary, this could be more
 
        # clearly combined with createOuterWidgets since there's no
 
        # time you'd want that one but not this one.
 
        canvas = GooCanvas.Canvas()
 
        parent.pack_start(canvas, expand=True, fill=True, padding=0)
 
        canvas.show()
 

	
 
        p = canvas.props
 
        p.background_color = 'black'
 
@@ -1104,26 +1107,28 @@ class CurveRow(object):
 
    def destroy(self):
 
        self.curveView.entered = False  # help suppress bad position events
 
        del self.curveView
 
        self.box.destroy()
 
        
 
    def initCurveView(self):
 
        self.curveView.widget.show()
 
        self.setHeight(100)
 
        self.cols.pack_start(self.curveView.widget, expand=True, fill=True, padding=0)       
 

	
 
    def setHeight(self, h):
 
        self.curveView.widget.set_size_request(-1, h)
 
        # the event watcher wasn't catching these
 
        reactor.callLater(.5, self.curveView.update_curve)
 

	
 
        # this should have been automatic when the size changed, but
 
        # the signals for that are wrong somehow.
 
        reactor.callLater(0, self.curveView.setCanvasToWidgetSize) 
 
        
 
    def setupControls(self, controls, name, curve):
 
        box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
 
        controls.add(box)
 

	
 
        curve_name_label = Gtk.LinkButton()
 
        def update_label():
 
            # todo: abort if we don't still exist...
 
            p = curve_name_label.props
 
            p.uri = curve.uri
 
            p.label = self.graph.label(curve.uri)
 
        self.graph.addHandler(update_label)
0 comments (0 inline, 0 general)