Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
qaqFei committed Oct 23, 2024
1 parent abaac7c commit 2dbc58f
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 33 deletions.
12 changes: 12 additions & 0 deletions src/check_edgechromium.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import tkinter.messagebox
from os import system

import webview.platforms.winforms

if webview.platforms.winforms.renderer != "edgechromium":
tkinter.messagebox.showerror("错误", "请使用EdgeChromium渲染器\n关闭此对话框后将启动安装程序")
system(".\\ecwv_installer.exe")
if webview.platforms.winforms._is_chromium():
webview.platforms.winforms.renderer = "edgechromium"
else:
tkinter.messagebox.showwarning("警告", "EdgeChromium渲染器安装失败或取消\n请手动安装\n接下来将继续运行程序, 能不能跑起来全看天意吧...")
File renamed without changes.
7 changes: 7 additions & 0 deletions src/fix_workpath.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys
from os import chdir
from os.path import abspath, dirname

selfdir = dirname(sys.argv[0])
if selfdir == "": selfdir = abspath(".")
chdir(selfdir)
10 changes: 4 additions & 6 deletions src/gui_launcher.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import fix_workpath as _

import ctypes
from tkinter import Tk, Label, BooleanVar, StringVar
from tkinter.ttk import Entry, Button, Checkbutton, LabelFrame
from tkinter.filedialog import askopenfilename
from tkinter.messagebox import showerror
from os import chdir,popen
from os.path import exists,isfile,dirname
from os import popen
from os.path import exists, isfile
from sys import argv

import gui_const
import console_window

console_window.Hide()

selfdir = dirname(argv[0])
if selfdir == "": selfdir = "."
chdir(selfdir)

if exists("./main.py"):
target_path = "./main.py"
elif exists("./main.exe"):
Expand Down
10 changes: 4 additions & 6 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import err_processer as _
import init_logging as _
import fix_workpath as _
import check_edgechromium as _

import json
import sys
import time
import logging
from threading import Thread
from ctypes import windll
from os import chdir, listdir, popen, environ; environ["PYGAME_HIDE_SUPPORT_PROMPT"] = ""
from os.path import exists, abspath, dirname, isfile, isdir
from os import listdir, popen, environ; environ["PYGAME_HIDE_SUPPORT_PROMPT"] = ""
from os.path import exists, isfile, isdir
from shutil import rmtree
from tempfile import gettempdir
from ntpath import basename
Expand All @@ -31,10 +33,6 @@
import ppr_help
from phicore import *

selfdir = dirname(sys.argv[0])
if selfdir == "": selfdir = abspath(".")
chdir(selfdir)

if not exists("./7z.exe") or not exists("./7z.dll"):
logging.fatal("7z.exe or 7z.dll Not Found")
windll.kernel32.ExitProcess(1)
Expand Down
10 changes: 4 additions & 6 deletions src/phigros.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import err_processer as _
import init_logging as _
import fix_workpath as _
import check_edgechromium as _

import webbrowser
import typing
Expand All @@ -11,8 +13,8 @@
import logging
from threading import Thread
from ctypes import windll
from os import chdir, environ, mkdir, system, popen, listdir; environ["PYGAME_HIDE_SUPPORT_PROMPT"] = ""
from os.path import exists, abspath, dirname
from os import environ, mkdir, system, listdir; environ["PYGAME_HIDE_SUPPORT_PROMPT"] = ""
from os.path import exists
from shutil import rmtree
from tempfile import gettempdir

Expand All @@ -31,10 +33,6 @@
import chartfuncs_rpe
import playsound

selfdir = dirname(sys.argv[0])
if selfdir == "": selfdir = abspath(".")
chdir(selfdir)

if not exists("./7z.exe") or not exists("./7z.dll"):
logging.fatal("7z.exe or 7z.dll Not Found")
windll.kernel32.ExitProcess(1)
Expand Down
6 changes: 3 additions & 3 deletions src/tool-compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def compile(file:str, hideconsole:bool):
debug = "--debug" in argv
compile_files = [
("main.py", False),
("GUI_Launcher.py", False),
("Phigros.py", False)
("gui_launcher.py", False),
("phigros.py", False)
]
extend = open("_compile_pyiextend.py", "r", encoding="utf-8").read()

Expand All @@ -33,7 +33,7 @@ def compile(file:str, hideconsole:bool):
system(f"{py} -m pip install pyinstaller")
pyinstaller = ".\\compile_venv\\Scripts\\pyinstaller.exe"
pyi_makespec = ".\\compile_venv\\Scripts\\pyi-makespec.exe"
ts:list[Thread] = []
ts: list[Thread] = []

for file, hideconsole in compile_files:
ts.append(Thread(target=compile, args=(file, hideconsole)))
Expand Down
7 changes: 2 additions & 5 deletions src/tool-createAutoplayOneFingerVideo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fix_workpath as _

import json
from os import chdir
from os.path import dirname, abspath
from sys import argv
from random import uniform

Expand Down Expand Up @@ -120,9 +120,6 @@ def gfingerp(sec: float) -> tuple[float, float]:
fps = videoCap.get(cv2.CAP_PROP_FPS)
optWriter = cv2.VideoWriter(outputVideoFilePath, cv2.VideoWriter.fourcc(*'mp4v'), fps, (w, h), True)

selfdir = dirname(argv[0])
if selfdir == "": selfdir = abspath(".")
chdir(selfdir)
finger = Image.open("./resources/finger.png")
finger = finger.resize((int(w * 0.4), int(w * 0.4 / finger.width * finger.height)))

Expand Down
10 changes: 3 additions & 7 deletions src/webcv.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
from __future__ import annotations

import fix_workpath as _

import threading
import typing
import http.server
import io
import time
from ctypes import windll
from os import chdir
from os.path import abspath, dirname
from sys import argv
from os.path import abspath
from random import randint

import webview
from PIL import Image

selfdir = dirname(argv[0])
if selfdir == "": selfdir = abspath(".")
chdir(selfdir)

current_thread = threading.current_thread
screen_width = windll.user32.GetSystemMetrics(0)
screen_height = windll.user32.GetSystemMetrics(1)
Expand Down

0 comments on commit 2dbc58f

Please sign in to comment.