final version
This commit is contained in:
12
final.py
12
final.py
@ -4,7 +4,7 @@ import time
|
||||
|
||||
from datetime import datetime
|
||||
from threading import Timer
|
||||
from logging import debug, info, error, basicConfig, DEBUG, FileHandler, StreamHandler
|
||||
from logging import debug, info, error, basicConfig, DEBUG, FileHandler, StreamHandler, INFO
|
||||
|
||||
from PyQt6.QtCore import QRegularExpression, QObject, QEvent
|
||||
from PyQt6.QtGui import QRegularExpressionValidator, QPixmap
|
||||
@ -442,7 +442,7 @@ class Window(QMainWindow):
|
||||
def showModeTable(self) -> None:
|
||||
def resource_path(relative_path):
|
||||
try:
|
||||
base_path = sys._MEIPASS
|
||||
base_path = os.path.dirname(__file__)
|
||||
except Exception:
|
||||
base_path = os.path.abspath(".")
|
||||
return os.path.join(base_path, relative_path)
|
||||
@ -452,7 +452,6 @@ class Window(QMainWindow):
|
||||
self.pixmap = QPixmap(resource_path("table.png"))
|
||||
if self.pixmap.width() == 0:
|
||||
error('Failed to load mode table image!')
|
||||
exit(1)
|
||||
|
||||
|
||||
debug(self.pixmap.width())
|
||||
@ -482,12 +481,9 @@ app = QApplication(sys.argv)
|
||||
def setup_logs() -> None:
|
||||
os.makedirs("logs", exist_ok=True)
|
||||
basicConfig(
|
||||
level=DEBUG,
|
||||
level=INFO,
|
||||
format="%(asctime)s [%(levelname)s] %(message)s",
|
||||
handlers=[
|
||||
FileHandler(f'./logs/{datetime.now().strftime("%Y%m%d-%H%M%S")}.log'),
|
||||
StreamHandler()
|
||||
]
|
||||
handlers=[StreamHandler()]
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user