快速生成GUI项目目录结构

# -*- 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)



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值