Bläddra i källkod

代码文件结构整理

Huan 5 år sedan
förälder
incheckning
49701abd6c

+ 0 - 3
CGB/__init__.py

@@ -1,3 +0,0 @@
-from CGB.Write import draw_main
-
-print('草稿版加载完毕...')

+ 0 - 3
Crawler/__init__.py

@@ -1,3 +0,0 @@
-from Crawler.Web_Crawler import crawler_main
-
-print("自动化网页加载完成")

+ 0 - 2
DSGC/__init__.py

@@ -1,2 +0,0 @@
-from DSGC.Algebra_Systemctl import algebraic_factory_main
-print('代数工厂加载完毕...')

+ 0 - 3
Data_Science/__init__.py

@@ -1,3 +0,0 @@
-from Data_Science.Me_learn import machine_learning
-
-print('数据科学模块加载完成...')

+ 0 - 3
Git_controller/__init__.py

@@ -1,3 +0,0 @@
-from Git_controller.GIT import git_main
-
-print('Git控制器加载完毕')

+ 0 - 3
HSCH/__init__.py

@@ -1,3 +0,0 @@
-from HSCH.Func_Matlib import function_mapping
-from HSCH.Func_advanced import function_factory_main
-print('函数工厂和函数测绘加载完毕...')

+ 8 - 8
Hello.py

@@ -2,7 +2,7 @@ from multiprocessing import Process
 
 
 def painting_board():
-    from CGB import draw_main
+    from draftboard import draw_main
     draw_main()
 
 
@@ -13,7 +13,7 @@ def Draw():
 
 
 def Data_Science():
-    from Data_Science import machine_learning
+    from datascience import machine_learning
     machine_learning()
 
 
@@ -24,7 +24,7 @@ def SJKX():
 
 
 def Function_mapping():
-    from HSCH import function_mapping
+    from funcsystem import function_mapping
     function_mapping()
 
 
@@ -35,7 +35,7 @@ def Hsch():
 
 
 def Function_factory():
-    from HSCH import function_factory_main
+    from funcsystem import function_factory_main
     function_factory_main()
 
 
@@ -46,7 +46,7 @@ def HSGC():
 
 
 def Algebraic_factory():
-    from DSGC import algebraic_factory_main
+    from algebraicfactory import algebraic_factory_main
     algebraic_factory_main()
 
 
@@ -57,7 +57,7 @@ def Dsgc():
 
 
 def Machine_Learning():
-    from Machine_learning_analysis import machine_learning
+    from machinelearning import machine_learning
     machine_learning()
 
 
@@ -68,7 +68,7 @@ def MLA():
 
 
 def Git_Ctrl():
-    from Git_controller import git_main
+    from gitrepo import git_main
     git_main()
 
 
@@ -94,7 +94,7 @@ def Main():
     import tkinter
     import tkinter.font as tkFont
     from PIL import ImageTk, Image
-    from New_TK import DragWindow
+    from drag import DragWindow
     print('加载完毕')
     top = DragWindow(alpha=0.97, width=1200, height=800)
     ft = tkFont.Font(family='Comic Sans MS', size=20, weight=tkFont.BOLD)

+ 0 - 2
Machine_learning_analysis/__init__.py

@@ -1,2 +0,0 @@
-from Machine_learning_analysis.Machine_learning import machine_learning
-print('机器学习分析加载完毕...')

+ 3 - 0
algebraicfactory/__init__.py

@@ -0,0 +1,3 @@
+from algebraicfactory.gui import algebraic_factory_main
+
+print('代数工厂加载完毕...')

+ 0 - 0
DSGC/Algebra.py → algebraicfactory/controller.py


+ 1 - 1
DSGC/Algebra_Systemctl.py → algebraicfactory/gui.py

@@ -2,7 +2,7 @@ import tkinter
 import tkinter.messagebox
 import tkinter.font as tkfont
 
-from DSGC.Algebra import AlgebraPolynomial
+from algebraicfactory.controller import AlgebraPolynomial
 
 algebra_list = []
 value_list = []

+ 3 - 0
crawler/__init__.py

@@ -0,0 +1,3 @@
+from crawler.gui import crawler_main
+
+print("自动化网页加载完成")

+ 3 - 3
Crawler/Crawler_controller.py → crawler/controller.py

@@ -10,7 +10,7 @@ from selenium import webdriver
 from selenium.webdriver.common.action_chains import ActionChains
 from selenium.webdriver.common.keys import Keys
 
-from Crawler import Information_storage
+from Crawler import db
 
 keys_name_dict = {
     "ctrl": Keys.CONTROL,
@@ -38,7 +38,7 @@ keys_name_dict = {
 }  # 键-值映射
 for i in range(1, 13):  # F1 - F12按键
     keys_name_dict[f"f{i}"] = eval(f"Keys.F{i}")
-data_base = Information_storage.DatabaseController()
+data_base = db.DatabaseController()
 
 
 class Page:
@@ -245,7 +245,7 @@ class PageDownloader:
     def __init__(self, url: Url, dic=""):
         self.url = url
         self.dir = dic
-        self.log = Information_storage.Log(dic)
+        self.log = db.Log(dic)
         PageDownloader.downloader_count += 1
         self.page_source_dict = {}  # 页面保存信息
         self.cookie_Thread = None  # 子进程

+ 0 - 0
Crawler/Information_storage.py → crawler/db.py


+ 5 - 5
Crawler/Web_Crawler.py → crawler/gui.py

@@ -1,4 +1,4 @@
-from Crawler import Crawler_controller
+from Crawler import controller
 import os
 import tkinter
 from tkinter.filedialog import askdirectory
@@ -2268,7 +2268,7 @@ tkinter.Button(
 
 SCREEN.update()  # 要预先update一下,否则会卡住
 save_dir = askdirectory(title="选择项目位置")  # 项目位置
-url = Crawler_controller.Url(save_dir, save_dir)  # url管理器
-loader = Crawler_controller.PageDownloader(url, save_dir)  # 页面下载器
-page_parser = Crawler_controller.PageParser(loader)  # 页面解析器
-database = Crawler_controller.data_base  # 数据库
+url = controller.Url(save_dir, save_dir)  # url管理器
+loader = controller.PageDownloader(url, save_dir)  # 页面下载器
+page_parser = controller.PageParser(loader)  # 页面解析器
+database = controller.data_base  # 数据库

+ 3 - 0
datascience/__init__.py

@@ -0,0 +1,3 @@
+from datascience.gui import machine_learning
+
+print('数据科学模块加载完成...')

+ 0 - 0
Data_Science/Learn.py → datascience/controller.py


+ 2 - 2
Data_Science/Me_learn.py → datascience/gui.py

@@ -7,13 +7,13 @@ from tkinter.scrolledtext import ScrolledText
 
 import chardet
 
-from Data_Science import Learn
+from datascience import controller
 
 render_dict = {}  # 保存了画图的List
 learn_dict = {}  # 保存数据处理
 PATH = os.getcwd()
 sheet_list = []
-machine_controller = Learn.MachineLearner()
+machine_controller = controller.MachineLearner()
 SCREEN = tkinter.Tk()
 bg_color = "#FFFAFA"  # 主颜色
 buttom_bg_color = "#FFFAFA"  # 按钮颜色

+ 0 - 0
CGB/ZKST.ttf → draftboard/ZKST.ttf


+ 3 - 0
draftboard/__init__.py

@@ -0,0 +1,3 @@
+from draftboard.board import draw_main
+
+print('草稿版加载完毕...')

+ 1 - 1
CGB/Write.py → draftboard/board.py

@@ -4,7 +4,7 @@ import os
 import pygame
 from pygame.locals import *
 
-from CGB.TK import tool_box
+from draftboard.toolbox import tool_box
 
 # 定义一些变量
 pen_color = [0, 0, 0]  # 画笔颜色

+ 37 - 24
CGB/TK_DoneHS.py → draftboard/customfunctions.py

@@ -3,8 +3,11 @@ import math
 import tkinter
 import tkinter.messagebox
 
-func = None
-SCREEN = tkinter.Tk()  # 设置屏幕
+SCREEN = None  # 设置屏幕
+func_input = None
+help = None
+button = None
+logger = None
 help_doc = """
 请在第一个输入框输入你的函数方程,不需要输入f(x)=和y=,唯一变量是x(x为自变量)
 圆周率-Pi,自然无理数-e
@@ -18,10 +21,21 @@ help_doc = """
 """
 
 
+class CustomFuncLogger:
+    def __init__(self):
+        self.func = None
+
+    def set(self, func):
+        self.func = func
+
+    def __call__(self, *args, **kwargs):
+        return self.func
+
+
 class FunctionExpression:
     def __init__(self, func):
-        self.FUNC = func
-        self.NAME = {
+        self.func = func
+        self.named_domain = {
             "x": 0,
             "Pi": math.pi,
             "e": math.e,
@@ -41,23 +55,23 @@ class FunctionExpression:
         }
 
     def __call__(self, x):
-        self.NAME["x"] = x
-        return eval(self.FUNC, self.NAME)
+        self.named_domain["x"] = x
+        return eval(self.func, self.named_domain)
 
 
 def custom():
-    global func_input, func, help_doc
+    global func_input, help_doc, logger
     func_str = func_input.get().replace(" ", "")
     if func_str:
         if tkinter.messagebox.askokcancel(
             "提示", f"是否确认生成自定义函数:\n{func_input.get()}\n(点击取消可撤销未执行的制造函数)"
         ):
-            func = FunctionExpression(func_input.get())
+            logger.set(FunctionExpression(func_input.get()))
         else:
-            func = None
+            logger.set(None)
     else:
         if tkinter.messagebox.askokcancel("提示", f"点击确定撤销为执行的制造函数"):
-            func = None
+            logger.set(None)
 
 
 def get_help():
@@ -65,17 +79,16 @@ def get_help():
 
 
 def make_func():
-    global SCREEN
-    SCREEN.mainloop()
-    return func
-
-
-SCREEN.title("")
-SCREEN.resizable(width=False, height=False)
-SCREEN.geometry(f"+350+10")
-button = tkinter.Button(SCREEN, text="制造函数", command=custom, width=28, height=1)  # 收到消息执行这个函数
-help = tkinter.Button(SCREEN, text="帮助", command=get_help, width=28, height=1)  # 帮助菜单
-func_input = tkinter.Entry(SCREEN)
-func_input.pack(fill=tkinter.BOTH)
-button.pack()
-help.pack()
+    global SCREEN, func_input, help, button, logger
+    SCREEN = tkinter.Toplevel()
+    SCREEN.title("")
+    SCREEN.resizable(width=False, height=False)
+    SCREEN.geometry(f"+350+10")
+    button = tkinter.Button(SCREEN, text="制造函数", command=custom, width=28, height=1)  # 收到消息执行这个函数
+    help = tkinter.Button(SCREEN, text="帮助", command=get_help, width=28, height=1)  # 帮助菜单
+    func_input = tkinter.Entry(SCREEN)
+    func_input.pack(fill=tkinter.BOTH)
+    button.pack()
+    help.pack()
+    logger = CustomFuncLogger()
+    return logger

+ 40 - 45
CGB/TK_HS.py → draftboard/drawingfunction.py

@@ -2,15 +2,21 @@ import math
 
 import tkinter.messagebox
 
-from CGB import TK_DoneHS
+from draftboard import customfunctions
 
 custom_function_index = 18  # 字定义函数的序号
 func_dict = {}
+custom_func_dict = {}
 width = 20
-SCREEN = tkinter.Tk()  # 设置屏幕
-SCREEN.title("")
-SCREEN.resizable(width=False, height=False)
-SCREEN.geometry(f"+180+10")
+SCREEN = None  # 设置屏幕
+
+
+class Logger:
+    def __call__(self, *args, **kwargs):
+        global custom_func_dict, func_dict
+        for i in custom_func_dict:
+            func_dict[i] = custom_func_dict[i]()
+        return func_dict
 
 
 def linear_func():
@@ -174,47 +180,36 @@ def arccsc_func():
 
 
 def custom_func():
-    global func_dict, custom_function_index
-    get = TK_DoneHS.make_func()
-    if get is not None:
-        func_dict[custom_function_index] = get
-        custom_function_index += 1
-
-
-def close():
-    global SCREEN
-    try:
-        TK_DoneHS.SCREEN.destroy()
-    except BaseException:
-        pass
-    SCREEN.destroy()
+    global func_dict, custom_function_index, custom_func_dict
+    custom_func_dict[custom_function_index] = customfunctions.make_func()
 
 
 def func_box():
     global SCREEN
-    SCREEN.mainloop()
-    return func_dict
-
-
-tkinter.Button(SCREEN, text="1次函数", command=linear_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="2次函数", command=quadratic_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="-1次函数", command=inverse_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="3次函数", command=cubic_function, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="根号函数", command=radical_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="对数函数", command=log_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="指数函数", command=exp_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="对数底函数", command=log2_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="sin函数", command=sin_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="cos函数", command=cos_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="tan函数", command=tan_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="cot函数", command=tan_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="csc函数", command=csc_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="sec函数", command=sec_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="arcsin函数", command=arcsin_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="arccos函数", command=arccos_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="arctan函数", command=arctan_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="arccot函数", command=arccot_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="arccsc函数", command=arccsc_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="arcsec函数", command=arcsec_func, width=width, height=1).pack()
-tkinter.Button(SCREEN, text="自定义函数", command=custom_func, width=width, height=3).pack()
-SCREEN.protocol("WM_DELETE_WINDOW", close)
+    loger = Logger()
+    SCREEN = tkinter.Toplevel()  # 设置屏幕
+    SCREEN.title("")
+    SCREEN.resizable(width=False, height=False)
+    SCREEN.geometry(f"+180+10")
+    tkinter.Button(SCREEN, text="1次函数", command=linear_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="2次函数", command=quadratic_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="-1次函数", command=inverse_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="3次函数", command=cubic_function, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="根号函数", command=radical_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="对数函数", command=log_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="指数函数", command=exp_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="对数底函数", command=log2_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="sin函数", command=sin_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="cos函数", command=cos_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="tan函数", command=tan_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="cot函数", command=tan_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="csc函数", command=csc_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="sec函数", command=sec_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="arcsin函数", command=arcsin_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="arccos函数", command=arccos_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="arctan函数", command=arctan_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="arccot函数", command=arccot_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="arccsc函数", command=arccsc_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="arcsec函数", command=arcsec_func, width=width, height=1).pack()
+    tkinter.Button(SCREEN, text="自定义函数", command=custom_func, width=width, height=3).pack()
+    return loger

+ 49 - 58
CGB/TK.py → draftboard/toolbox.py

@@ -2,10 +2,13 @@ from tkinter.colorchooser import askcolor
 from tkinter.filedialog import asksaveasfile
 import tkinter.messagebox
 
-from CGB import TK_HS
+from draftboard import drawingfunction
 
+SCREEN = None
+pen_weight_input = None
+span_input = None
 background_image = None
-func_list = {}
+func_logger = None
 coordinate_system_drawing_method = None
 background_color = None
 pen_weight = None
@@ -16,7 +19,6 @@ save_dir = None
 gui_width = 20
 gui_height = 3
 span = None
-SCREEN = tkinter.Tk()  # 设置屏幕
 help_doc = """
 *快捷键:
     d-不用点击左键画线(再次点击关闭)
@@ -163,14 +165,14 @@ def plot_coordinate_big_span():
 
 
 def set_span():
-    global coordinate_system_drawing_method, span, span_Input
-    span_input = span_Input.get().replace(" ", "")
+    global coordinate_system_drawing_method, span, span_input
+    span_input_str = span_input.get().replace(" ", "")
     try:
-        span_input = int(span_input)
+        span_input_str = int(span_input_str)
         if tkinter.messagebox.askokcancel(
-            "提示", f"是否设定跨度为{span_input}(跨度代表坐标系一个单位大小的实际像素,系统默认大跨度为:120)"
+            "提示", f"是否设定跨度为{span_input_str}(跨度代表坐标系一个单位大小的实际像素,系统默认大跨度为:120)"
         ):
-            span = span_input
+            span = span_input_str
             coordinate_system_drawing_method = 1
         else:
             coordinate_system_drawing_method = None
@@ -194,8 +196,8 @@ def empty():
 
 
 def open_func_box():
-    global func_list
-    func_list = TK_HS.func_box()
+    global func_logger
+    func_logger = drawingfunction.func_box()
 
 
 def _help():
@@ -203,64 +205,53 @@ def _help():
     tkinter.messagebox.showinfo(title="帮助", message=help_doc)
 
 
-def close():  # 关闭屏幕事件
-    global SCREEN
-    try:
-        TK_HS.TK_DoneHS.SCREEN.destroy()
-    except BaseException:
-        pass
-    try:
-        TK_HS.SCREEN.destroy()
-    except BaseException:
-        pass
-    SCREEN.destroy()
-
-
 def tool_box():
-    global SCREEN  # 初始化屏幕
+    global SCREEN, span_input  # 初始化屏幕
+    SCREEN = tkinter.Tk()  # 设置屏幕
+    SCREEN.title("")
+    SCREEN.resizable(width=False, height=False)
+    SCREEN.geometry(f"+10+10")
+    tkinter.Button(SCREEN, text="选择颜色", command=select_color, width=gui_width, height=gui_height).pack()
+    tkinter.Button(SCREEN, text="选择增函数颜色", command=increasing_func_color, width=gui_width, height=1).pack()
+    tkinter.Button(SCREEN, text="选择减函数颜色", command=subtraction_func_color, width=gui_width, height=1).pack()
+    tkinter.Button(SCREEN, text="使用中笔(默认笔)", command=switch_stroke, width=gui_width, height=gui_height).pack()
+    tkinter.Button(SCREEN, text="使用大笔", command=switch_big, width=gui_width, height=1).pack()  # 切换到大笔
+    tkinter.Button(SCREEN, text="使用小笔", command=switch_small, width=gui_width, height=1).pack()  # 切换笔
+    tkinter.Button(SCREEN, text="使用刷子", command=switch_brush, width=gui_width, height=1).pack()  # 切换笔
+    pen_weight_input = tkinter.Entry(SCREEN, width=gui_width - 2)
+    pen_weight_input.pack(fill=tkinter.BOTH)
+    tkinter.Button(SCREEN, text="使用自定义大小", command=set_pen, width=gui_width, height=1).pack()  # 切换笔
+    tkinter.Button(SCREEN, text="清空草稿", command=empty, width=gui_width, height=gui_height).pack()  # 填充背景
+    tkinter.Button(SCREEN, text="绘制坐标系", command=plot_coordinate, width=gui_width, height=gui_height).pack()
+    tkinter.Button(SCREEN, text="绘制坐标系(小跨度)", command=plot_coordinate_small, width=gui_width, height=1).pack()
+    tkinter.Button(
+        SCREEN,
+        text="绘制坐标系(大跨度)",
+        command=plot_coordinate_big_span,
+        width=gui_width,
+        height=1,
+    ).pack()  # 绘制坐标系
+    span_input = tkinter.Entry(SCREEN, width=gui_width - 2)
+    span_input.pack(fill=tkinter.BOTH)
+    tkinter.Button(SCREEN, text="使用自定义跨度", command=set_span, width=gui_width, height=1).pack()  # 切换笔
+    tkinter.Button(SCREEN, text="绘制函数", command=open_func_box, width=gui_width, height=gui_height).pack()
+    tkinter.Button(SCREEN, text="保存", command=choose_save, width=gui_width, height=1).pack()
+    tkinter.Button(SCREEN, text="载入", command=choose_open, width=gui_width, height=1).pack()
+    tkinter.Button(SCREEN, text="帮助", command=_help, width=gui_width, height=1).pack()  # help是系统保留关键词,用_help代替
     SCREEN.mainloop()
+    try:
+        func = func_logger()
+    except BaseException:
+        func = {}
     return [
         pen_color,
         pen_weight,
         background_color,
         coordinate_system_drawing_method,
-        func_list,
+        func,
         save_dir,
         increasing_color,
         subtraction_color,
         span,
         background_image,
     ]
-
-
-SCREEN.title("")
-SCREEN.resizable(width=False, height=False)
-SCREEN.geometry(f"+10+10")
-tkinter.Button(SCREEN, text="选择颜色", command=select_color, width=gui_width, height=gui_height).pack()
-tkinter.Button(SCREEN, text="选择增函数颜色", command=increasing_func_color, width=gui_width, height=1).pack()
-tkinter.Button(SCREEN, text="选择减函数颜色", command=subtraction_func_color, width=gui_width, height=1).pack()
-tkinter.Button(SCREEN, text="使用中笔(默认笔)", command=switch_stroke, width=gui_width, height=gui_height).pack()
-tkinter.Button(SCREEN, text="使用大笔", command=switch_big, width=gui_width, height=1).pack()  # 切换到大笔
-tkinter.Button(SCREEN, text="使用小笔", command=switch_small, width=gui_width, height=1).pack()  # 切换笔
-tkinter.Button(SCREEN, text="使用刷子", command=switch_brush, width=gui_width, height=1).pack()  # 切换笔
-pen_weight_input = tkinter.Entry(SCREEN, width=gui_width - 2)
-pen_weight_input.pack(fill=tkinter.BOTH)
-tkinter.Button(SCREEN, text="使用自定义大小", command=set_pen, width=gui_width, height=1).pack()  # 切换笔
-tkinter.Button(SCREEN, text="清空草稿", command=empty, width=gui_width, height=gui_height).pack()  # 填充背景
-tkinter.Button(SCREEN, text="绘制坐标系", command=plot_coordinate, width=gui_width, height=gui_height).pack()
-tkinter.Button(SCREEN, text="绘制坐标系(小跨度)", command=plot_coordinate_small, width=gui_width, height=1).pack()
-tkinter.Button(
-    SCREEN,
-    text="绘制坐标系(大跨度)",
-    command=plot_coordinate_big_span,
-    width=gui_width,
-    height=1,
-).pack()  # 绘制坐标系
-span_Input = tkinter.Entry(SCREEN, width=gui_width - 2)
-span_Input.pack(fill=tkinter.BOTH)
-tkinter.Button(SCREEN, text="使用自定义跨度", command=set_span, width=gui_width, height=1).pack()  # 切换笔
-tkinter.Button(SCREEN, text="绘制函数", command=open_func_box, width=gui_width, height=gui_height).pack()
-tkinter.Button(SCREEN, text="保存", command=choose_save, width=gui_width, height=1).pack()
-tkinter.Button(SCREEN, text="载入", command=choose_open, width=gui_width, height=1).pack()
-tkinter.Button(SCREEN, text="帮助", command=_help, width=gui_width, height=1).pack()  # help是系统保留关键词,用_help代替
-SCREEN.protocol("WM_DELETE_WINDOW", close)

+ 0 - 0
New_TK/__init__.py → drag/__init__.py


+ 11 - 0
funcsystem/__init__.py

@@ -0,0 +1,11 @@
+load_object = None
+
+while load_object is None:
+    pass
+
+if load_object == 'function_mapping':
+    from funcsystem.map import function_mapping
+    print('函数测绘加载完毕...')
+else:
+    from funcsystem.factory import function_factory_main
+    print('函数工厂加载完毕...')

+ 0 - 0
HSCH/HS.py → funcsystem/controller.py


+ 1 - 1
HSCH/Func_advanced.py → funcsystem/factory.py

@@ -8,7 +8,7 @@ from matplotlib import pyplot as plt
 from matplotlib import rcParams
 from matplotlib.animation import FuncAnimation
 
-from HSCH.HS import ExpFunc as ExpFunc
+from funcsystem.controller import ExpFunc as ExpFunc
 
 func = None
 fig = None

+ 18 - 18
HSCH/Func_Matlib.py → funcsystem/map.py

@@ -11,9 +11,9 @@ import pandas
 from matplotlib import pyplot as plt
 from matplotlib import rcParams
 
-from HSCH.HS import ExpFunc, SheetFunc
+from funcsystem.controller import ExpFunc, SheetFunc
 
-func_list = []
+func_logger = []
 fig = None
 func_str_list = []
 prompt_num = 0
@@ -62,7 +62,7 @@ def type_selection(iter_object, si=float, n=True):  # Float筛选系统
 
 
 def plot_func():
-    global func_list, definition_domain, fig, x_limit, y_limit, y_axis, x_axis
+    global func_logger, definition_domain, fig, x_limit, y_limit, y_axis, x_axis
     # 画板创造
     output_prompt("生成绘制取...")
     fig = plt.figure(num="CoTan函数")  # 定义一个图像窗口
@@ -250,7 +250,7 @@ def plot_func():
 
 
 def add_from_csv():  # 添加函数
-    global func_list, func_str_list, func_exp_box, definition_domain, func_name, line_style, point_style, func_style
+    global func_logger, func_str_list, func_exp_box, definition_domain, func_name, line_style, point_style, func_style
     file = tkinter.filedialog.askopenfilename(title="载入表格", filetypes=[("CSV", ".csv")])
     style_str = func_style.get().split("#")
     try:
@@ -280,7 +280,7 @@ def add_from_csv():  # 添加函数
 
 
 def add_func():  # 添加函数
-    global func_list, func_str_list, func_exp_box, func_name, line_style, point_style, func_style, definition_domain
+    global func_logger, func_str_list, func_exp_box, func_name, line_style, point_style, func_style, definition_domain
     get = func_exp.get().replace(" ", "")
     definition = definition_domain.get().split(",")
     name = func_name.get().replace(" ", "")
@@ -330,7 +330,7 @@ def add_func():  # 添加函数
 
 
 def clean_func_box():  # 添加函数
-    global func_list, func_str_list, func_exp_box, func_name, line_style, point_style, func_style
+    global func_logger, func_str_list, func_exp_box, func_name, line_style, point_style, func_style
     if tkinter.messagebox.askokcancel("提示", "是否清空所有函数?)"):
         func_str_list = []
         func_list = []
@@ -339,7 +339,7 @@ def clean_func_box():  # 添加函数
 
 
 def func_to_sheet():  # 显示xy
-    global func_list, func_exp_box, sheet_box
+    global func_logger, func_exp_box, sheet_box
     try:
         func = func_list[func_exp_box.curselection()[0]]
         sheet_box.delete(0, tkinter.END)
@@ -351,7 +351,7 @@ def func_to_sheet():  # 显示xy
 
 
 def clean_func_memory():
-    global x_value, func_exp_box, func_list
+    global x_value, func_exp_box, func_logger
     try:
         if tkinter.messagebox.askokcancel(
             "提示", f"确定删除{func_list[func_exp_box.curselection()[0]]}的记忆吗?"
@@ -367,7 +367,7 @@ def clean_func_memory():
 
 
 def hide_memory():  # 显示xy
-    global func_list, result_box
+    global func_logger, result_box
     try:
         func = func_list[func_exp_box.curselection()[0]]
         result_box.delete(0, tkinter.END)
@@ -378,7 +378,7 @@ def hide_memory():  # 显示xy
 
 
 def show_memory():  # 显示xy
-    global func_list, result_box
+    global func_logger, result_box
     try:
         fucn = func_list[func_exp_box.curselection()[0]]
         result_box.delete(0, tkinter.END)
@@ -393,7 +393,7 @@ def show_memory():  # 显示xy
 
 
 def property_prediction():
-    global func_list, func_exp_box, property_box
+    global func_logger, func_exp_box, property_box
     try:
         output_prompt("预测过程程序可能无响应")
         fucn = func_list[func_exp_box.curselection()[0]]
@@ -406,7 +406,7 @@ def property_prediction():
 
 
 def calculate():
-    global func_list, result_box, x_value, func_exp_box
+    global func_logger, result_box, x_value, func_exp_box
     try:
         output_prompt("计算过程程序可能无响应")
         fucn = func_list[func_exp_box.curselection()[0]]
@@ -424,7 +424,7 @@ def func_to_csv():  # 导出CSV
     if not func_exp_box.curselection():
         return False
     try:
-        fucn = func_list[func_exp_box.curselection()[0]]
+        fucn = func_logger[func_exp_box.curselection()[0]]
         fucn.save_csv()
         output_prompt("CSV导出成功")
     except BaseException:
@@ -432,7 +432,7 @@ def func_to_csv():  # 导出CSV
 
 
 def del_func():  # 删除函数
-    global func_list, func_str_list, func_exp_box
+    global func_logger, func_str_list, func_exp_box
     del_fucn = func_exp_box.curselection()
     for i in del_fucn:  # 只存在一项
         func_exp_box.delete(i)
@@ -442,7 +442,7 @@ def del_func():  # 删除函数
 
 
 def dichotomy():
-    global func_list, result_box, y_value, dicon_parameters
+    global func_logger, result_box, y_value, dicon_parameters
     try:
         output_prompt("计算过程程序可能无响应")
         fucn = func_list[func_exp_box.curselection()[0]]  # 获取目标函数
@@ -464,7 +464,7 @@ def dichotomy():
 
 
 def gradient_method_calculation():
-    global func_list, result_box, y_value_gradient
+    global func_logger, result_box, y_value_gradient
     try:
         output_prompt("计算过程程序可能无响应")
         fucn = func_list[func_exp_box.curselection()[0]]  # 获取目标函数
@@ -491,7 +491,7 @@ def output_prompt(news):
 
 
 def func_differentiation():
-    global func_list, func_exp_box, property_box, func_str_list, func_name, line_style, point_style, func_style
+    global func_logger, func_exp_box, property_box, func_str_list, func_name, line_style, point_style, func_style
     try:
         fucn = func_list[func_exp_box.curselection()[0]]
         diff = fucn.derivatives
@@ -521,7 +521,7 @@ def func_differentiation():
 def function_mapping():
     global SCREEN, FONT, line_style, point_style, csv_list, func_exp, definition_domain, func_name, func_style
     global x_axis, y_axis, x_limit, y_limit
-    global func_exp_box, sheet_box, x_value, result_box, func_list, func_str_list, y_value, dicon_parameters
+    global func_exp_box, sheet_box, x_value, result_box, func_logger, func_str_list, y_value, dicon_parameters
     global y_value_gradient, property_box, prompt_box, prompt_num
 
     SCREEN.mainloop()

+ 3 - 0
gitrepo/__init__.py

@@ -0,0 +1,3 @@
+from gitrepo.gui import git_main
+
+print('Git控制器加载完毕')

+ 0 - 0
Git_controller/GitController.py → gitrepo/controller.py


+ 3 - 3
Git_controller/GIT.py → gitrepo/gui.py

@@ -8,7 +8,7 @@ from tkinter import ttk
 from tkinter.filedialog import asksaveasfilename, askdirectory, askopenfilenames
 from tkinter.scrolledtext import ScrolledText
 
-from Git_controller import GitController
+from gitrepo import controller
 
 
 def git_main():
@@ -309,7 +309,7 @@ def cli(
 ):
     command_thread = func(*args)
     format_flat = True
-    stop_key = GitController.stop_key
+    stop_key = controller.stop_key
 
     def save_to_txt():
         nonlocal data
@@ -764,7 +764,7 @@ def progress_bar(*args, name="CoTan_Git >>> 运行中...", **kwargs):
 
 file_list = []
 PATH = os.getcwd()
-git = GitController.GitCtrol()
+git = controller.GitCtrol()
 repo_list = []
 SCREEN = tkinter.Tk()
 last_name = None

+ 3 - 0
machinelearning/__init__.py

@@ -0,0 +1,3 @@
+from machinelearning.gui import machine_learning
+
+print('机器学习分析加载完毕...')

+ 0 - 0
Machine_learning_analysis/Learn_Numpy.py → machinelearning/controller.py


+ 3 - 3
Machine_learning_analysis/Machine_learning.py → machinelearning/gui.py

@@ -6,14 +6,14 @@ from tkinter.filedialog import askopenfilename, asksaveasfilename, askdirectory
 import chardet
 import webbrowser
 
-from Machine_learning_analysis import Learn_Numpy
+from machinelearning import controller
 
 calculation_list = []
 calculation_method = []
 PATH = os.getcwd()
 sheet_list = []
 merge_list = []
-learner_controller = Learn_Numpy.MachineLearner()
+learner_controller = controller.MachineLearner()
 SCREEN = tkinter.Tk()
 gui_width = 13  # 标准宽度
 gui_height = 2
@@ -130,7 +130,7 @@ def del_leaner():
 def global_seeting():
     global global_settings
     args = [bool(i.get()) for i in global_settings]
-    Learn_Numpy.set_global(*args)
+    controller.set_global(*args)
 
 
 def reshape():