Skip to content

Commit 7f9ba9c

Browse files
committed
Add Next / Prev Tray buttons to Gameplay tab
1 parent f099aa2 commit 7f9ba9c

File tree

3 files changed

+38
-33
lines changed

3 files changed

+38
-33
lines changed

Help/PowerTrayButtons.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<body>
44
<h2>Power Tray Buttons</h2>
55
<p>The Power Tray Buttons section offers the ability to rebind the keys that trigger the buttons in the main powers trays in the game's UI. The defaults are set to the same as the "Modern" profile from Homecoming Issue 27, Page 7.</p>
6-
<p>If you don't want to change these keybinds from the defaults, it's perfectly reasonable to leave the "Server Tray" and "Tray #" rows unchecked and use the game's existing keybinds. This functionality is just for people who are interested in this degree of control over their keybinds.</p>
6+
<p>If you don't want to change these keybinds from the defaults, it's perfectly reasonable to leave the Main Tray, Secondary Tray, Tertiary Tray, and Server Tray checkboxes unchecked and use the game's existing keybinds. This functionality is just for people who are interested in this degree of control over their keybinds.</p>
77
</body>
88
</html>

Page/CustomBinds.py

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def OnDeleteButton(self, evt):
189189
self.PaneSizer.Remove(sizer)
190190
self.Panes.remove(delButton.BindPane)
191191
delButton.BindPane.Destroy()
192+
self.Profile.CheckAllConflicts()
192193
self.Layout()
193194
evt.Skip()
194195

Page/Gameplay.py

+36-32
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,17 @@ def __init__(self, parent):
4545
'Tray3Enabled' : False,
4646
'Tray4Enabled' : False,
4747
}
48-
for tray in (3,2,1):
49-
mod = ['', '', 'ALT+', 'SHIFT+'][tray]
48+
for tray in (4,3,2,1):
49+
mod = ['', '', 'ALT+', 'SHIFT+', 'CTRL+'][tray]
50+
name = ['', 'Main', 'Secondary', 'Tertiary', 'Server'][tray]
51+
self.Init[f"Tray{tray}Next"] = ''
52+
self.Init[f"Tray{tray}Prev"] = ''
53+
UI.Labels[f"Tray{tray}Next"] = "Next Tray"
54+
UI.Labels[f"Tray{tray}Prev"] = "Previous Tray"
5055
for button in (1,2,3,4,5,6,7,8,9,0):
5156
ctlname = f'Tray{tray}Button{button}'
5257
self.Init[ctlname] = f"{mod}{button}"
53-
UI.Labels[ctlname] = f"Tray {tray}, Button {button}"
54-
55-
for button in (1,2,3,4,5,6,7,8,9,0):
56-
ctlname = f'Tray4Button{button}'
57-
self.Init[ctlname] = f"CTRL+{button}"
58-
UI.Labels[ctlname] = f"Server Tray, Button {button}"
59-
58+
UI.Labels[ctlname] = f"{name} Tray, Button {button}"
6059

6160
def BuildPage(self):
6261

@@ -71,29 +70,11 @@ def BuildPage(self):
7170
self.FillTrayButtons[b].Bind(wx.EVT_BUTTON, self.OnFillTray)
7271
self.FillTrayButtons[b].SetToolTip("Fill the buttons with the numbers 1 - 0. Hold a modifier key while clicking to use that modifier key in the binds.")
7372

74-
trayGridSizer = wx.FlexGridSizer(12,4,0)
75-
# server tray at the top
76-
checkbox = wx.CheckBox(staticbox, wx.ID_ANY, label = f"Server Tray")
77-
checkbox.SetValue(self.Init.get(f'Tray4Enabled', False))
78-
checkbox.Bind(wx.EVT_CHECKBOX, self.SynchronizeUI)
79-
self.Ctrls[f'Tray4Enabled'] = checkbox
80-
trayGridSizer.Add(checkbox, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
73+
trayGridSizer = wx.FlexGridSizer(14,4,0)
8174

82-
for button in (1,2,3,4,5,6,7,8,9,0):
83-
ctlname = f'Tray4Button{button}'
84-
traybutton = bcKeyButton(staticbox, wx.ID_ANY, init = {
85-
'CtlName' : ctlname,
86-
'Key' : self.Init[ctlname],
87-
'AlwaysShorten' : True,
88-
})
89-
self.Ctrls[ctlname] = traybutton
90-
91-
trayGridSizer.Add(traybutton, 1, wx.EXPAND)
92-
trayGridSizer.Add(self.FillTrayButtons[4], 1, wx.EXPAND|wx.LEFT, 10)
93-
94-
# Then the three main trays
95-
for tray in (3,2,1):
96-
checkbox = wx.CheckBox(staticbox, wx.ID_ANY, label = f"Tray {tray}")
75+
for tray in (4,3,2,1):
76+
label = ['', 'Main', 'Secondary', 'Tertiary', 'Server'][tray]
77+
checkbox = wx.CheckBox(staticbox, wx.ID_ANY, label = f"{label} Tray")
9778
checkbox.SetValue(self.Init.get(f'Tray{tray}Enabled', False))
9879
checkbox.Bind(wx.EVT_CHECKBOX, self.SynchronizeUI)
9980
self.Ctrls[f'Tray{tray}Enabled'] = checkbox
@@ -109,7 +90,17 @@ def BuildPage(self):
10990
self.Ctrls[ctlname] = traybutton
11091

11192
trayGridSizer.Add(traybutton, 1, wx.EXPAND)
112-
trayGridSizer.Add(self.FillTrayButtons[tray], 1, wx.EXPAND|wx.LEFT, 10)
93+
trayGridSizer.Add(self.FillTrayButtons[tray], 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 10)
94+
if tray == 4:
95+
trayGridSizer.Add(wx.StaticText(staticbox, wx.ID_ANY, "Prev Tray"), 1, wx.ALIGN_CENTER|wx.LEFT, 6)
96+
trayGridSizer.Add(wx.StaticText(staticbox, wx.ID_ANY, "Next Tray"), 1, wx.ALIGN_CENTER|wx.LEFT, 6)
97+
else:
98+
prevbutton = bcKeyButton(staticbox, wx.ID_ANY, init = { 'CtlName' : f"Tray{tray}Prev",})
99+
self.Ctrls[f"Tray{tray}Prev"] = prevbutton
100+
nextbutton = bcKeyButton(staticbox, wx.ID_ANY, init = { 'CtlName' : f"Tray{tray}Next",})
101+
self.Ctrls[f"Tray{tray}Next"] = nextbutton
102+
trayGridSizer.Add(prevbutton, 1, wx.ALIGN_CENTER)
103+
trayGridSizer.Add(nextbutton, 1, wx.ALIGN_CENTER)
113104

114105
traySizer.Add(trayGridSizer, 0, wx.ALL, 10)
115106
traygridbutton = HelpButton(staticbox, 'PowerTrayButtons.html')
@@ -216,6 +207,9 @@ def SynchronizeUI(self, evt = None):
216207
self.FillTrayButtons[tray].Enable(self.GetState(f"Tray{tray}Enabled"))
217208
for button in (1,2,3,4,5,6,7,8,9,0):
218209
self.Ctrls[f"Tray{tray}Button{button}"].Enable(self.GetState(f'Tray{tray}Enabled'))
210+
if tray != 4:
211+
self.Ctrls[f"Tray{tray}Prev"].Enable(self.GetState(f"Tray{tray}Enabled"))
212+
self.Ctrls[f"Tray{tray}Next"].Enable(self.GetState(f"Tray{tray}Enabled"))
219213
self.Profile.CheckAllConflicts()
220214
if evt: evt.Skip()
221215

@@ -260,6 +254,16 @@ def PopulateBindFiles(self):
260254
if self.GetState('Tray4Enabled'):
261255
ResetFile.SetBind(self.Ctrls[f"Tray4Button{button}"].MakeFileKeyBind(f"powexec_serverslot {slotbutton}"))
262256

257+
if self.GetState('Tray1Enabled'):
258+
ResetFile.SetBind(self.Ctrls[f"Tray1Prev"].MakeFileKeyBind("prev_tray"))
259+
ResetFile.SetBind(self.Ctrls[f"Tray1Next"].MakeFileKeyBind("next_tray"))
260+
if self.GetState('Tray2Enabled'):
261+
ResetFile.SetBind(self.Ctrls[f"Tray2Prev"].MakeFileKeyBind("prev_tray_alt"))
262+
ResetFile.SetBind(self.Ctrls[f"Tray2Next"].MakeFileKeyBind("next_tray_alt"))
263+
if self.GetState('Tray3Enabled'):
264+
ResetFile.SetBind(self.Ctrls[f"Tray3Prev"].MakeFileKeyBind("prev_tray_alt2"))
265+
ResetFile.SetBind(self.Ctrls[f"Tray3Next"].MakeFileKeyBind("next_tray_alt2"))
266+
263267
### Team / Pet Select
264268
if self.GetState('TPSEnable'):
265269
if (self.GetState('TPSSelMode') != "Pets Only"

0 commit comments

Comments
 (0)