# HG changeset patch # User Drew Perttula # Date 1339321556 0 # Node ID 10ee0756a119254f2720de7c64648def22a0a4fa # Parent c4a38a247b26d79e3f317a7f606fd4e3d4ed69c8 new python console Ignore-this: e6f8fa24c730e3cf8ed76be3fc1dcd01 diff -r c4a38a247b26 -r 10ee0756a119 bin/curvecalc --- a/bin/curvecalc Sun Jun 10 08:54:17 2012 +0000 +++ b/bin/curvecalc Sun Jun 10 09:45:56 2012 +0000 @@ -32,6 +32,7 @@ from light9.curvecalc.subterm import read_all_subs, savekey, graphPathForSubterms from light9.curvecalc.subtermview import add_one_subterm from light9.curvecalc.output import Output +from light9.gtkpyconsole import togglePyConsole def makeGraph(): graphOrig = showconfig.getGraph() @@ -111,6 +112,9 @@ # threads. I don't know whose they are. os.kill(os.getpid(), signal.SIGKILL) + def onPythonConsole(self, item): + togglePyConsole(self, item, self.__dict__) + def onSeeCurrentTime(self, item): dispatcher.send("see time") diff -r c4a38a247b26 -r 10ee0756a119 buildout.cfg --- a/buildout.cfg Sun Jun 10 08:54:17 2012 +0000 +++ b/buildout.cfg Sun Jun 10 09:45:56 2012 +0000 @@ -7,7 +7,8 @@ [external_libs] recipe = zc.recipe.egg -eggs = web.py==0.36 +eggs = ipython==0.8.4 + web.py==0.36 cyclone==1.0-rc4 rdflib==3.2.1 restkit==4.1.2 diff -r c4a38a247b26 -r 10ee0756a119 light9/curvecalc/curvecalc.glade --- a/light9/curvecalc/curvecalc.glade Sun Jun 10 08:54:17 2012 +0000 +++ b/light9/curvecalc/curvecalc.glade Sun Jun 10 09:45:56 2012 +0000 @@ -249,6 +249,33 @@ + + + True + False + False + Debug + True + + + True + False + True + + + True + False + False + Python console + True + + + + + + + + False diff -r c4a38a247b26 -r 10ee0756a119 light9/curvecalc/curveview.py --- a/light9/curvecalc/curveview.py Sun Jun 10 08:54:17 2012 +0000 +++ b/light9/curvecalc/curveview.py Sun Jun 10 09:45:56 2012 +0000 @@ -601,6 +601,7 @@ please pack self.box """ def __init__(self, name, curve, slider, knobEnabled, zoomControl): + self.name = name self.box = gtk.HandleBox() self.box.set_border_width(1) @@ -732,8 +733,10 @@ self.curvesVBox.pack_end(f.box) f.box.show_all() self.allCurveRows.add(f) - #f.curveView.goLive() + f.curveView.goLive() + def row(self, name): + return [r for r in self.allCurveRows if r.name == name][0] def goLive(self): """for startup performance, none of the curves redraw diff -r c4a38a247b26 -r 10ee0756a119 light9/gtkpyconsole.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/light9/gtkpyconsole.py Sun Jun 10 09:45:56 2012 +0000 @@ -0,0 +1,34 @@ +from lib.ipython_view import IPythonView +import pango, gtk + +def togglePyConsole(self, item, user_ns): + """ + toggles a toplevel window with an ipython console inside. + + self is an object we can stick the pythonWindow attribute on + + item is a checkedmenuitem + + user_ns is a dict you want to appear as locals in the console + """ + if item.get_active(): + if not hasattr(self, 'pythonWindow'): + self.pythonWindow = gtk.Window() + S = gtk.ScrolledWindow() + S.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + V = IPythonView(user_ns=user_ns) + V.modify_font(pango.FontDescription("luxi mono 8")) + V.set_wrap_mode(gtk.WRAP_CHAR) + S.add(V) + self.pythonWindow.add(S) + self.pythonWindow.show_all() + self.pythonWindow.set_size_request(750, 550) + self.pythonWindow.set_resizable(True) + def onDestroy(*args): + item.set_active(False) + del self.pythonWindow + self.pythonWindow.connect("destroy", onDestroy) + else: + if hasattr(self, 'pythonWindow'): + self.pythonWindow.destroy() +