def get_tasks(path): xmind = XMindDocument.open(path) map_tasks = get_tasks_from_xdoc(xmind) response = {} response['sheets'] = map_tasks response['file_name'] = os.path.basename(path) return response
def processXmindFile(filename): voidPath() xmindDoc=XMindDocument.open(filename) s1=xmindDoc.get_first_sheet() r1=s1.get_root_topic() values=xmindWalk_getMarkers(r1,[]) markers=ET.parse(targetArchiveDir+"markerSheet.xml").getroot().getchildren()[0] dico=buildDico(markers) createArchive(dico,values) attachXMP(filename,xmindDoc)
def parse_and_print(file_name): xmind = XMindDocument.open(file_name) 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()))
def parse_and_print(file_name): xmind = XMindDocument.open(file_name) 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())
def get_total_list(self): xmind = XMindDocument.open(self.file_dir) sheet = xmind.get_first_sheet() root = sheet.get_root_topic() root_title = root.get_title() fist_node = root.get_subtopics() # print 'fist_node',fist_node fist_node_list = [] sencond_node_list = [] third_node_list = [] total_third_node_list = [] four_node_list = [] total_four_node_list = [] five_node_list = [] total_five_node_list = [] six_node_list = [] total_six_node_list = [] for sencond_node in fist_node: sencond_node_list.append(sencond_node.get_title()) fist_node_list.append(sencond_node.get_title()) for third_node in sencond_node.get_subtopics(): third_node_list.append(third_node.get_title()) for four_node in third_node.get_subtopics(): four_node_list.append(four_node.get_title()) for five_node in four_node.get_subtopics(): five_node_list.append(five_node.get_title()) for six_node in five_node.get_subtopics(): six_node_list.append(six_node.get_title()) total_six_node_list.append(six_node_list) six_node_list = [] total_five_node_list.append(five_node_list) five_node_list = [] total_four_node_list.append(four_node_list) four_node_list = [] total_third_node_list.append(third_node_list) third_node_list = [] return fist_node_list, total_third_node_list, total_four_node_list, total_five_node_list, total_six_node_list, root_title
def open_doc(name): if not os.path.isfile(name): name = os.path.join("tests", name) return XMindDocument.open(name)
Manual=True if(Manual): Xmindfile=raw_input("name of your xmind file : ") else : Xmindfile="article.xmind" pref_target = re.compile('(' +'\(' +'ref' +'\)' +')') pref_source = re.compile('(' +'___' +'.*?' +'\)___)') xmind = XMindDocument.open(Xmindfile) first_sheet = xmind.get_first_sheet() root_topic = first_sheet.get_root_topic() #style=root_topic.get_style() #print(style) markers=(dropDuplicate(xmindWalk_getMarkers(root_topic))) markers.append("none") message="Your markers are : " for i,marker in enumerate(markers): message+=marker+"("+str(i)+") ; " print message[0:-2] if(Manual): titleId=int(raw_input("choose the index of marker for title (choose none if none ) : ")) textId=int(raw_input("choose the index of marker for full text (choose none if none ) : ")) refsId=int(raw_input("choose the index of marker for references (choose none if none ) : ")) output=raw_input("choose the name of the file that will be created : ")
def updateMarkers(filename): xmindfile = XMindDocument.open(filename) xmindfile.embed_markers("livemappingMarkers.xmp") xmindfile.save(filename)
def getSheet(file): xmindf = XMindDocument.open(file) sheet = xmindf.get_first_sheet() print "画布名称:", sheet.get_title() return sheet
from __future__ import print_function from mekk.xmind import XMindDocument xmind = XMindDocument.open("openEHR-EHR-OBSERVATION.apgar.v1.xmind") ccd_sheet = xmind.get_first_sheet() ccd = ccd_sheet.get_root_topic() print("CCD Title: ", ccd.get_title()) print("CCD Template Id: ", ccd.get_correlation_id()) # here we need to compare the id to know which CCD template is being used. for top_item in ccd.get_subtopics(): #current level if top_item.get_title() == 'definition': for level2item in top_item.get_subtopics(): # next level generator print("* ", level2item.get_title()) for level3item in level2item.get_subtopics(): print("** ", level3item.get_title())
def process_xmind_file(xmind_file='mmaps.xmind'): xmind = XMindDocument.open(xmind_file) for sheet in xmind.get_all_sheets(): print "Sheet title: ", sheet.get_title() root = sheet.get_root_topic() root_title = root.get_title() print "Root title: ", root.get_title() print "Root note: ", root.get_note() level = 0 #add year and question title sheet_id = add_sheet(sheet.get_title(), root_title) #direct parent, that is the titles for topic in root.get_subtopics(): topic_name = r'' + topic.get_title() print "* ", topic.get_title() visible_in_menu = 1 level = 0 is_ignored = False is_numbered = False topic_number = 0 internal_topic_number = 0 #split to find numbering and any ignore flag topic_name_parts = topic_name.split(TOPIC_DELIMITER) topic_name_parts_len = len(topic_name_parts) if topic_name_parts_len == 4: topic_name = topic_name_parts[3].strip() is_ignored = True try: topic_number = int(topic_name_parts[1]) is_numbered = True except: print 'Error parsing number in topic ' + topic_name is_numbered = False elif topic_name_parts_len == 3: topic_name = topic_name_parts[2].strip() is_ignored = False try: topic_number = int(topic_name_parts[1]) is_numbered = True except: print 'Error parsing number in topic ' + topic_name is_numbered = False else: is_numbered = False is_ignored = False if is_numbered is False: internal_topic_number += 1 topic_number = internal_topic_number if is_ignored is True: visible_in_menu = 0 topic_id = add_topic(sheet_id=sheet_id, topic_name=topic_name, topic_parent=None, is_answer=False, level=level, order=topic_number, visible_menu=visible_in_menu) #increment order print 'Number: ' + str(topic_number) + ' -' + str(topic_id) #children nodes, that's the answers for topic_1 in topic.get_subtopics(): topic_1_name = topic_1.get_title() level = 1 topic_1_id = add_topic(sheet_id=sheet_id, topic_name=topic_1_name, topic_parent=topic_id, is_answer=1, level=level, order=topic_number, visible_menu=0) print 'Answer: ' + str(topic_1_id) print '' print '----------------------------'