Пример #1
0
        return data

    def show(self):
        self.w.show()

    def documentWindowToFront(self, sender=None):
        self.w.makeKey()

def do(sender):
    controller = getController()
    controller.runCode() # runt je script opnieuw.
    
def getController():
    document = AppKit.NSDocumentController.sharedDocumentController().currentDocument()
    print document
    
    if not document:
        raise DrawBotError("There is no document open")
    controller = document.vanillaWindowController
    try:
        controller._variableController.buildUI(variables)
        controller._variableController.show()
    except:
        controller._variableController = VariableController(variables, controller.runCode, document)

    return controller

w = Window((978, 388, 400, 400), 'Test Vanilla in DrawBot')
w.button = Button((10, 10, 150, 30), 'Do', callback=do)
w.checkbox = CheckBox((10, 150, 150, 30), 'Check', callback=do)
w.open()