XMind数据文件读写库。
项目描述
mekk.xmind 是一个纯Python处理XMind思维导图文件的处理器。它可以用来
从头开始生成XMind思维导图(例如,将一些数据可视化为思维导图),
修改现有的.xmind文件,
解析现有的.xmind文件并分析其内容。
示例
创建思维导图
from mekk.xmind import XMindDocument OUTPUT = "test.xmind" xmind = XMindDocument.create(u"First sheet title", u"Root subject") first_sheet = xmind.get_first_sheet() root_topic = first_sheet.get_root_topic() root_topic.add_subtopic(u"First item") root_topic.add_subtopic(u"Second item") t = root_topic.add_subtopic(u"Third item") t.add_subtopic(u"Second level - 1") t.add_subtopic(u"Second level - 2") root_topic.add_subtopic(u"Detached topic", detached = True) t.add_subtopic(u"Another detached", detached = True) t.add_marker("flag-red") root_topic.add_subtopic(u"Link example").set_link("http://mekk.waw.pl") root_topic.add_subtopic(u"Attachment example").set_attachment( file("map_creator.py").read(), ".txt") root_topic.add_subtopic(u"With note").set_note(u"""This is just some dummy note.""") MARKER_CODE = "40g6170ftul9bo17p1r31nqk2a" XMP = "../../py_mekk_nozbe2xmind/src/mekk/nozbe2xmind/NozbeIconsMarkerPackage.xmp" root_topic.add_subtopic(u"With non-standard marker").add_marker(MARKER_CODE) xmind.embed_markers(XMP) xmind.save(OUTPUT) #xmind.pretty_print() print "Saved to", OUTPUT
注意:尽管上述示例使用ascii,但完全支持unicode。
解析思维导图
from mekk.xmind import XMindDocument xmind = XMindDocument.open("test.xmind") sheet = xmind.get_first_sheet() print "Sheet title: ", sheet.get_title() root = sheet.get_root_topic() print "Root title: ", root.get_title() print "Root note: ", root.get_note() for topic in root.get_subtopics(): print "* ", topic.get_title() print " label: ", topic.get_label() print " link: ", topic.get_link() print " markers: ", list(topic.get_markers()) # topic.get_subtopics()
等。
要修改,只需解析现有的文档,找到要修改的项目,并相应地更改它们,然后保存。
开发
代码使用Mercurial跟踪。仓库可以在http://bitbucket.org/Mekk/mekk.xmind/找到。
在相同的位置报告错误,建议改进和提供补丁。
许可协议
mekk.xmind在艺术许可2.0和Mozilla公共许可1.1下双许可。完整的许可文本可以在Artistic-2.0.txt和MPL-1.1.txt中找到。
项目详情
关闭
meck.xmind-0.5.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 4a8dc01cfca6622320be586cc2dfea3ef153f684a81139b35479231ac6398210 |
|
MD5 | a0afc14b0adafb8cde09c632d6483e70 |
|
BLAKE2b-256 | a9ba4f74434aebfd48ce378596d2baccfb6b0e054c6cacfe1a7dd639e574e12d |