From dd05106d8ca88bd6b3bec802712e3b9a6d9fdd0e Mon Sep 17 00:00:00 2001 From: shintaroDesu Date: Tue, 30 Jun 2020 15:08:29 +0200 Subject: [PATCH] more logs --- ScrollArea.py | 4 ++++ SettingsPage.py | 2 ++ SkinDropDown.py | 3 +++ main.py | 24 +++++++----------------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ScrollArea.py b/ScrollArea.py index 68b6699..f494d8a 100644 --- a/ScrollArea.py +++ b/ScrollArea.py @@ -1,7 +1,9 @@ +import logging import os from PyQt5 import QtWidgets from PyQt5 import QtCore +from autologging import traced, logged from DoubleSlider import DoubleSlider from GridLayout import GridLayout @@ -17,6 +19,8 @@ from config_data import current_settings, current_config +@logged(logging.getLogger(__name__)) +@traced("changesize", exclude=True) class ScrollArea(QtWidgets.QScrollArea): def __init__(self, parent, main_window): super().__init__() diff --git a/SettingsPage.py b/SettingsPage.py index 7b50e49..92d2b29 100644 --- a/SettingsPage.py +++ b/SettingsPage.py @@ -1,3 +1,5 @@ +import logging + from Parents import Button from ScrollArea import ScrollArea diff --git a/SkinDropDown.py b/SkinDropDown.py index c7aad48..0c712b2 100644 --- a/SkinDropDown.py +++ b/SkinDropDown.py @@ -6,6 +6,7 @@ from PyQt5 import QtCore from PyQt5.QtGui import QPalette from PyQt5.QtWidgets import QComboBox, QAbstractItemView, QGraphicsBlurEffect +from autologging import traced, logged from abspath import abspath from config_data import current_config @@ -24,6 +25,8 @@ def read_properties_file(file_path): return dict(cp.items('dummy_section')) +@logged(logging.getLogger(__name__)) +@traced("changesize", "blur_me", exclude=True) class SkinDropDown(QComboBox): def __init__(self, parent): super(SkinDropDown, self).__init__(parent) diff --git a/main.py b/main.py index 4c69cf2..d3ec79f 100644 --- a/main.py +++ b/main.py @@ -22,6 +22,7 @@ from Options import Options import logging import traceback +from autologging import traced, logged, TRACE # from PyQt5.QtWinExtras import QWinTaskbarButton @@ -29,14 +30,16 @@ import time completed_settings = {} +excl = ("resizeEvent", "keyPressEvent", "mousePressEvent", "delete_popup", "blur_function", "applicationStateChanged", "on_focusChanged") +@logged(logging.getLogger(__name__)) +@traced(*excl, exclude=True) class Window(QMainWindow): def __init__(self, App, execpath): super().__init__() - logging.basicConfig(level=logging.DEBUG, filename=Log.apppath, filemode="w", format="%(asctime)s:%(levelname)s:%(name)s:%(funcName)s:%(message)s") - logging.basicConfig(level=logging.INFO) + logging.basicConfig(level=TRACE, filename=Log.apppath, filemode="w", format="%(asctime)s:%(levelname)s:%(name)s:%(funcName)s:%(message)s") logging.info("Current settings is updated to: {}".format(current_settings)) logging.info("Current config is updated to: {}".format(current_config)) @@ -68,7 +71,7 @@ def __init__(self, App, execpath): self.options = Options(self) self.updatebutton = UpdateButton(self) - self.setFixedSize(window_width, window_height) + # self.setFixedSize(window_width, window_height) logging.info("Loaded Buttons") @@ -223,19 +226,6 @@ def find_latestReplay(self): current_config[".osr path"] = replay logging.info("Updated replay path to: {}".format(replay)) - def set_settings(self, dict1): - if os.path.isfile(settingspath): - with open(settingspath) as f: - data = json.load(f) - counter = 0 - for x in data: - if counter > 10: - break - data[x] = float(dict1[counter]) - counter += 1 - logging.info("Settings data loaded: ", data) - return data - def find_latestMap(self, replay): if current_config["osu! path"] != "": beatmap_path = find_beatmap_(os.path.join(current_config["osu! path"], "Replays", replay), current_config["osu! path"]) @@ -249,7 +239,6 @@ def check_replay_map(self): self.find_latestReplay() - def kill(proc_pid): process = psutil.Process(proc_pid) for proc in process.children(recursive=True): @@ -300,6 +289,7 @@ def main(execpath="."): sys.exit(ret) + if __name__ == "__main__": main()