瀏覽代碼

CoTan自动化网页封装进入Hello

Huan 5 年之前
父節點
當前提交
4cc9543cd7
共有 6 個文件被更改,包括 26 次插入20 次删除
  1. 1 1
      CGB/Write.py
  2. 1 3
      Crawler/Crawler_controller.py
  3. 0 0
      Crawler/Information_storage.py
  4. 5 9
      Crawler/Web_Crawler.py
  5. 2 0
      Crawler/__init__.py
  6. 17 7
      Hello.py

+ 1 - 1
CGB/Write.py

@@ -179,7 +179,7 @@ def Draw(dis_x=900,dis_y=700):
     if done[1] != 0: print('Init!')  # 检查是否错误
     Font = pygame.font.Font('Font\ZKST.ttf', 16)  # 设置字体(Linux下应该用\而不是/)
     root = pygame.display.set_mode((dis_x, dis_y),0)  # 创建屏幕
-    root_caption = pygame.display.set_caption('CoTan画图板')#定义标题(后期加上定义Logo)
+    root_caption = pygame.display.set_caption('CoTan草稿板')#定义标题(后期加上定义Logo)
     root.fill([255, 255, 255])  # 默认用白色填充窗口
     flat = True#循环条件(不是全局)
     while flat:

+ 1 - 3
Crawler_controller.py → Crawler/Crawler_controller.py

@@ -1,13 +1,11 @@
 from selenium import webdriver
 import threading
 import time
-from os.path import exists
-from os import mkdir
 import hashlib
 from time import sleep
 import bs4
 import re as regular
-import Information_storage
+from Crawler import Information_storage
 import requests
 from selenium.webdriver.common.action_chains import ActionChains
 from selenium.webdriver.common.keys import Keys

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


+ 5 - 9
Web_Crawler.py → Crawler/Web_Crawler.py

@@ -1,10 +1,10 @@
-import Crawler_controller
+from Crawler import Crawler_controller
 import os
 import tkinter
 from tkinter.filedialog import askdirectory
 import re
 import threading
-import time
+
 
 def Main():
     global top,Git,PATH,bg,bbg,fg,cookies_list,Attributes_Dict,DataBase_list
@@ -567,8 +567,8 @@ def Main():
     top.update()#要预先update一下,否则会卡住
     global url,loader,Page_Parser,DataBase,save_dir
     save_dir = askdirectory(title='选择项目位置')#项目位置
-    url = Crawler_controller.url(save_dir,save_dir)#url管理器
-    loader = Crawler_controller.Page_Downloader(url,save_dir)#页面下载器
+    url = Crawler_controller.url(save_dir, save_dir)#url管理器
+    loader = Crawler_controller.Page_Downloader(url, save_dir)#页面下载器
     Page_Parser = Crawler_controller.Page_Parser(loader)#页面解析器
     DataBase = Crawler_controller.data_base#数据库
 
@@ -956,8 +956,4 @@ def add_url_from_tag():
 def update_URLBOX():
     global url,URL_BOX
     URL_BOX.delete(0,tkinter.END)
-    URL_BOX.insert(tkinter.END,*url.return_url())
-
-
-if __name__ == "__main__":
-    Main()
+    URL_BOX.insert(tkinter.END,*url.return_url())

+ 2 - 0
Crawler/__init__.py

@@ -0,0 +1,2 @@
+from Crawler.Web_Crawler import Main
+print('自动化网页加载完成')

+ 17 - 7
Hello.py

@@ -50,7 +50,7 @@ def Machine_Learning():
     Main()
 
 def MLA():
-    global top, DsGC
+    global top, Mla
     Mla = Process(target=Machine_Learning)
     Mla.start()
 
@@ -63,6 +63,16 @@ def GIT_Ctrl():
     Git = Process(target=Git_Ctrl)
     Git.start()
 
+def Crawler_Main():
+    from Crawler import Main
+    Main()
+
+def Crawlef_Run():
+    global top, crawlef
+    crawlef = Process(target=Crawler_Main)
+    crawlef.start()
+
+
 def Main():
     global top
     import tkinter
@@ -92,12 +102,12 @@ def Main():
     bg = '#FFFFFF'
     bc = 'tcross'
     #标题
-    tkinter.Label(F1, text='CoTan~NOTE', width=20,bg='#FFFFFF', font=ft).grid(column=0, row=0,sticky=tkinter.N)  # 设置说明
-    tkinter.Label(F1, text='私人笔记',bg=abg,font=ft1).grid(column=0, row=1,sticky=tkinter.W + tkinter.E)
-    tkinter.Button(F1,text='Git仓库控制器',cursor=bc,command=GIT_Ctrl,height=2,font=ft2,bg=bg,activebackground=abg,bd=0,justify=tkinter.LEFT).grid(column =0,row = 2,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='画图板',cursor=bc,command=Draw, height=2, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=3,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='爬虫系统',cursor=bc, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=4,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='我的寄忆',cursor=bc, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=5,sticky=tkinter.N + tkinter.E + tkinter.W)
+    tkinter.Label(F1, text='CoTan~科学计算', width=20,bg='#FFFFFF', font=ft).grid(column=0, row=0,sticky=tkinter.N)  # 设置说明
+    tkinter.Label(F1, text='寄忆学术',bg=abg,font=ft1).grid(column=0, row=1,sticky=tkinter.W + tkinter.E)
+    tkinter.Button(F1,text='我的寄忆',cursor=bc,height=2,font=ft2,bg=bg,activebackground=abg,bd=0,justify=tkinter.LEFT).grid(column =0,row = 2,sticky=tkinter.N + tkinter.E + tkinter.W)
+    tkinter.Button(F1, text='寄忆草稿版',cursor=bc,command=Draw, height=2, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=3,sticky=tkinter.N + tkinter.E + tkinter.W)
+    tkinter.Button(F1, text='自动化网页',cursor=bc,command=Crawlef_Run, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=4,sticky=tkinter.N + tkinter.E + tkinter.W)
+    tkinter.Button(F1, text='Git仓库控制器',cursor=bc,command=GIT_Ctrl, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=5,sticky=tkinter.N + tkinter.E + tkinter.W)
 
     abg = '#FFFAFA'
     tkinter.Label(F1, text='数学系统', bg=abg, font=ft1).grid(column=0, row=6,sticky=tkinter.W + tkinter.E)