-
Notifications
You must be signed in to change notification settings - Fork 40
/
main.py
56 lines (47 loc) · 1.64 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from error_handling import WikifiedError
try:
import signal
import sys
from loguru import logger
from PyQt6.QtWidgets import QApplication
from clashroyalebuildabot.actions import ArchersAction
from clashroyalebuildabot.actions import BabyDragonAction
from clashroyalebuildabot.actions import CannonAction
from clashroyalebuildabot.actions import GoblinBarrelAction
from clashroyalebuildabot.actions import KnightAction
from clashroyalebuildabot.actions import MinipekkaAction
from clashroyalebuildabot.actions import MusketeerAction
from clashroyalebuildabot.actions import WitchAction
from clashroyalebuildabot.gui.main_window import MainWindow
from clashroyalebuildabot.gui.utils import load_config
from clashroyalebuildabot.utils.git_utils import check_and_pull_updates
from clashroyalebuildabot.utils.logger import setup_logger
except Exception as e:
raise WikifiedError("001", "Missing imports.") from e
def main():
check_and_pull_updates()
actions = [
ArchersAction,
GoblinBarrelAction,
BabyDragonAction,
CannonAction,
KnightAction,
MinipekkaAction,
MusketeerAction,
WitchAction,
]
try:
config = load_config()
app = QApplication([])
window = MainWindow(config, actions)
setup_logger(window, config)
window.show()
sys.exit(app.exec())
except WikifiedError:
raise
except Exception as e:
logger.error(f"An error occurred in main loop: {e}")
sys.exit(1)
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal.SIG_DFL)
main()