Changeset - e8f9f4815ab4
[Not reviewed]
default
0 3 0
Drew Perttula - 13 years ago 2012-06-14 06:23:31
drewp@bigasterisk.com
attempt at subtermview autoscroll but it doesn't work
Ignore-this: 4cb643412a6478a73526608a851ef9f4
3 files changed with 28 insertions and 2 deletions:
0 comments (0 inline, 0 general)
bin/curvecalc
Show inline comments
 
@@ -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
light9/curvecalc/curvecalc.glade
Show inline comments
 
@@ -482,6 +482,8 @@
 
                                <property name="visible">True</property>
 
                                <property name="can_focus">False</property>
 
                                <property name="n_columns">2</property>
 
                                <signal name="add" handler="onSubtermChildAdded" swapped="no"/>
 
                                <signal name="child-added" handler="onSubtermChildAdded" swapped="no"/>
 
                                <child>
 
                                  <placeholder/>
 
                                </child>
light9/curvecalc/subtermview.py
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general)