Skip to content

Commit

Permalink
slight jswidget tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bqpd committed Jan 23, 2015
1 parent 5b90d95 commit 753c9c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/source/ipynb/Box/Box.rst
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@ notebook hosted by `nbviewer <http://nbviewer.ipython.org/>`__.
}
});

MathJax.Hub.Typeset()
jswidget_0.ractive.onchange()
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"jswiget_0_container"]);
jswidget_0.ractive.onchange()
})</script>


Expand Down
5 changes: 2 additions & 3 deletions gpkit/interactive/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def jswidget(gp, ractorfn, after, ranges):
data_init += "%s: %i, " % (varname, (len(array)-1)/2)
i += 1

evalarray = ["console.log('unfilled')"]*(np.prod(lengths))
evalarray = [""]*(np.prod(lengths))

gp.sweep = {}
gp.prewidget = gp.last
Expand Down Expand Up @@ -100,13 +100,12 @@ def jswidget(gp, ractorfn, after, ranges):
document.getElementById("$w-"+varname).innerText = Math.round(100*$w.ranges[varname][idx])/100
idxsum += idx*$w.bases[i]
}
if ($w.storage[idxsum] === "console.log('unfilled')") {
if ($w.storage[idxsum] === "") {
r.infeasibilitywarning = "Infeasible problem"
} else {
r.infeasibilitywarning = ""
eval($w.storage[idxsum] + $w.after)
}
console.log(idxsum)
}
});
Expand Down
7 changes: 5 additions & 2 deletions ipynb/Box/Box.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. figure:: boxlogo.svg
:align: left

BOX
===
Expand Down Expand Up @@ -355,6 +357,7 @@ points you see.
</svg>
<div style="text-align: right; font-weight: 700; font-size: 2em;">{{infeasibilitywarning}}</div>
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
var r = {
infeasibilitywarning: "",
Expand Down Expand Up @@ -552,8 +555,8 @@ notebook hosted by `nbviewer <http://nbviewer.ipython.org/>`__.
}
});

MathJax.Hub.Typeset()
jswidget_0.ractive.onchange()
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"jswiget_0_container"]);
jswidget_0.ractive.onchange()
})</script>


Expand Down

0 comments on commit 753c9c4

Please sign in to comment.