This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload.py
80 lines (60 loc) · 2.29 KB
/
load.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
try:
from plug import FlagsSupercruise, FlagsHardpointsDeployed
except ImportError:
from edmc_data import FlagsSupercruise, FlagsHardpointsDeployed
import edmc_clog_utils as l_utils
import edmc_clog_net as l_net
import edmc_clog_gui as l_gui
_flag_status = 0
_hardpoints_deployed = False
_gui = None
def plugin_start3(plugin_dir):
print(f"Starting {l_utils.APP_VER} v{l_utils.APP_VER}")
return l_utils.APP_NAME
def plugin_app(parent):
global _gui
_gui = l_gui.Gui(parent)
return _gui
def dashboard_entry(cmdr, is_beta, entry):
global _gui
global _hardpoints_deployed
global _flag_status
if not is_beta:
flags = entry['Flags']
_is_in_SC = flags & FlagsSupercruise
# not in SC
if not _is_in_SC:
_hardpoints_deployed = flags & FlagsHardpointsDeployed
if _hardpoints_deployed:
if _flag_status + 64 == flags:
_gui.set_status_inactive()
_flag_status = flags
else:
if _flag_status - 64 == flags:
_gui.set_status_active()
_flag_status = flags
def journal_entry(cmdr, is_beta, system, station, entry, state):
global _gui
global _hardpoints_deployed
if not is_beta:
if l_utils.is_mode() and not _hardpoints_deployed:
if l_utils.is_scanned(entry):
coded_pilot_name = entry['PilotName'].split(':')
if l_utils.is_cmdr(coded_pilot_name):
search_name = coded_pilot_name[1][6:-1]
pilot_name_localised = entry['PilotName_Localised']
_gui.set_status_checking()
res = l_net.call_service(search_name)
if type(res) is str:
_gui.result = l_utils.IS_ERR
_gui.err_msg = res
elif type(res) is dict:
_gui.cmdr = pilot_name_localised
t = l_utils.is_clog(res)
_gui.result = t[0]
_gui.report_url = t[1]
else:
_gui.result = l_utils.IS_UNK_ERR
_gui.after(500, _gui.set_response_label)
def plugin_stop():
print(f"Stopping {l_utils.APP_NAME}")