Mercurial > code > home > repos > light9
changeset 898:db265102f7b5
shorter names on subterm uris. new sub zone ui padding.
Ignore-this: 98adeed8f38d043a61bc48245cf63e2a
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sun, 09 Jun 2013 09:41:58 +0000 |
parents | fc651955d6d9 |
children | 21974e0ef0c4 |
files | bin/curvecalc light9/curvecalc/curvecalc.glade light9/curvecalc/subterm.py light9/curvecalc/subtermview.py |
diffstat | 4 files changed, 24 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/curvecalc Sun Jun 09 08:48:22 2013 +0000 +++ b/bin/curvecalc Sun Jun 09 09:41:58 2013 +0000 @@ -172,15 +172,27 @@ 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 = [
--- a/light9/curvecalc/curvecalc.glade Sun Jun 09 08:48:22 2013 +0000 +++ b/light9/curvecalc/curvecalc.glade Sun Jun 09 09:41:58 2013 +0000 @@ -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>
--- a/light9/curvecalc/subterm.py Sun Jun 09 08:48:22 2013 +0000 +++ b/light9/curvecalc/subterm.py Sun Jun 09 09:41:58 2013 +0000 @@ -100,6 +100,8 @@ 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 @@ 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
--- a/light9/curvecalc/subtermview.py Sun Jun 09 08:48:22 2013 +0000 +++ b/light9/curvecalc/subtermview.py Sun Jun 09 09:41:58 2013 +0000 @@ -35,14 +35,13 @@ 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'],