Skip to content

Commit b0c02db

Browse files
committed
Fix two PowerBinderCommands that crashed because self.Page went missing
1 parent 54e1fbd commit b0c02db

2 files changed

Lines changed: 13 additions & 24 deletions

File tree

UI/PowerBinderCommand/AttributeMonitorCmd.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class AttributeMonitorCmd(PowerBinderCommand):
99
Menu = "Graphics / UI"
1010

1111
def BuildUI(self, dialog) -> wx.BoxSizer:
12-
self.Page = dialog.Page
1312
self.AttributeTable = {
1413
'Base' : {
1514
'Current Hit Points' : 'NT H',

UI/PowerBinderCommand/BuffDisplayCmd.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import wx
2-
from UI.ControlGroup import ControlGroup
32
import wx.adv
43
from UI.PowerBinderCommand import PowerBinderCommand
54

@@ -9,8 +8,7 @@ class BuffDisplayCmd(PowerBinderCommand):
98
Menu = "Graphics / UI"
109

1110
def BuildUI(self, dialog) -> wx.BoxSizer:
12-
self.Groups = {}
13-
self.Page = dialog.Page
11+
self.Ctrls = {}
1412
self.buffDisplayMap = {
1513
'Status Window' : {
1614
'Hide Auto' : 1,
@@ -40,34 +38,27 @@ def BuildUI(self, dialog) -> wx.BoxSizer:
4038
'Stop Sending Buffs' : 4194304,
4139
},
4240
}
43-
groupSizer = wx.BoxSizer(wx.HORIZONTAL)
41+
masterSizer = wx.BoxSizer(wx.HORIZONTAL)
4442

4543
for group, controls in self.buffDisplayMap.items():
46-
self.Groups[group] = ControlGroup(dialog, self.Page, label = group)
47-
groupid = self.Groups[group].GetStaticBox().GetId()
48-
for cb, data in controls.items():
49-
self.Groups[group].AddControl(
50-
ctlType = 'checkbox',
51-
ctlName = f"{groupid}_{group}_{cb}",
52-
label = cb,
53-
data = data,
54-
)
44+
groupSizer = wx.StaticBoxSizer(wx.VERTICAL, dialog, group)
45+
staticBox = groupSizer.GetStaticBox()
46+
for cb in controls:
47+
self.Ctrls[f"{group}_{cb}"] = wx.CheckBox(staticBox, label = cb)
48+
groupSizer.Add(self.Ctrls[f"{group}_{cb}"], 0, wx.ALL, 3)
5549

56-
groupSizer.Add(self.Groups[group], 1, wx.ALL, 10)
50+
masterSizer.Add(groupSizer, 1, wx.EXPAND|wx.ALL, 5)
5751

58-
return groupSizer
52+
return masterSizer
5953

6054
def CalculateValue(self) -> int:
61-
page = self.Profile.CustomBinds
62-
6355
total = 0
6456

6557
for group, controls in self.buffDisplayMap.items():
66-
groupid = self.Groups[group].GetStaticBox().GetId()
6758
for cb in controls:
68-
checkbox = page.Ctrls[f"{groupid}_{group}_{cb}"]
59+
checkbox = self.Ctrls[f"{group}_{cb}"]
6960
if checkbox.IsChecked():
70-
total = total + checkbox.Data
61+
total = total + self.buffDisplayMap[group][cb]
7162
return total
7263

7364
def MakeBindString(self) -> str:
@@ -82,7 +73,6 @@ def Deserialize(self, init) -> None:
8273
value = value or 0 # in case we had for some reason 'None' stashed in the init values
8374

8475
for group, controls in self.buffDisplayMap.items():
85-
groupid = self.Groups[group].GetStaticBox().GetId()
8676
for cb in controls:
87-
checkbox = self.Page.Ctrls[f"{groupid}_{group}_{cb}"]
88-
checkbox.SetValue( checkbox.Data & value )
77+
checkbox = self.Ctrls[f"{group}_{cb}"]
78+
checkbox.SetValue( self.buffDisplayMap[group][cb] & value )

0 commit comments

Comments
 (0)