예제 #1
0
    def start_drawing(self, args):
        #loads one
        moduleName = args["module"]
        funcName = args["constructor"]
        showBoundary = int(args.get("showBoundary", "0"))
        hAlign = args.get("hAlign", "CENTER")

        # the path for the imports should include:
        # 1. document directory
        # 2. python path if baseDir not given, or
        # 3. baseDir if given
        try:
            dirName = sdict["baseDir"]
        except:
            dirName = None
        importPath = [os.getcwd()]
        if dirName is None:
            importPath.extend(sys.path)
        else:
            importPath.insert(0, dirName)

        modul = recursiveImport(moduleName, baseDir=importPath)
        func = getattr(modul, funcName)
        drawing = func()

        drawing.hAlign = hAlign
        if showBoundary:
            drawing._showBoundary = 1

        self._curDrawing = pythonpoint.PPDrawing()
        self._curDrawing.drawing = drawing
예제 #2
0
    def start_drawing(self, args):
        #loads one
        moduleName = args["module"]
        funcName = args["constructor"]
        showBoundary = int(args.get("showBoundary", "0"))
        hAlign = args.get("hAlign", "CENTER")

        __import__(moduleName)
        func = getattr(sys.modules[moduleName], funcName)
        drawing = func()

        drawing.hAlign = hAlign
        if showBoundary:
            drawing._showBoundary = 1

        self._curDrawing = pythonpoint.PPDrawing()
        self._curDrawing.drawing = drawing