MCPcopy
hub / github.com/BIT-DataLab/Edit-Banana / _create_base_xml

Method _create_base_xml

modules/xml_merger.py:416–444  ·  view source on GitHub ↗

创建DrawIO基础XML结构

(self, canvas_width: int, canvas_height: int)

Source from the content-addressed store, hash-verified

414 return None
415
416 def _create_base_xml(self, canvas_width: int, canvas_height: int) -> ET.Element:
417 """创建DrawIO基础XML结构"""
418 mxfile = ET.Element("mxfile", {"host": "app.diagrams.net", "type": "device"})
419 diagram = ET.SubElement(mxfile, "diagram", {"id": "merged", "name": "Page-1"})
420
421 mx_graph_model = ET.SubElement(diagram, "mxGraphModel", {
422 "dx": str(canvas_width),
423 "dy": str(canvas_height),
424 "grid": "1",
425 "gridSize": "10",
426 "guides": "1",
427 "tooltips": "1",
428 "connect": "1",
429 "arrows": "1",
430 "fold": "1",
431 "page": "1",
432 "pageScale": "1",
433 "pageWidth": str(canvas_width),
434 "pageHeight": str(canvas_height),
435 "math": "0",
436 "shadow": "0",
437 "background": "#ffffff"
438 })
439
440 root = ET.SubElement(mx_graph_model, "root")
441 ET.SubElement(root, "mxCell", {"id": "0"})
442 ET.SubElement(root, "mxCell", {"id": "1", "parent": "0"})
443
444 return mxfile
445
446 def _prettify_xml(self, elem: ET.Element) -> str:
447 """格式化XML输出(移除版本声明,过滤空行)"""

Callers 1

_build_xml_structureMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected