Esempio n. 1
0
def hitCallback(sender):

    script = 'fill(random(), random(), random())\nrect(10+random()*100, 10+random()*100, 200, 300)'
    _drawBotDrawingTool.newDrawing()
    namespace = DrawBotNamespace(_drawBotDrawingTool,
                                 _drawBotDrawingTool._magicVariables)
    _drawBotDrawingTool._addToNamespace(namespace)

    # Creates a new standard output, catching all print statements and tracebacks.
    output = []
    stdout = StdOutput(output, outputView=outputWindow.outputView)
    stderr = StdOutput(output,
                       isError=True,
                       outputView=outputWindow.outputView)

    # Calls DrawBot's ScriptRunner with above parameters.
    ScriptRunner(script,
                 None,
                 namespace=namespace,
                 stdout=stdout,
                 stderr=stderr)
    context = getContextForFileExt('pdf')
    _drawBotDrawingTool._drawInContext(context)
    pdfDocument = _drawBotDrawingTool.pdfImage()
    w.drawView.setPDFDocument(pdfDocument)
Esempio n. 2
0
 def createContext(context):
     # draw the tool in to the context
     _drawBotDrawingTool._drawInContext(context)
 def displayDrawing(self):
     context = DrawBotContext()
     _drawBotDrawingTool._drawInContext(context)
     self.w.dbView.setPDFDocument(context.getNSPDFDocument())
Esempio n. 4
0
 def createContext(context):
     # draw the tool in to the context
     _drawBotDrawingTool._drawInContext(context)
Esempio n. 5
0
 def getPageBotDocument(self):
     """Converts template drawn in memory to a PDF document."""
     context = getContextForFileExt('pdf')
     _drawBotDrawingTool._drawInContext(context)
     pdfDocument = _drawBotDrawingTool.pdfImage()
     return pdfDocument