forked from gymnast86/sshd-rando
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsshdrando.py
58 lines (45 loc) · 1.55 KB
/
sshdrando.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
57
58
import multiprocessing as mp
import os
import sys
# Required to make the multiprocessing stuff not infinitely hang when running a build
# version. See https://pyinstaller.org/en/stable/common-issues-and-pitfalls.html?highlight=multipr#multi-processing
# for more info.
mp.freeze_support()
from filepathconstants import PLANDO_PATH, PRESETS_PATH, SSHD_EXTRACT_PATH
from util.arguments import get_program_args
import logging
args = get_program_args()
# Set specified log level
if args.debug and __name__ == "__main__":
print("Starting Debug Log")
logging.basicConfig(
filename="debug.log",
encoding="utf-8",
level=logging.DEBUG,
filemode="w",
)
# Ensure the necessary directories are created
if not SSHD_EXTRACT_PATH.exists():
SSHD_EXTRACT_PATH.mkdir()
if not PLANDO_PATH.exists():
PLANDO_PATH.mkdir()
if not PRESETS_PATH.exists():
PRESETS_PATH.mkdir()
# Imports here to prevent circular dependency
if not args.nogui:
from gui.main import start_gui
if __name__ == "__main__":
# Before starting the gui, setup exception handling
from PySide6.QtWidgets import QApplication
from gui.dialogs.error_dialog import error
# Adding these lines helps fix the GUI on Retina displays
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
app = QApplication(sys.argv + ["--style", "fusion"])
try:
start_gui(app)
except Exception as e:
error(e)
else:
from randomizer.randomize import randomize
if __name__ == "__main__":
randomize()