def __init__(self): self.w = ShowHideFloatingWindow((300, 500), "Debugger", minSize=(200, 300), autosaveName="DrawBotDebugWindow", initiallyVisible=False) self.w.debugText = OutPutEditor((0, 0, -0, -0), readOnly=True) self._savedStdout = sys.stdout self._savedStderr = sys.stderr sys.stdout = self sys.stderr = self self.w.open()
def __init__(self): # 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) 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)) # the output view (will catch all stdout and stderr) self.outPutView = OutPutEditor((0, 0, -0, -0), readOnly=True) # the view to draw in self.drawView = DrawView((0, 0, -0, -0)) # 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, -0), paneDescriptors) # setup BaseWindowController base behavoir self.setUpBaseWindowBehavior() # 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.codeSplit.setDividerPosition(0, windowHeight * .7)