def generateXmind(self,caseList,sheetName):
     """利用caseList中的用例,生成Xmind图"""
     if caseList is None :
         logging.error("Excel转换失败")
         return None
     workbook = xmind.load("NotExist.xmind")
     sheet = workbook.getPrimarySheet()
     sheet.setTitle(sheetName) 
     moduleTopic =sheet.getRootTopic()  
     moduleTopic.setTitle(sheetName)
     moduleTopic.addVersionTopic(caseList[0]["版本"])
     topicList = self.transCaseToTopic(caseList,moduleTopic)
     if topicList is None:
         logging.error("Excel转换失败")
         return None
     for path in topicList:
         parentNode = moduleTopic
         for topic in path:
             sameTopic = self.find_topic_by_title(moduleTopic,topic.getTitle())
             #print sameTopic.getTitle(),topic.getTitle(),self.isSameCase(topic, sameTopic, moduleTopic)
             #找到了相同节点,那么置下一次循环的topic的父节点为已找到的相同节点
             if self.isSameCase(topic, sameTopic, moduleTopic):
                 parentNode = sameTopic          
             # 未找到相同节点,那么在父节点后添加一个"
             else :
                 newTopic = self.copyTopic(topic)
                 parentNode.addSubTopic(newTopic) 
                 parentNode = newTopic                             
     return workbook
Example #2
0
def xmind(case_type="testcase_json"):
    case_type_define = ["json", "zentao_csv", "testlink_xml", "testsuite_json", "testsuites", "testcase_json", "testcases"]
    xmind_file = 'static/files/BOOT3X_V3.9.0_V2.19.0.xmind'
    logger.info('Start to convert XMind file: %s' % xmind_file)
    if case_type == "testcase_json":
        testcase_json_file = xmind_testcase_to_json_file(xmind_file)
        logger.info('Convert XMind file to testcase json file successfully: %s', testcase_json_file)
    elif case_type == "zentao_csv":
        zentao_csv_file = xmind_to_zentao_csv_file(xmind_file)
        logger.info('Convert XMind file to zentao csv file successfully: %s', zentao_csv_file)
    elif case_type == "testlink_xml":
        testlink_xml_file = xmind_to_testlink_xml_file(xmind_file)
        logger.info('Convert XMind file to testlink xml file successfully: %s', testlink_xml_file)
    elif case_type == "testsuite_json":
        testsuite_json_file = xmind_testsuite_to_json_file(xmind_file)
        logger.info('Convert XMind file to testsuite json file successfully: %s', testsuite_json_file)
    elif case_type == "testsuites":
        testsuites = get_xmind_testsuite_list(xmind_file)
        logger.info('Convert XMind to testsuits dict data:\n%s',json.dumps(testsuites, indent=2, separators=(',', ': '), ensure_ascii=False))
    elif case_type == "testcases":
        testcases = get_xmind_testcase_list(xmind_file)
        logger.info('Convert Xmind to testcases dict data:\n%s', json.dumps(testcases, indent=4, separators=(',', ': ')))
    elif case_type == "json":
        xmind_file = 'xmind_testcase_template.xmind'
        workbook = xmind.load(xmind_file)
        logger.info('Convert XMind to Json data:\n%s', json.dumps(workbook.getData(), indent=2, separators=(',', ': '), ensure_ascii=False))

    logger.info('Finished conversion, Congratulations!')
    return True
    def test_e2e_open(self):
        current_dir = os.path.dirname(__file__)
        content_file_path = os.path.join(current_dir, 'content.json')
        xmind_file_path = os.path.join(current_dir, 'test_file.xmind')
        with open(content_file_path, 'r') as file:
            _content = json.load(file)
        _workbook = xmind.load(xmind_file_path)
        self.assertTrue(_workbook, 'There is no workbook!')
        self._check_sheets_number(_workbook)
        self._check_xmap_content(_workbook, _content)
        self._check_element_extension(
            _workbook.getChildNodesByTagName('xmap-content')[0],
            _content['xmap-content'])

        for i in range(0, len(_content['xmap-content']['sheet'])):
            _test_sheet = _workbook.getSheets()[i]
            _expected_sheet = _content['xmap-content']['sheet'][i]
            self._check_sheet_title(_test_sheet, _expected_sheet['title'])
            if _test_sheet.getFirstChildNodeByTagName('relationships'):
                self._check_relationships(_test_sheet, _expected_sheet)

            # Checking sheet attributes
            for _key, _value in _expected_sheet.items():
                if _key[0] == '-':
                    self._check_tag_attribute(_test_sheet, _key[1:], _value)

            # Check root topic title, attributes, notes
            _root_topic_test = _test_sheet.getRootTopic()
            _root_topic_expected = _expected_sheet['topic']
            self._check_full_topic(_root_topic_test, _root_topic_expected)
Example #4
0
def generate_features(name, section_index=0):
    # Load required Path
    path_output = Path.cwd().joinpath('output')
    Path(path_output).mkdir(exist_ok=True)
    file_path = Path.cwd().joinpath(name + '.xmind')
    # Load .xmind file
    w = xmind.load(file_path)
    # Load firt (primary sheet)
    sheet = w.getPrimarySheet()
    # Get root topic
    root = sheet.getRootTopic()
    # Get required section
    section = root.getSubTopicByIndex(section_index)
    # Create folder for a section to keep features
    section_name = section.getTitle()
    section_folder_path = path_output.joinpath(section_name)
    Path(section_folder_path).mkdir(exist_ok=True)
    # Extract features and start iterating
    features = section.getSubTopics()

    for feature in features:
        feature_name = str(feature.getIndex() + 1) + '.' + feature.getTitle()
        output = '<h2>Пользовательские истории</h2>'
        stories = get_user_stories(feature)
        for story in stories:
            output += story
        output += '<h2>Функциональные требования</h2>'
        func_reqs = get_func_reqs(feature)
        output += str(func_reqs)
        # Write output in a file
        with open(section_folder_path.joinpath(feature_name + '.txt'),
                  'w') as f:
            f.write(output)
Example #5
0
def main(parameters):
    path = parameters[0]
    time = int(parameters[1]) if len(parameters) >= 2 else None
    workbook = xmind.load(path)
    topics = set()
    walk_through_children(workbook.getPrimarySheet().getRootTopic(), topics)

    skip = read_from_file("skip.txt")

    red_flags = set([
        topic for topic in topics
        if "flag-red" in topic.markers and topic.name not in skip
    ])
    print_html_block("RED FLAG", red_flags - skip)

    exercises = set([
        topic for topic in topics
        if "c_symbol_exercise" in topic.markers and topic.name not in skip
    ])
    print_html_block("EXERCISES", exercises - skip)

    if time:
        print_html_block("by time: " + str(time), [
            topic for topic in (topics - red_flags - exercises - skip)
            if topic.time and topic.time <= time and topic.name not in skip
        ])
    def generate_xmind(self):
        # merge sumamry data
        with open(self.input_fp) as summary_fh:
            summary_data = json.load(summary_fh)
        merged_summary_data = self.merge_summary_data(summary_data[DEFAULT_SUMMARY_KEY])

        # init xmind obj
        output_xmind_obj = xmind.load(self.output_fp)

        # create summary sheet
        summary_sheet = output_xmind_obj.getPrimarySheet()  # get the first sheet
        summary_sheet.setTitle(DEFAULT_SUMMARY_KEY)  # set its title
        summary_sheet.setAttribute(const.ATTR_THEME, DEFAULT_THEME)
        root_topic = summary_sheet.getRootTopic()  # get the root topic of this sheet
        summary_root_key = merged_summary_data.keys()[0]
        root_topic.setTitle(summary_root_key)  # set its title
        self.set_sub_key_element(merged_summary_data[summary_root_key], summary_sheet, root_topic)

        # create case sheet
        if DEFAULT_SUMMARY_KEY in summary_data:
            for case_name in summary_data[DEFAULT_SUMMARY_KEY]:
                case_sheet = output_xmind_obj.createSheet()
                case_sheet.setTitle(case_name)
                case_sheet.setAttribute(const.ATTR_THEME, DEFAULT_THEME)
                case_root_topic = case_sheet.getRootTopic()
                root_key = summary_data[DEFAULT_SUMMARY_KEY][case_name].keys()[0]
                case_root_topic.setTitle(root_key)
                self.set_sub_key_element(summary_data[DEFAULT_SUMMARY_KEY][case_name][root_key], case_sheet,
                                         case_root_topic)
                output_xmind_obj.addSheet(case_sheet)
        else:
            print "The summary json file[%s] format is not correct!" % self.input_fp
        xmind.save(output_xmind_obj, self.output_fp)
        self.append_xmind_style()
 def get_workbook(self, user_id: str) -> \
     (xmind.core.workbook.WorkbookDocument, str):
     _, _meta_json = self.read_meta_file(user_id)
     _current_file = _meta_json.current_file.file_name
     _xmind_workbook = xmind.load(self.get_full_file_path(user_id, \
             _current_file))
     return _xmind_workbook, _current_file
Example #8
0
	def main(md_content, target_file_name, topic_name):
		# print('main {0}'.format(md_file))

		if '.xmind' not in target_file_name:
			target_file_name += '.xmind'

		# 如果目标文件存在则删除
		target_file_path = os.path.abspath(os.path.join(os.getcwd(), target_file_name))
		# print(target_file_path)
		if os.path.exists(target_file_path):
			print('\033[1;35m目标文件存在且已删除 \033[0m')
			os.remove(target_file_path)

		# 1、如果指定的XMind文件存在,则加载,否则创建一个新的
		workbook = xmind.load(target_file_name)

		# 2、获取第一个画布(Sheet),默认新建一个XMind文件时,自动创建一个空白的画布
		sheet1 = workbook.getPrimarySheet()

		# 3、在画布上生成思维导图
		Md2Xmind.handle_content(md_content, sheet1, topic_name)

		# 4、保存(如果指定path参数,另存为该文件名)
		xmind.save(workbook)

		print('\033[1;32m{0} created \033[0m'.format(target_file_name))
Example #9
0
def main():
    print('sys.argv: ', sys.argv, "\n")

    pathSource = None
    pathOutput = None

    for i, val in enumerate(sys.argv):
        if(val == '-source'):
            pathSource = sys.argv[i + 1]
        if(val == '-output'):
            pathOutput = sys.argv[i + 1]

    pathSource = pathSource.replace('\\', '/')

    if pathOutput == None:
        pathOutput = pathSource.split('/')[-1].split('.')[0] + '.md'


    workbook = xmind.load(pathSource)
    sheet = workbook.getPrimarySheet()
    dictSheet = sheet.getData()
    dictResult: Dict = {}
    WalkTopic(dictSheet['topic'], dictResult)

    strResult = Print2MDList(dictResult)

    with open(pathOutput, 'w', encoding='utf-8') as f:
        f.write(strResult)
        print('Successfully wrote result into file: ' + pathOutput)
Example #10
0
def create_xmind(dict_data, file):
    try:
        file_name = file if '.xlsx' not in file else file.split('.xlsx')[0]
        w = xmind.load(file_name + '.xmind')
        for i in range(len(dict_data)):
            s = w.getPrimarySheet() if i == 0 else w.createSheet()
            s.setTitle(dict_data[i][1][0])  # set its title
            global r  # 初始使用变量,需要在下面的方法中查找,提供全局
            r = s.getRootTopic()  # get the root topic of this sheet
            r.setTitle(dict_data[i][1][0])  # 设置主分支标题,同sheet都相同
            # 设置循环标签 不超过26位
            topic_list = list(map(chr, range(ord('a'), ord('z') + 1)))
            topic_list.pop(17)
            topic_list.pop(18)
            for item in enumerate(dict_data[i][0]):
                preview_ct = 1
                for dict_ct in range(len(item[1])):
                    if dict_ct == 0:
                        current_topic = item[1][dict_data[i][1][dict_ct + 1]]
                        key = dict_data[i][1][dict_ct + 1]
                        topic_name = topic_list[dict_ct]
                        prev_topic_name = 'r'
                        preview_ct = sort_liter(preview_ct, current_topic, key,
                                                topic_name, prev_topic_name)
                    else:
                        current_topic = item[1][dict_data[i][1][dict_ct + 1]]
                        key = dict_data[i][1][dict_ct + 1]
                        topic_name = topic_list[dict_ct]
                        prev_topic_name = topic_list[dict_ct - 1]
                        preview_ct = sort_liter(preview_ct, current_topic, key,
                                                topic_name, prev_topic_name)

        xmind.save(w, file_name + '.xmind')
    except Exception as err:
        print(err)
Example #11
0
def save_xmind_report(filename, username, results):
    if os.path.exists(filename):
        os.remove(filename)
    workbook = xmind.load(filename)
    sheet = workbook.getPrimarySheet()
    design_sheet(sheet, username, results)
    xmind.save(workbook, path=filename)
Example #12
0
def update_xmind():
    workbook = xmind.load('demo.xmind')
    primary_sheet = workbook.getPrimarySheet()
    root_topic = primary_sheet.getRootTopic()
    root_topic.addMarker(MarkerId.starRed)

    # 1、save all content and save as xmind_update_demo.xmind(recommended)
    xmind.save(workbook=workbook, path='xmind_update_demo.xmind')

    # 2、only save the content.xml
    xmind.save(workbook=workbook,
               path='xmind_update_demo1.xmind',
               only_content=True)

    # 3、only save content.xml、comments.xml、styles.xml
    xmind.save(workbook=workbook,
               path='xmind_update_demo2.xmind',
               except_attachments=True)

    # 4、save everything except `Revisions` content to save space(also recommended)
    xmind.save(workbook=workbook,
               path='xmind_update_demo3.xmind',
               except_revisions=True)

    # 5、update and overwrite the original file directly.
    xmind.save(workbook)
Example #13
0
def gen_my_xmind_file():

    workbook = xmind.load("my.xmind")
    sheet1 = workbook.getPrimarySheet()
    time_name = basic_sheet(sheet1, workbook)
    # gen_sheet2(sheet1, workbook)

    xmind.save(workbook, path='minmap/{}.xmind'.format(time_name))
Example #14
0
 def draw(self):
     if os.path.exists(self.xmind_path):
         os.remove(self.xmind_path)
     mind_map = xmind.load(self.xmind_path)
     sheet = mind_map.getPrimarySheet()
     sheet.setTitle(self.title)
     self.note.transform(sheet)
     xmind.save(mind_map)
Example #15
0
 def initTree(self, title):
     # 在内存中创建一个空的文档
     self.map = xmind.load("my.xmind")
     sheet = self.map.getPrimarySheet()
     sheet.setTitle("first sheet")
     root_topic = sheet.getRootTopic()
     root_topic.setTitle(title)  # 设置主题名称
     return root_topic
Example #16
0
def genxmindfile(filename, username, results):
    print(f'Generating XMIND8 file for username {username}')
    if os.path.exists(filename):
        os.remove(filename)
    workbook = xmind.load(filename)
    sheet = workbook.getPrimarySheet()
    design_sheet(sheet, username, results)
    xmind.save(workbook, path=filename)
Example #17
0
 def __init__(self, path):
     self.path = path
     self.wb = xmind.load(self.path)
     self.sheet = self.wb.createSheet()
     self.sheet.setTitle('画布')
     self.wb.addSheet(self.sheet)
     self.root = self.sheet.getRootTopic()
     self.root.setTitle(DEFAULT_PROJECT_NAME)
     self.clear()
def gen_my_xmind_file():
    # load an existing file or create a new workbook if nothing is found
    workbook = xmind.load("my.xmind")
    # get the first sheet(a new workbook has a blank sheet by default)
    sheet1 = workbook.getPrimarySheet()
    design_sheet1(sheet1)
    # create sheet2
    # gen_sheet2(workbook, sheet1)
    # now we save as test.xmind
    xmind.save(workbook, path='my.xmind')
Example #19
0
def json_2_xmind(json_file_path, xmind_name):
    workbook = xmind.load(xmind_name)
    sheet1 = workbook.getPrimarySheet()
    sheet1.setTitle(xmind_name)  # 设置画布名称
    root_topic1 = sheet1.getRootTopic()
    root_topic1.setTitle(xmind_name)
    with open(json_file_path) as f:
        dict_data = json.load(f)
        dfs(dict_data, root_topic1)
    xmind.save(workbook, path=xmind_name)
Example #20
0
def test_xmind_file(name):
    # Load .xmind file
    file_path = Path.cwd().joinpath(name + '.xmind')
    print(file_path)
    w = xmind.load(file_path)
    # Load firt (primary sheet)
    sheet = w.getPrimarySheet()
    # Get root topic
    root = sheet.getRootTopic()
    print(root.getTitle())
Example #21
0
def get_testcase(xmindfile, sheet, index):
    w = xmind.load(
        xmindfile
    )  # load an existing file or create a new workbook if nothing is found
    testcase = []
    get_LSubTopics(w.getSheets()[sheet].getRootTopic())
    length = get_testcase_list(LSubTopics[index]).__len__()
    for i in xrange(length):
        testcase.append(
            get_testcase_list(LSubTopics[index])[length - i - 1].getTitle())
    return testcase
Example #22
0
def gen_my_xmind_file():
    with open(json_file, 'rt') as f:
        jdata = json.loads(f.read(), object_pairs_hook=OrderedDict)

    for k1, v1 in jdata.items():
        xmind_file = os.path.join(root_path, "{}.xmind".format(k1))
        workbook = xmind.load(xmind_file)
        sheet1 = workbook.getPrimarySheet()
        design_sheet1(sheet1, k1, v1)

        xmind.save(workbook)
 def get_sheet(self, user_id: str) -> \
     (List[PathItem], xmind.core.sheet.SheetElement, xmind.core.workbook.WorkbookDocument, MetaFileObject):
     _, _meta_json = self.read_meta_file(user_id)
     _current_file = _meta_json.current_file
     _current_sheet = _meta_json.current_file.current_sheet
     _xmind_workbook = xmind.load(self.get_full_file_path(user_id, \
             _current_file.file_name))
     _sheet = _xmind_workbook.getSheets()[_current_sheet]
     _path_item: List[PathItem] = self.get_path_item_by_sheet_index(_current_sheet, \
             _meta_json.current_file)
     return _path_item, _sheet, _xmind_workbook, _current_file
Example #24
0
def xmind2Yaml(path, file_name):
    file_path = os.path.join(os.path.abspath(path), file_name + ".xmind")
    workbook = xmind.load(file_path)
    xmind_data = workbook.getPrimarySheet().getRootTopic().getData()
    yaml_data = {}
    parse_xmind_data(xmind_data, yaml_data, False)
    stream = open(os.path.join(os.path.abspath(path), file_name + ".yaml"),
                  'w',
                  encoding='UTF-8')
    yaml = YAML()
    yaml.dump(yaml_data, stream)
Example #25
0
 def make(self):
     self.read_data()
     if os.path.exists(self.save_to):
         os.remove(self.save_to)
     workbook = xmind.load(self.save_to)
     sheet = workbook.getPrimarySheet()
     sheet.setTitle(self.title)
     root_topic = sheet.getRootTopic()
     root_topic.setTitle(self.title)
     self.add_sub(root_topic, 0)
     xmind.save(workbook, path=self.save_to)
Example #26
0
def gen_my_xmind_file():
    workbook = xmind.load("my.xmind")

    sheet1 = workbook.getPrimarySheet()
    # 对第一个画布进行设计完善,具体参照下一个函数
    design_sheet1(sheet1)

    # 3、创建第二个画布
    gen_sheet2(workbook, sheet1)

    # 4、保存(如果指定path参数,另存为该文件名)
    xmind.save(workbook, path='test.xmind')
Example #27
0
    def __init__(self, path):
        self._roots = []
        self._test_cases = []

        if not os.path.exists(path):
            raise FileNotFoundError

        self._workbook = xmind.load(path)
        self._sheets = self._workbook.getSheets()

        for sh in self._sheets:
            self._roots.append(sh.getRootTopic().getData())
Example #28
0
 def __init__(self, name):
     super(Mind, self).__init__()
     self.name = name
     self.content = []
     self.is_zen = False
     self.workbook = xmind.load(name)
     if not os.path.exists(name):
         return
     with ZipFile(name) as m:
         if 'content.json' in m.namelist():
             self.is_zen = True
             d = m.open('content.json').read().decode('utf-8')
             self.content = json.loads(d)
Example #29
0
def get_xmind_testsuites(xmind_file):
    """Load the XMind file and parse to `xmind2testcase.metadata.TestSuite` list"""
    xmind_file = get_absolute_path(xmind_file)
    workbook = xmind.load(xmind_file)
    xmind_content_dict = workbook.getData()
    logging.debug("loading XMind file(%s) dict data: %s", xmind_file, xmind_content_dict)

    if xmind_content_dict:
        testsuites = xmind_to_testsuites(xmind_content_dict)
        return testsuites
    else:
        logging.error('Invalid XMind file(%s): it is empty!', xmind_file)
        return []
 def transXmind(self):
     """将Xmind文件转换为Excel表格
     """
     outFileName, outFiltr = QtGui.QFileDialog.getSaveFileName(self,self.tr(u"保存Excel文件"), os.getcwd(), self.tr("Excel Files (*.xls )")) 
     if not outFileName:
         return False
     
     workbook = xmind.load(self.orinFile)
     wbExcel = xlwt.Workbook(encoding='utf-8')
     sheet = workbook.getSheets()[0]
     if self.transSheet2Excel(sheet,wbExcel,outFileName):
         self.initProgressDialog(1) # 暂时只支持单个sheet转换
         self.updateProgressDialog()    
     wbExcel.save(outFileName)
Example #31
0
def gen_my_xmind_file(name, post_form, form_items, file_dic):

    file_path = "./" + name + ".xmind"
    workbook = xmind.load(file_path)
    # get the first sheet(a new workbook has a blank sheet by default)
    sheet1 = workbook.getPrimarySheet()
    # design_sheet1(sheet1, name, number , address, flow)
    write_sheet(sheet1, name, post_form, form_items, file_dic)

    try:
        xmind.save(workbook, path=file_path)
        return True
    except Exception:
        return False
Example #32
0
 def load(self, path):
     if not self.config:
         print("The config is not right.")
         return
     if not path:
         print('Enter a legal path!')
         return
     if not path[-6:] == '.xmind':
         print('please give a xmind!')
         return
     x = xmind.load(path)
     xmind_content_list = x.getData()
     self.BFSxmind(xmind_content_list)
     if self.dic:
         self.jsonfyDFS(self.dic)
 def export(self, source_path, target_path):
     print(self.name + ".export ")
         
     if (not os.path.isfile(source_path)): 
         print("> *ERROR* source_path: '" + source_path + "' not found")
         exit(FILE_NOT_FOUND_ERROR)
        
     # load an existing file or create a new workbook if nothing is found 
     workbook   = xmind.load(source_path) 
     worksheet  = workbook.getPrimarySheet() # get the first sheet
     root_topic = worksheet.getRootTopic()   # get the root topic of this sheet
     
     self.generateGraphvizDotString(root_topic)
     self.writeGraphvizDotToFile(target_path)
     self.generateImageFile(target_path, '../data/out.pdf')
     
     print(">> export done")
    def __init__(self,ui_case = 0):
        if ui_case == 0:
            test_file = path.get_multi_platform(path.PATH + r'/conf/release.xmind')
        else:
            test_file = path.get_multi_platform(path.PATH + r'/conf/test.xmind')

        logger.info('test_file:'+test_file)
        w = xmind.load(test_file)
        s1=w.getPrimarySheet() # get the first sheet

        r1=s1.getRootTopic() # get the root topic of this sheet

        r1.getSubTopics()

        get_LSubTopics(r1)

        Tcase.caseCheckPoint = LSubTopics
        Tcase.caseCount = LSubTopics.__len__()
Example #35
0
    items = {}
    root_items = []
    # Create all the items
    for i in tree.iter('item'):
        key = i.find('key').text
        summary = i.find('summary').text
        status = i.find('status').text
        description = i.find('description').text
        url = i.find('link').text
        children = [k.text for k in i.findall("issuelinks/issuelinktype[@id='10000']/inwardlinks/issuelink/issuekey")]
        parents = [k.text for k in i.findall("issuelinks/issuelinktype[@id='10000']/outwardlinks/issuelink/issuekey")]
        items[key] = {
            'summary': summary,
            'status': status,
            'url': url,
            'description': description,
            'children': children,
            'parents': parents
        }
        if len(parents) == 0:
            root_items.append(key)
    # Display the Tree
    w = xmind.load('new.xmind')
    s1 = w.getPrimarySheet()
    s1.setTitle("SPHERES Jira tickets")
    r1 = s1.getRootTopic()
    r1.setTitle("SPHERES")
    for k in root_items:
        add_item(items, k, r1)
    xmind.save(w, args.destination)
Example #36
0
__weibo__= 'http://weibo.com/ganchaojiang'

__data__ = '2015-05-23 12:06'

from appium import webdriver
import anaysisXmind
import xmind
import logging

import device_info
import ActionDo
import BaseTools.util

inputxmindfile = BaseTools.util.anaysisIniFile('config.ini', 'xmind_args', 'inputxmindfile')
logging.warning(inputxmindfile)
res = xmind.load(inputxmindfile)

driver = webdriver.Remote(
    command_executor='http://127.0.0.1:4723/wd/hub',
    desired_capabilities={
            "bundleId" : "cn.ninegame.gamemanager",
            "udid" : "{}".format(device_info.device_udid),
            "deviceName" : "gancj",
            "platformName" : "iOS",
            "platformVersion" : "8.3",
            "autoAcceptAlerts": "true"
    })

def tearDown():
    driver.quit()
Example #37
0
from xmind.core.topic import TopicElement
from xmind.core import workbook,saver

import xmind

myWorkbook = xmind.load("please-always-overwrite-the-output.xmind") # load an existing file or create a new workbook if nothing is found

mainSheet=myWorkbook.getPrimarySheet()
mainSheet.setTitle("first sheet")
rootTopic=mainSheet.getRootTopic()
rootTopic.setTitle("root node")

topics = ["first", "second", "third", "fourth", "fifth"]

for topic in topics:
    newTopic = TopicElement() # Initialize topic object
    newTopic.setTitle(topic) # Set node text
    rootTopic.addSubTopic(newTopic) # Attach the topic to the root topic

myWorkbook.addSheet(mainSheet) # the second sheet is now added to the workbook

xmind.save(myWorkbook,"test.xmind") # and we save

Example #38
0
# -*- coding:UTF-8 -*-

__author__ = 'gancj'

__data__ = '2015-05-23 10:47'

import xmind
from xmind.core import workbook,saver
from xmind.core.topic import TopicElement

w = xmind.load("test2.xmind") # load an existing file or create a new workbook if nothing is found
print w.getWorkbookElement()
print w.getSheets()
print w.getElementById(2)
print w.getPrimarySheet().getTitle()
print w.getPrimarySheet().getRootTopic().getTitle()

print w.getSheets()[1].getTitle()
print w.getSheets()[1].getRootTopic().getTitle()
#

print w.getSheets()[2].getTitle()
print w.getSheets()[2].getRootTopic().getID()
print w.getSheets()[2].getID()
print w.getSheets()[2].getChildNodesByTagName("test")

print w.getSheets()[2].getRootTopic().getSubTopics().__len__()

LSubTopics = []  #终点节点
getParentTopicByID_Dic = {}
getTopicByID_Dic = {}
        # continue traversal
        children = current.getSubTopics()
        child_level = current_level
        if MARKER_WRONG not in markers:
            child_level += 1
        if children is not None:
            for child in reversed(current.getSubTopics()):
                stack.append((child, child_level))
    return document

def clean_non_unicode(string):
    return ''.join([i if ord(i) < 128 else ' ' for i in string])

def write_to_file(document, output_file):
    with open(output_file, "w") as handle:
        for line in document:
            handle.write("{}\n".format(line))
    return 




if __name__ == "__main__":
    PARSER = argparse.ArgumentParser("matrix symmetrizer for RNAdistance")
    PARSER.add_argument("-i", "--input_file", type=str, help="rna distance matrix file")
    PARSER.add_argument("-o", "--output", type=str, help="output file")
    ARGS = PARSER.parse_args()
    
    IN = ARGS.input_file
    write_to_file(dump_markdown(xmind.load(IN).getPrimarySheet()), ARGS.output)
Example #40
0
sys.path.append(libdir)
from youtrack.connection import Connection

passwd = open('password.txt', 'r').read().strip()
user = config.USERNAME
server = 'https://106.125.46.213/youtrack/'
connection = Connection(server, user, passwd)

category = config.CATEGORY

print category + ' mindmap creation...'

# Get array of issues
issues_list = connection.getIssues('TRAR', 'Category: ' + category + ' State: -Obsolete sort by: {issue id} asc', 0, 2000)

issue_map = xmind.load(category + ".xmind")
sheet = issue_map.getPrimarySheet()
sheet.setTitle(category)
root_primary = sheet.getRootTopic()
root_primary.setTitle(category)


def getSuperParents(issues):
    parent_dict = dict()
    for issue in issues:
        parent_dict[issue.id] = (connection.getIssues('TRAR', 'Category: ' + category + ' State: -Obsolete Parent for: ' + issue.id, 0, 2000))
    parents = []
    for s in range(len(parent_dict.items())):
        if not parent_dict.items()[s][1]:
            parents.append(parent_dict.items()[s][0])
    return parents
Example #41
0
#-*- coding: utf-8 -*-
import xmind
from xmind.core import workbook,saver
from xmind.core.topic import TopicElement

w = xmind.load("test.xmind") # load an existing file or create a new workbook if nothing is found


# quickload block
w = xmind.load("data/Article.xmind")
sheet = w.getPrimarySheet()
root = sheet.getRootTopic()


s1=w.getPrimarySheet() # get the first sheet
s1.setTitle("first sheet") # set its title
r1=s1.getRootTopic() # get the root topic of this sheet
r1.setTitle("we don't care of this sheet") # set its title

s2=w.createSheet() # create a new sheet
s2.setTitle("second sheet")
r2=s2.getRootTopic()
r2.setTitle("root node")


t1=TopicElement() # create a new element
t1.setTopicHyperlink(s1.getID()) # set a link from this topic to the first sheet given by s1.getID()
t1.setTitle("redirection to the first sheet") # set its title

t2=TopicElement()
t2.setTitle("second node")