快速生成GUI项目目录结构

得意时要看淡,失意时要看开。不论得意失意,切莫大意;不论成功失败,切莫止步。志得意满时,需要的是淡然,给自己留一条退路;失意落魄时,需要的是泰然,给自己觅一条出路快速生成GUI项目目录结构,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

# -*- coding: UTF-8 -*-
"""
@Time    : 2022/8/17 11:12
@Author  : JiaoHiacheng
@Email   : JHC000abc@gmail.com
@Project : Python 
@File    : GUI.py
@des     : 快速生成 GUI 项目目录结构

"""
import os


def check_and_make_folder(path):
    '''
    检查传入的文件夹路径(绝对路径),不存在时创建文件夹
    :param path: 待检查文件夹路径
    :return:
    '''
    if not os.path.exists(path):
        os.makedirs(path)

def make_project_structures(path):
    '''
    传入要创建项目的根目录路径
    :param path: 项目根目录路径
    :return:
    '''
    check_and_make_folder(path)
    gui_path = os.path.join(path,"gui")
    check_and_make_folder(gui_path)
    # make gui children folders
    for file_name in ["control","res","ui"]:
        check_and_make_folder(os.path.join(gui_path,file_name))
    # make setting children folders
    setting_path = os.path.join(path, "setting")
    check_and_make_folder(setting_path)
    # make migrate children folders
    migrate_path = os.path.join(path, "migrate")
    check_and_make_folder(migrate_path)
    # make storage children folders
    storage_path = os.path.join(path, "storage")
    check_and_make_folder(storage_path)
    # make model children folders
    model_path = os.path.join(path, "model")
    check_and_make_folder(model_path)
    # make test children folders
    test_path = os.path.join(path, "test")
    check_and_make_folder(test_path)
    # make plugins children folders
    plugins_path = os.path.join(path, "plugins")
    check_and_make_folder(plugins_path)
    # make log children folders
    log_path = os.path.join(path, "log")
    check_and_make_folder(log_path)
    # make util children folders
    util_path = os.path.join(path, "util")
    check_and_make_folder(util_path)
    for file_name in ["util_db","util_map","util_other"]:
        check_and_make_folder(os.path.join(util_path,file_name))




if __name__ == '__main__':
    path = "D:\Projects\Python\client"
    make_project_structures(path)



版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/156908.html

(0)
飞熊的头像飞熊bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!