# HG changeset patch # User Drew Perttula # Date 2012-06-14 06:23:31 # Node ID e8f9f4815ab45176c7a4646c1a5c0074379b8df9 # Parent 27fdbe9a8118288f416fba76b54c4d0c0bef194a attempt at subtermview autoscroll but it doesn't work Ignore-this: 4cb643412a6478a73526608a851ef9f4 diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -66,7 +66,8 @@ class Main(object): # this is the only one i found that would set the size right, # but it's a minimum size, which i don't really want mainwin.set_size_request(1000, 1000) - + + wtree.get_object("subterms").connect("add", self.onSubtermChildAdded) self.add_subterms_for_song(song, curveset, subterms) self.refreshCurveView() @@ -106,6 +107,11 @@ class Main(object): gtk.rc_reparse_all() reactor.callLater(1, self.refreshTheme) + def onSubtermChildAdded(self, subtermsTable, *args): + # this would probably work, but isn't getting called + v = subtermsTable.get_parent().props.vadjustment + v.props.value = v.props.upper + def onQuit(self, *args): reactor.crash() # there's a hang after this, maybe in sem_wait in two diff --git a/light9/curvecalc/curvecalc.glade b/light9/curvecalc/curvecalc.glade --- a/light9/curvecalc/curvecalc.glade +++ b/light9/curvecalc/curvecalc.glade @@ -482,6 +482,8 @@ True False 2 + + diff --git a/light9/curvecalc/subtermview.py b/light9/curvecalc/subtermview.py --- a/light9/curvecalc/subtermview.py +++ b/light9/curvecalc/subtermview.py @@ -66,11 +66,29 @@ def add_one_subterm(graph, subUri, curve stv = Subtermview(graph, term) y = master.get_property('n-rows') - master.resize(y + 1, columns=2) master.attach(stv.label, 0, 1, y, y + 1, xoptions=0, yoptions=0) master.attach(stv.exprView, 1, 2, y, y + 1, yoptions=0) + scrollToRowUponAdd(stv.label) if show: master.show_all() return term +def scrollToRowUponAdd(widgetInRow): + """when this table widget is ready, scroll the table so we can see it""" + + # this doesn't work right, yet + return + + vp = widgetInRow + while vp.get_name() != 'GtkViewport': + print "walk", vp.get_name() + vp = vp.get_parent() + adj = vp.props.vadjustment + + def firstExpose(widget, event, adj, widgetInRow): + print "scroll", adj.props.value + adj.props.value = adj.props.upper + widgetInRow.disconnect(handler) + + handler = widgetInRow.connect('expose-event', firstExpose, adj, widgetInRow)