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)
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())
def print_version(verbose=False): print_config(verbose=verbose, stream=sys.stdout)
def print_version(verbose=False): print_config(print, verbose=verbose)
- 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)