Mercurial > code > home > repos > light9
view light9/gtkpyconsole.py @ 826:05aabe3d7b02
fix some minor issues with graph contexts
Ignore-this: 7fd366a4b6cbd94af6f9edb1b4b4c6fc
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Tue, 04 Jun 2013 20:28:49 +0000 |
parents | 10ee0756a119 |
children | 547d65ea9902 |
line wrap: on
line source
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()