Created
April 28, 2012 08:31
-
-
Save vivainio/2517158 to your computer and use it in GitHub Desktop.
Leo notebook launch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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