Changeset - db265102f7b5
[Not reviewed]
default
0 4 0
Drew Perttula - 12 years ago 2013-06-09 09:41:58
drewp@bigasterisk.com
shorter names on subterm uris. new sub zone ui padding.
Ignore-this: 98adeed8f38d043a61bc48245cf63e2a
4 files changed with 24 insertions and 9 deletions:
0 comments (0 inline, 0 general)
bin/curvecalc
Show inline comments
 
@@ -172,15 +172,27 @@ class Main(object):
 
            self.makeSubterm(newname, withCurve=wc)
 
        dialog.hide()
 

	
 
    def currentSong(self):
 
        with self.graph.currentState() as current:
 
    def currentSong(self, current=None):
 
        def fin(current):
 
            return current.value(self.session, L9['currentSong'])
 
        if current is None:
 
            with self.graph.currentState() as current:
 
                return fin(current)
 
        else:
 
            return fin(current)
 

	
 
    def songSubtermsContext(self):
 
        return self.currentSong()
 
    def songSubtermsContext(self, current=None):
 
        return self.currentSong(current=current)
 

	
 
    def makeSubterm(self, newname, withCurve=False, expr=None, sub=None):
 
        uri = self.currentSong() + "/sub/%f" % time.time()
 
        with self.graph.currentState() as current:
 
            song = self.currentSong(current=current)
 
            for i in range(1000):
 
                uri = song + "/subterm/%d" % i
 
                if (uri, None, None) not in current:
 
                    break
 
            else:
 
                raise ValueError("can't pick a name for the new subterm")
 

	
 
        ctx = self.songSubtermsContext()
 
        quads = [
light9/curvecalc/curvecalc.glade
Show inline comments
 
@@ -526,7 +526,7 @@
 
                        </child>
 
                      </object>
 
                      <packing>
 
                        <property name="expand">False</property>
 
                        <property name="expand">True</property>
 
                        <property name="fill">True</property>
 
                        <property name="position">0</property>
 
                      </packing>
 
@@ -535,11 +535,12 @@
 
                      <object class="GtkLabel" id="newSubZone">
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="ypad">18</property>
 
                        <property name="label" translatable="yes">Drop new sub here</property>
 
                        <signal name="drag-data-received" handler="onDragDataInNewSubZone" swapped="no"/>
 
                      </object>
 
                      <packing>
 
                        <property name="expand">True</property>
 
                        <property name="expand">False</property>
 
                        <property name="fill">True</property>
 
                        <property name="position">1</property>
 
                      </packing>
light9/curvecalc/subterm.py
Show inline comments
 
@@ -100,6 +100,8 @@ class Subterm(object):
 
            else:
 
                # otherwise, return our submaster multiplied by the value 
 
                # returned
 
                if subexpr_eval == 0:
 
                    return Submaster.Submaster("zero", {})
 
                subUri = current.value(self.uri, L9['sub'])
 
                sub = self.submasters.get_sub_by_uri(subUri)
 
                return sub * subexpr_eval
 
@@ -113,6 +115,7 @@ class Subterm(object):
 

	
 
        expr = current.value(self.uri, L9['expression'])
 
        
 
        expr = current.value(self.uri, L9['expression'])
 
        if not expr:
 
            dispatcher.send("expr_error", sender=self.uri, exc="no expr, using 0")
 
            return 0
light9/curvecalc/subtermview.py
Show inline comments
 
@@ -35,14 +35,13 @@ class Subexprview(object):
 
        
 
    def set_expression_from_graph(self):
 
        e = str(self.graph.value(self.ownerSubterm, L9['expression']))
 
        print "was going to set to %r" % e
 
        print "from graph, set to %r" % e
 

	
 
        if e != self.entryBuffer.get_text():
 
            self.entryBuffer.set_text(e, len(e))
 
            
 
    def entry_changed(self, *args):
 
        log.info("want to patch to %r", self.entryBuffer.get_text())
 
        return
 
        self.graph.patchObject(self.saveContext,
 
                               self.ownerSubterm,
 
                               L9['expression'],
0 comments (0 inline, 0 general)