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
 
@@ -63,13 +63,14 @@ class Main(object):
 
        mainwin.set_title("curvecalc - %s" % graph.label(song))
 
        mainwin.parse_geometry("715x930+1080+26")
 

	
 
        # 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()       
 
        
 
        self.makeStatusLines(wtree.get_object("status"))
 

	
 
    def onNewCurve(self, *args):
 
@@ -103,12 +104,17 @@ class Main(object):
 
        dialog.hide()
 

	
 
    def refreshTheme(self):
 
        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
 
        # threads. I don't know whose they are.
 
        os.kill(os.getpid(), signal.SIGKILL)
 

	
light9/curvecalc/curvecalc.glade
Show inline comments
 
@@ -479,12 +479,14 @@
 
                            <property name="shadow_type">none</property>
 
                            <child>
 
                              <object class="GtkTable" id="subterms">
 
                                <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>
 
                                <child>
 
                                  <placeholder/>
 
                                </child>
light9/curvecalc/subtermview.py
Show inline comments
 
@@ -63,14 +63,32 @@ def add_one_subterm(graph, subUri, curve
 
    term = Subterm(Submaster.Submaster(graph=graph, name=subname, sub=subUri),
 
                   Subexpr(curveset, expr))
 
    subterms.append(term)
 

	
 
    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)