# HG changeset patch # User Drew Perttula # Date 1339655011 0 # Node ID e8f9f4815ab45176c7a4646c1a5c0074379b8df9 # Parent 27fdbe9a8118288f416fba76b54c4d0c0bef194a attempt at subtermview autoscroll but it doesn't work Ignore-this: 4cb643412a6478a73526608a851ef9f4 diff -r 27fdbe9a8118 -r e8f9f4815ab4 bin/curvecalc --- a/bin/curvecalc Thu Jun 14 03:46:52 2012 +0000 +++ b/bin/curvecalc Thu Jun 14 06:23:31 2012 +0000 @@ -66,7 +66,8 @@ # 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 @@ 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 -r 27fdbe9a8118 -r e8f9f4815ab4 light9/curvecalc/curvecalc.glade --- a/light9/curvecalc/curvecalc.glade Thu Jun 14 03:46:52 2012 +0000 +++ b/light9/curvecalc/curvecalc.glade Thu Jun 14 06:23:31 2012 +0000 @@ -482,6 +482,8 @@ True False 2 + + diff -r 27fdbe9a8118 -r e8f9f4815ab4 light9/curvecalc/subtermview.py --- a/light9/curvecalc/subtermview.py Thu Jun 14 03:46:52 2012 +0000 +++ b/light9/curvecalc/subtermview.py Thu Jun 14 06:23:31 2012 +0000 @@ -66,11 +66,29 @@ 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)