亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

python xmind 包使用詳解(其中解決導(dǎo)出的xmind文件 xmind8可以打開 xmind2020及之后版本打開報(bào)錯(cuò)問題)

 更新時(shí)間:2021年10月18日 15:15:39   作者:weixin_40105587  
xmind8 可以打開xmind2020 報(bào)錯(cuò),如何解決這個(gè)問題呢?下面小編給大家?guī)?lái)了python xmind 包使用(其中解決導(dǎo)出的xmind文件 xmind8可以打開 xmind2020及之后版本打開報(bào)錯(cuò)問題),感興趣的朋友一起看看吧

pip install xmind 使用

在這里插入圖片描述

場(chǎng)景 xmind8 可以打開 xmind2020 報(bào)錯(cuò)
main_fest.xml(xmind8 打開另存后 更改后綴為.zip 里邊包含META-INF/manifest.xml)

** 將xmind文件修改后綴為zip ---->解壓---->放入main_fest.xml —>壓縮為zip —>修改后綴為xmind**

import xmind
import os
import re
import shutil
import zipfile
from xmind.core.const import TOPIC_DETACHED
from xmind.core.markerref import MarkerId
from xmind.core.topic import TopicElement

def extract(d_path, f_path, mode="zip"):
    """
    zip解壓縮亂碼問題處理
    :param d_path:
    :param f_path:
    :return:
    """
    root = d_path
    if not os.path.exists(root):
        os.makedirs(root)

    if mode == 'zip':
        zf = zipfile.ZipFile(f_path,"r")
    elif mode == 'rar':
        zf = rarfile.RarFile(f_path,"r")

    for n in zf.infolist():
        srcName = n.filename
        try:
            decodeName = srcName.encode("cp437").decode("utf-8")
        except:
            try:
                decodeName = srcName.encode("cp437").decode("gbk")
            except:
                decodeName = srcName
        spiltArr = decodeName.split("/")
        path = root
        for temp in spiltArr:
            path = os.path.join(path, temp)

        if decodeName.endswith("/"):
            if not os.path.exists(path):
                os.makedirs(path)
        else:
            if not os.path.exists(os.path.dirname(path)):
                os.makedirs(os.path.dirname(path))
            f = open(path, "wb")
            f.write(zf.read(srcName))
            f.close()
    zf.close()


def aftertreatment(path):
    """
    **場(chǎng)景 xmind8 可以打開 xmind2020 報(bào)錯(cuò)
    main_fest.xml(xmind8 打開另存后 更改后綴為.zip  里邊包含META-INF/manifest.xml)
    xmind 修改后綴為zip ----》解壓---- 》放入main_fest.xml  --- 》壓縮zip  修改后綴為xmind**
    """
    # 修改名字
    retval = os.path.dirname(os.path.abspath(__file__))
    folder = os.path.dirname(path)
    name = os.path.basename(path)
    unzip_folder = os.path.splitext(name)[0]
    zip_name = unzip_folder + ".zip"
    os.chdir(folder)
    os.rename(name, zip_name)
    os.chdir(retval)
    # 解壓
    unzip_path = os.path.join(folder, unzip_folder)
    if not os.path.exists(unzip_path):
        os.mkdir(unzip_path)

    inf_folder = os.path.join(unzip_path, "META-INF")
    if not os.path.exists(inf_folder):
        os.mkdir(inf_folder)

    extract(unzip_path, os.path.join(folder, zip_name))
    shutil.copyfile("./META-INF/manifest.xml", os.path.join(inf_folder, "manifest.xml"))
    os.remove(os.path.join(folder, zip_name))
    shutil.make_archive(unzip_path, 'zip', unzip_path)
    file_path = unzip_path + '.zip'
    print(file_path)
    os.chdir(os.path.dirname(file_path))
    os.rename(os.path.basename(file_path), name)
    os.chdir(retval)
    shutil.rmtree(unzip_path)



def gen_xmind_file(data, path):
    # load an existing file or create a new workbook if nothing is found
    workbook = xmind.load(path)
    # 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, data)
    # now we save as test.xmind
    xmind.save(workbook, path=path)
    # 修復(fù)
    aftertreatment(path)

def recursive(children, node, workbook):
    if len(children) == 0:
        return
    for c in children:
        t = TopicElement(ownerWorkbook=workbook)
        t.setTitle(c["data"]["text"])
        if len(c["children"]):
            recursive(c["children"], t, workbook)
        node.addSubTopic(t)


def gen_sheet2(workbook, sheet2, data):
    # ***** second sheet *****
    # create a new sheet and add to the workbook by default
    # sheet2 = workbook.createSheet()
    center = data["root"]["data"]["text"]
    sheet2.setTitle(center)

    # a sheet has a blank sheet by default
    root_topic2 = sheet2.getRootTopic()
    root_topic2.setTitle(center)

    topics = data["root"]["children"]
    for t in topics:
        # use other methods to create some sub topic element
        topic = TopicElement(ownerWorkbook=workbook)
        # set a topic hyperlink from this topic to the first sheet given by s1.getID()
        # topic1.setTopicHyperlink(sheet1.getID())
        # print(t["data"]["text"], t["data"]["layout_mind_offset"]["x"], t["data"]["layout_mind_offset"]["y"])
        topic.setTitle(t["data"]["text"])  # set its title
        # topic.setPosition(t["data"]["layout_mind_offset"]["x"], t["data"]["layout_mind_offset"]["y"])
        recursive(t["children"], topic, workbook)
        root_topic2.addSubTopic(topic)


if __name__ == '__main__':

    data = {
        "root": {
            "data": {
                "id": "c1jsg864saw0",
                "created": 1585126506413,
                "text": "新手指南",
                "color": "#000000",
                "font-weight": "bold",
                "font-size": 32
            },
            "children": [
                {
                    "data": {
                        "id": "c1jsisau8rc0",
                        "created": 1585126706961,
                        "text": "節(jié)點(diǎn)操作",
                        "expandState": "expand",
                        "layout_mind_offset": {
                            "x": 36,
                            "y": 93
                        },
                        "background": "#ffc000",
                        "font-size": 22,
                        "color": "#000000",
                        "font-weight": "bold",
                        "layout_right_offset": {
                            "x": -48,
                            "y": -39
                        },
                        "icon": "youxian_01"
                    },
                    "children": [
                        {
                            "data": {
                                "id": "c1jslg11qzk0",
                                "created": 1585126915340,
                                "text": "插入節(jié)點(diǎn)",
                                "font-size": 18,
                                "color": "#ffc000",
                                "layout_right_offset": {
                                    "x": 96,
                                    "y": -95
                                },
                                "background": "#404040",
                                "font-weight": "bold",
                                "icon": "qizhi_01"
                            },
                            "children": [
                                {
                                    "data": {
                                        "id": "c1jsn3rlhbc0",
                                        "created": 1585127045376,
                                        "text": "下級(jí):快捷鍵【Tab】 ",
                                        "font-size": 18,
                                        "color": "#ffc000",
                                        "layout_right_offset": {
                                            "x": 27,
                                            "y": -12
                                        },
                                        "background": "transparent"
                                    },
                                    "children": [

                                    ]
                                },
                                {
                                    "data": {
                                        "id": "c1jso0dk2cg0",
                                        "created": 1585127116361,
                                        "text": "同級(jí):快捷鍵【Enter】 ",
                                        "font-size": 18,
                                        "color": "#ffc000",
                                        "layout_right_offset": {
                                            "x": 27,
                                            "y": 0
                                        },
                                        "background": "transparent"
                                    },
                                    "children": [

                                    ]
                                },
                                {
                                    "data": {
                                        "id": "c1jsp3q5g4g0",
                                        "created": 1585127202017,
                                        "text": "上級(jí):快捷鍵【Shift + Tab】",
                                        "font-size": 18,
                                        "color": "#ffc000",
                                        "layout_right_offset": {
                                            "x": 30,
                                            "y": 13
                                        },
                                        "background": "transparent"
                                    },
                                    "children": [

                                    ]
                                }
                            ]
                        },
                        {
                            "data": {
                                "id": "c1jslivsluw0",
                                "created": 1585126921553,
                                "text": "移動(dòng)節(jié)點(diǎn)",
                                "font-size": 18,
                                "color": "#fabf8f",
                                "expandState": "expand",
                                "layout_right_offset": {
                                    "x": 97,
                                    "y": -36
                                },
                                "background": "#404040",
                                "font-weight": "bold"
                            },
                            "children": [
                                {
                                    "data": {
                                        "id": "c1jsqis0d540",
                                        "created": 1585127313145,
                                        "text": "上移:快捷鍵【Alt + ↑ 】",
                                        "background": "transparent",
                                        "font-size": 18,
                                        "color": "#fbd4b4",
                                        "layout_right_offset": {
                                            "x": 32,
                                            "y": -12
                                        }
                                    },
                                    "children": [

                                    ]
                                },
                                {
                                    "data": {
                                        "id": "c1jsqjz54o80",
                                        "created": 1585127315753,
                                        "text": "下移:快捷鍵【Alt + ↓ 】",
                                        "font-size": 18,
                                        "color": "#fbd4b4",
                                        "layout_right_offset": {
                                            "x": 31,
                                            "y": 0
                                        },
                                        "background": "transparent"
                                    },
                                    "children": [

                                    ]
                                },
                                {
                                    "data": {
                                        "id": "c1jsqkfoncw0",
                                        "created": 1585127316753,
                                        "text": "收起/展開:快捷鍵【 / 】",
                                        "font-size": 18,
                                        "color": "#fbd4b4",
                                        "layout_right_offset": {
                                            "x": 34,
                                            "y": 13
                                        },
                                        "background": "transparent"
                                    },
                                    "children": [

                                    ]
                                }
                            ]
                        },
                        {
                            "data": {
                                "id": "c1jt8kpu4x40",
                                "created": 1585128727922,
                                "text": "文字換行   ",
                                "expandState": "expand",
                                "font-size": 18,
                                "layout_right_offset": {
                                    "x": 103,
                                    "y": 25
                                },
                                "color": "#ffc000",
                                "background": "#404040",
                                "font-weight": "bold",
                                "icon": "star_02"
                            },
                            "children": [
                                {
                                    "data": {
                                        "id": "c1jt94rf40w0",
                                        "created": 1585128771553,
                                        "text": "快捷鍵【Shift + Enter 】",
                                        "font-size": 18,
                                        "layout_right_offset": {
                                            "x": 13,
                                            "y": -1
                                        },
                                        "color": "#ffc000"
                                    },
                                    "children": [

                                    ]
                                }
                            ]
                        }
                    ]
                },
                {
                    "data": {
                        "id": "c1jswayqnqo0",
                        "created": 1585127766323,
                        "text": "畫布操作",
                        "layout_mind_offset": {
                            "x": -737,
                            "y": -222
                        },
                        "font-size": 22,
                        "background": "#e5dfec",
                        "color": "#000000",
                        "font-weight": "bold",
                        "layout_right_offset": {
                            "x": 29,
                            "y": 83
                        }
                    },
                    "children": [
                        {
                            "data": {
                                "id": "c1jswgwssps0",
                                "created": 1585127779266,
                                "text": "放大畫布:Ctrl +“+”",
                                "font-size": 18,
                                "color": "#ccc0d9",
                                "layout_right_offset": {
                                    "x": 68,
                                    "y": -38
                                },
                                "layout_left_offset": {
                                    "x": -36,
                                    "y": -47
                                }
                            },
                            "children": [

                            ]
                        },
                        {
                            "data": {
                                "id": "c1jswhh0nmo0",
                                "created": 1585127780488,
                                "text": "縮小畫布:Ctrl +“-”",
                                "font-size": 18,
                                "color": "#ccc0d9",
                                "layout_right_offset": {
                                    "x": 68,
                                    "y": -22
                                },
                                "layout_left_offset": {
                                    "x": -39,
                                    "y": -28
                                }
                            },
                            "children": [

                            ]
                        },
                        {
                            "data": {
                                "id": "c1jswivop5k0",
                                "created": 1585127783552,
                                "text": "拖動(dòng)畫布:按住鼠標(biāo)右鍵",
                                "font-size": 18,
                                "color": "#ccc0d9",
                                "layout_right_offset": {
                                    "x": 69,
                                    "y": 2
                                },
                                "layout_left_offset": {
                                    "x": -39,
                                    "y": -3
                                }
                            },
                            "children": [

                            ]
                        },
                        {
                            "data": {
                                "id": "c1jswjvpi9k0",
                                "created": 1585127785730,
                                "text": "定位節(jié)點(diǎn)中心:雙擊鼠標(biāo)左鍵",
                                "font-size": 18,
                                "color": "#ccc0d9",
                                "layout_right_offset": {
                                    "x": 71,
                                    "y": 14
                                },
                                "layout_left_offset": {
                                    "x": -41,
                                    "y": 10
                                }
                            },
                            "children": [

                            ]
                        }
                    ]
                },
                {
                    "data": {
                        "id": "c1jsleo62hk0",
                        "created": 1585126912385,
                        "text": "導(dǎo)出格式",
                        "layout_mind_offset": {
                            "x": -46,
                            "y": 108
                        },
                        "expandState": "expand",
                        "font-size": 22,
                        "background": "#c2d69b",
                        "color": "#262626",
                        "font-weight": "bold",
                        "layout_right_offset": {
                            "x": 5,
                            "y": 153
                        }
                    },
                    "children": [
                        {
                            "data": {
                                "id": "c1knktgogog0",
                                "created": 1585214320627,
                                "text": "圖片",
                                "font-size": 18,
                                "color": "#000000",
                                "expandState": "expand",
                                "layout_right_offset": {
                                    "x": 58,
                                    "y": -20
                                },
                                "background": "#c2d69b",
                                "layout_left_offset": {
                                    "x": -48,
                                    "y": -28
                                }
                            },
                            "children": [
                                {
                                    "data": {
                                        "id": "c1jsqis0d540",
                                        "created": 1585127313145,
                                        "text": "JPG、PNG、SVG",
                                        "background": "transparent",
                                        "font-size": 18,
                                        "color": "#c2d69b",
                                        "layout_right_offset": {
                                            "x": 1,
                                            "y": 1
                                        }
                                    },
                                    "children": [

                                    ]
                                }
                            ]
                        },
                        {
                            "data": {
                                "id": "c1knl8lj2m00",
                                "created": 1585214353572,
                                "text": "文件",
                                "font-size": 18,
                                "color": "#000000",
                                "expandState": "expand",
                                "layout_right_offset": {
                                    "x": 61,
                                    "y": 0
                                },
                                "background": "#c2d69b",
                                "layout_left_offset": {
                                    "x": -47,
                                    "y": 2
                                }
                            },
                            "children": [
                                {
                                    "data": {
                                        "id": "c1jsqis0d540",
                                        "created": 1585127313145,
                                        "text": "PDF、json、TXT、markdown",
                                        "background": "transparent",
                                        "font-size": 18,
                                        "color": "#c2d69b",
                                        "layout_right_offset": {
                                            "x": 0,
                                            "y": 1
                                        }
                                    },
                                    "children": [

                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        "subtree": [

        ],
        "template": "default",
        "theme": "classic-compact",
        "relLine": [

        ],
        "style": {

        },
        "themeBgColor": "",
        "background": "",
        "version": "1.5.2",
        "ppts": [

        ]
    }
    path = '/home/python/Desktop/proejct_xx/_media/temp_file/test.xmind'
    gen_xmind_file(data,  path=path)

到此這篇關(guān)于python xmind 包使用 (其中解決導(dǎo)出的xmind文件 xmind8可以打開 xmind2020及之后版本打開報(bào)錯(cuò)問題)的文章就介紹到這了,更多相關(guān)python xmind 包使用內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • python中匿名函數(shù)的應(yīng)用方法

    python中匿名函數(shù)的應(yīng)用方法

    這篇文章主要介紹了python中匿名函數(shù)的應(yīng)用方法,匿名函數(shù)是無(wú)需使用def定義的函數(shù),只需使用關(guān)鍵字lambda進(jìn)行聲明,且只可使用一次,只有一個(gè)返回值,需要的朋友可以參考下
    2023-07-07
  • 使用wxPython獲取系統(tǒng)剪貼板中的數(shù)據(jù)的教程

    使用wxPython獲取系統(tǒng)剪貼板中的數(shù)據(jù)的教程

    這篇文章主要介紹了使用wxPython獲取系統(tǒng)剪貼板中的數(shù)據(jù)的教程,wxPython是一個(gè)非常受歡迎的Python圖形庫(kù),需要的朋友可以參考下
    2015-05-05
  • vscode配置anaconda3的方法步驟

    vscode配置anaconda3的方法步驟

    這篇文章主要介紹了vscode配置anaconda3的方法步驟,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-08-08
  • Python用20行代碼實(shí)現(xiàn)完整郵件功能

    Python用20行代碼實(shí)現(xiàn)完整郵件功能

    這篇文章主要介紹了如何使用Python實(shí)現(xiàn)完整郵件功能的相關(guān)資料,需要的朋友可以參考下面文章內(nèi)容,希望能幫助到您
    2021-09-09
  • Python自動(dòng)化測(cè)試工具Splinter簡(jiǎn)介和使用實(shí)例

    Python自動(dòng)化測(cè)試工具Splinter簡(jiǎn)介和使用實(shí)例

    這篇文章主要介紹了Python自動(dòng)化測(cè)試工具Splinter簡(jiǎn)介和使用實(shí)例,Splinter可以非常棒的模擬瀏覽器的行為,Splinter提供了豐富的API,可以獲取頁(yè)面的信息判斷當(dāng)前的行為所產(chǎn)生的結(jié)果
    2014-05-05
  • Python使用擴(kuò)展庫(kù)pywin32實(shí)現(xiàn)批量文檔打印實(shí)例

    Python使用擴(kuò)展庫(kù)pywin32實(shí)現(xiàn)批量文檔打印實(shí)例

    這篇文章主要介紹了Python使用擴(kuò)展庫(kù)pywin32實(shí)現(xiàn)批量文檔打印實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來(lái)看看吧
    2020-04-04
  • 一文詳解Python中l(wèi)ogging模塊的用法

    一文詳解Python中l(wèi)ogging模塊的用法

    logging是Python標(biāo)準(zhǔn)庫(kù)中記錄常用的記錄日志庫(kù),主要用于輸出運(yùn)行日志,可以設(shè)置輸出日志的等級(jí)、日志保存路徑、日志文件回滾等。本文主要來(lái)和大家聊聊它的具體用法,希望對(duì)大家有所幫助
    2023-02-02
  • Python基于Tkinter編寫crc校驗(yàn)工具

    Python基于Tkinter編寫crc校驗(yàn)工具

    這篇文章主要介紹了Python基于Tkinter編寫crc校驗(yàn)工具,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-05-05
  • virtualenv 指定 python 解釋器的版本方法

    virtualenv 指定 python 解釋器的版本方法

    今天小編就為大家分享一篇virtualenv 指定 python 解釋器的版本方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來(lái)看看吧
    2018-10-10
  • Pycharm創(chuàng)建python文件自動(dòng)添加日期作者等信息(步驟詳解)

    Pycharm創(chuàng)建python文件自動(dòng)添加日期作者等信息(步驟詳解)

    這篇文章主要介紹了Pycharm創(chuàng)建python文件自動(dòng)添加日期作者等信息(步驟詳解),本文分步驟給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-02-02

最新評(píng)論