Skip to content

Instantly share code, notes, and snippets.

@vivainio
Created April 28, 2012 08:31
Show Gist options
  • Save vivainio/2517158 to your computer and use it in GitHub Desktop.
Save vivainio/2517158 to your computer and use it in GitHub Desktop.
Leo notebook launch
from PyQt4.QtCore import QUrl, QObject
from PyQt4.QtDeclarative import QDeclarativeView
import leo.core.leoqwrappers
reload(leo.core.leoqwrappers)
from leo.core.leoqwrappers import *
class NbController:
def __init__(self):
c._view = view = QDeclarativeView()
ctx = view.rootContext()
c.__n = n = NodeWrapper(c, p.v)
mdl = [NodeWrapper(c, pos) for pos in c.all_nodes()]
ctx.setContextProperty("nodesModel", mdl)
path = g.os_path_join(g.computeLeoDir(), 'plugins', 'qmlnb', 'qml', 'leonbmain.qml')
view.setSource(QUrl(path))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
# Display the user interface and allow the user to interact with it.
view.setGeometry(100, 100, 800, 240)
view.show()
c.dummy = view
NbController()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment