-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_pathfinding_visualizer.py
More file actions
59 lines (38 loc) · 1.51 KB
/
run_pathfinding_visualizer.py
File metadata and controls
59 lines (38 loc) · 1.51 KB
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
59
"""Run pathfinding visualizer. Must be '__main__'."""
# Handles how much C++ the the program should use
from src.pathfinding.cpp_or_py import use_algorithms_h
if use_algorithms_h:
from src.pathfinding.cpp.modules import AlgoState
else:
from src.pathfinding.py.algorithms import AlgoState
from src.pathfinding.py.graph import GraphState, VisText
from src.pathfinding.py.logic import LogicState, run_pathfinding
import sys
import os
def overide_where():
"""Fixes error when compiling program to exe."""
def _override_where():
"""Helper function"""
# change this to match the location of cacert.pem
return os.path.abspath(os.path.join("lib", "cacert.pem"))
if hasattr(sys, "frozen"):
import certifi.core
os.environ["REQUESTS_CA_BUNDLE"] = _override_where()
certifi.core.where = _override_where
# delay importing until after where() has been replaced
import requests.utils
import requests.adapters
# replace these variables in case these modules were
# imported before we replaced certifi.core.where
requests.utils.DEFAULT_CA_BUNDLE_PATH = _override_where()
requests.adapters.DEFAULT_CA_BUNDLE_PATH = _override_where()
def main() -> None:
"""Main function"""
overide_where()
gph = GraphState(rects_to_update=[])
algo = AlgoState()
lgc = LogicState(ordinal_square_clicked_last_tick=[])
txt = VisText()
run_pathfinding(gph, algo, lgc, txt)
if __name__ == "__main__":
main()