コード例 #1
0
def setup_log(args):
    import logging
    from datetime import datetime
    level = "DEBUG" if args.verbose else "INFO"
    logging.basicConfig(filename=args.log, level=level)
    print(f"Appending logs to file \"{args.log}\", logging level: {level}\n")
    logger = logging.getLogger('ezdxf')
    logger.info("***** Launch time: " + datetime.now().isoformat() + " *****")
    if args.verbose:
        print_config(logger.info, verbose=True)
コード例 #2
0
ファイル: __main__.py プロジェクト: Rahulghuge94/ezdxf
def setup_log(args):
    import logging
    from datetime import datetime
    from io import StringIO

    level = "DEBUG" if args.verbose else "INFO"
    if args.log.lower() == "stderr":
        logging.basicConfig(stream=sys.stderr, level=level)
    else:
        logging.basicConfig(filename=args.log, level=level)
    print(f'Appending logs to file "{args.log}", logging level: {level}\n')
    logger = logging.getLogger("ezdxf")
    logger.info("***** Launch time: " + datetime.now().isoformat() + " *****")
    if args.verbose:
        s = StringIO()
        print_config(verbose=True, stream=s)
        logger.info("configuration\n" + s.getvalue())
コード例 #3
0
ファイル: __main__.py プロジェクト: Rahulghuge94/ezdxf
def print_version(verbose=False):
    print_config(verbose=verbose, stream=sys.stdout)
コード例 #4
0
def print_version(verbose=False):
    print_config(print, verbose=verbose)
コード例 #5
0
- explode MTEXT into DXF primitives (TEXT, LINE)

"""
if not ezdxf.options.use_matplotlib:
    print("The Matplotlib package is required.")
    sys.exit(1)

# Type alias:
Content = Iterable[tl.Cell]

DIR = pathlib.Path("~/Desktop/Outbox").expanduser()
STYLE = "Style0"
FONT = "OpenSans-Regular.ttf"
COLUMN_HEIGHT: float = 12

print_config()

doc = ezdxf.new()
msp = doc.modelspace()
style = doc.styles.new(STYLE, dxfattribs={"font": FONT})


def measure_space(font):
    return font.text_width(" X") - font.text_width("X")


class SizedFont:
    def __init__(self, height: float):
        self.height = float(height)
        self.font = fonts.make_font(FONT, self.height)
        self.space = measure_space(self.font)