def init(self): self = super(GlyphsDrawBotController, self).init() document = None # make a window self.w = Window((400, 400), "DrawBot", minSize=(200, 200), textured=False) # setting previously stored frames, if any self.w.getNSWindow().setFrameUsingName_(self.windowAutoSaveName) _NSWindow = self.w.getNSWindow() self.setWindow_(_NSWindow) _NSWindow.setDelegate_(self) _NSWindow.setContentBorderThickness_forEdge_(27, 1) try: # on 10.7+ full screen support self.w.getNSWindow().setCollectionBehavior_(128) # NSWindowCollectionBehaviorFullScreenPrimary except: pass # the code editor self.codeView = CodeEditor((0, 0, -0, -0)) self.codeView.getNSTextView().bind_toObject_withKeyPath_options_("value", self, "document.text", {NSContinuouslyUpdatesValueBindingOption:True}) scrollview = self.codeView.getNSTextView().enclosingScrollView() scrollview.setBorderType_(0) # the output view (will catch all stdout and stderr) self.outPutView = OutPutEditor((0, 0, -0, -0), readOnly=True) scrollview = self.outPutView.getNSTextView().enclosingScrollView() scrollview.setBorderType_(0) # the view to draw in self.drawView = DrawView((0, 0, -0, -0)) pdfView = self.drawView.getNSView() view = pdfView.documentView() # the view with all thumbnails self.thumbnails = ThumbnailView((0, 0, -0, -0)) # connect the thumbnail view with the draw view self.thumbnails.setDrawView(self.drawView) # collect all code text view in a splitview paneDescriptors = [ dict(view=self.codeView, identifier="codeView", minSize=50, canCollapse=False), dict(view=self.outPutView, identifier="outPutView", size=100, minSize=50, canCollapse=False), ] self.codeSplit = SplitView((0, 0, -0, -0), paneDescriptors, isVertical=False) # collect the draw scroll view and the code split view in a splitview paneDescriptors = [ dict(view=self.thumbnails, identifier="thumbnails", minSize=100, size=100, maxSize=100), dict(view=self.drawView, identifier="drawView", minSize=50), dict(view=self.codeSplit, identifier="codeSplit", minSize=50, canCollapse=False), ] self.w.split = SplitView((0, 0, -0, -27), paneDescriptors) self.w.runButton = Button((-67, -24, 50, 20), "Run", callback=self.runButtonAction_) self.w.runButton.bind("\r", ["command"]) self.w.runButton._nsObject.setToolTip_(u"Run the script (cmd+\u23CE)") self.w.clearButton = Button((-135, -24, 58, 20), "Clear", callback=self.clearButtonAction_) self.w.clearButton.bind("k", ["command"]) self.w.clearButton._nsObject.setToolTip_(u"Clear Log (cmd+K)") # get the real size of the window windowX, windowY, windowWidth, windowHeight = self.w.getPosSize() # set the split view dividers at a specific position based on the window size self.w.split.setDividerPosition(0, 0) self.w.split.setDividerPosition(1, windowWidth * .6) self.w.split.setDividerPosition(1, windowWidth * .6) self.codeSplit.setDividerPosition(0, windowHeight * .7) return self