-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPI_SetRunwayLightIntensity.py
More file actions
executable file
·48 lines (38 loc) · 1.53 KB
/
Copy pathPI_SetRunwayLightIntensity.py
File metadata and controls
executable file
·48 lines (38 loc) · 1.53 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
# Adds X-Plane Plugins menu entries to control runway lights
import xp
__VERSION__ = "1.0.2"
__NAME__ = "Set Runway Light Intensity"
__DESCRIPTION__ = "Wrapper around X-Plane runway light control commands"
class PythonInterface:
LEVEL = {
"hi": "Hight",
"med": "Medium",
"lo": "Low",
"off": "Off",
}
def __init__(self):
self.Name = __NAME__
self.Sig = "XPPython3.set_runway_lights."
self.Desc = __DESCRIPTION__ + " (Rel. " + __VERSION__ + ")"
self.Info = self.Name + f" {__VERSION__}"
self.menuIdx = 0
self.cmdRefs = {}
self.menuIdxs = {}
# Plugin Interface
def XPluginStart(self) -> tuple:
self.menuIdx = xp.createMenu(name="Set Runway Lights")
self.cmdRefs = {v: xp.findCommand(name="sim/operation/rwy_lights_" + k) for k, v in self.LEVEL.items()}
self.menuIdxs = {k: xp.appendMenuItemWithCommand(menuID=self.menuIdx, name=k, commandRef=v) for k, v in self.cmdRefs.items() if v is not None}
return self.Name, self.Sig, self.Desc
def XPluginStop(self) -> None:
for v in self.menuIdxs.values(): # sorted(self.menuIdxs.values(), reverse=True)
xp.removeMenuItem(menuID=self.menuIdx, index=v)
# xp.clearAllMenuItems(menuID=self.menuIdx)
xp.clearAllMenuItems()
return None
def XPluginEnable(self) -> int:
return 1
def XPluginDisable(self) -> None:
return None
def XPluginReceiveMessage(self, inFromWho, inMessage, inParam) -> None:
pass