Skip to content

Commit

Permalink
Better error checking; still not perfect
Browse files Browse the repository at this point in the history
We're still keeping error / red-button state when there is no error.
Some new nuance is needed.  This stuff is hard.
  • Loading branch information
emersonrp committed Jun 7, 2024
1 parent 0549eb1 commit 01ccd77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
17 changes: 11 additions & 6 deletions UI/BufferBindPane.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from UI.PowerPicker import PowerPicker

from UI.CustomBindPaneParent import CustomBindPaneParent
from UI.KeySelectDialog import bcKeyButton
from UI.KeySelectDialog import bcKeyButton, EVT_KEY_CHANGED
from UI.PowerBinderDialog import PowerBinderButton

class BufferBindPane(CustomBindPaneParent):
Expand All @@ -15,11 +15,6 @@ def __init__(self, page, init = {}):

self.PassedInit = init

def BuildBindUI(self, page):
pane = self.GetPane()
pane.Page = page

# Doing this init here since we need Title to be set to get this right
self.Init = {
'BuffChat1' : '',
'BuffChat2' : '',
Expand All @@ -35,6 +30,16 @@ def BuildBindUI(self, page):
for i in (1,2,3,4,5,6):
self.Init[f'Pet{i}BuffKey'] = ''

def BuildBindUI(self, page):
pane = self.GetPane()
pane.Page = page

# Doing this UI here since we need Title to be set to get MakeCtlName right
for i in (1,2,3,4,5,6,7,8):
UI.Labels[self.MakeCtlName(f'Team{i}BuffKey')] = f'Team {i} Key'
for i in (1,2,3,4,5,6):
UI.Labels[self.MakeCtlName(f'Pet{i}BuffKey')] = f'Pet {i} Key'

self.Init.update(self.PassedInit)

# bind text controls
Expand Down
6 changes: 4 additions & 2 deletions UI/KeySelectDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,15 @@ def __init__(self, parent, id, init = {}):

self.Bind(wx.EVT_BUTTON, self.KeySelectEventHandler)
self.Bind(wx.EVT_RIGHT_DOWN, self.ClearButton)
self.Bind(EVT_KEY_CHANGED, self.onKeyChanged)

def onKeyChanged(self, _):
wx.App.Get().Profile.CheckAllConflicts()

def ClearButton(self, _):
self.SetLabel("")
self.Key = ""
wx.PostEvent(self, KeyChanged())
wx.App.Get().Profile.CheckAllConflicts()

def MakeFileKeyBind(self, contents):
return KeyBind(self.Key, self.CtlLabel, self.Page, contents)
Expand Down Expand Up @@ -466,7 +469,6 @@ def SetError(self, iserror = True, conflicts = None):
self.SetToolTip('')
self.HasError = False


def KeySelectEventHandler(self, evt):
button = evt.EventObject
Profile = wx.App.Get().Profile
Expand Down

0 comments on commit 01ccd77

Please sign in to comment.