Skip to content

Commit

Permalink
Two little bugfixes:
Browse files Browse the repository at this point in the history
-- Double-click was not working correctly in the Key Select dialog, and
therefore wasn't making it into binds correctly.  Fixed.

(Use KeySelectDialog self.Keymap correctly in OnMouseEvent.)

-- After loading an existing profile (except during initial startup), or
creating a new one, keybind conflict checking would silently stop
working.

(Always use wx.App.Get().Main.Profile, instead of wx.App.Get().Profile,
if getting the profile that way.)
  • Loading branch information
emersonrp committed Jan 7, 2025
1 parent 05bc32c commit 6d5b47c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions BindControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,12 +600,11 @@ def OnInit(self):

self.Init()
self.Main = Main(None)
self.Profile = self.Main.Profile

# TODO bootstrapping problem, can't do this inside Profile's "__init__" because
# Profile needs to be defined/initialized deep inside its innards.
if self.Profile:
self.Profile.CheckAllConflicts()
if self.Main.Profile:
self.Main.Profile.CheckAllConflicts()

self.Main.Show()

Expand Down
8 changes: 4 additions & 4 deletions UI/KeySelectDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def buildBind(self):
self.Layout()

def CheckConflicts(self):
Profile = wx.App.Get().Profile
Profile = wx.App.Get().Main.Profile
if Profile:
conflicts = self.Button.CheckConflicts(self.Binding)
if conflicts:
Expand Down Expand Up @@ -508,7 +508,7 @@ def __init__(self, parent, id, init = {}):
self.Bind(EVT_KEY_CHANGED, self.onKeyChanged)

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

def ClearButton(self, _):
self.SetLabel("")
Expand Down Expand Up @@ -537,7 +537,7 @@ def SetLabel(self, label):
self.SetLabelMarkup(label)

def CheckConflicts(self, newbinding = None):
Profile = wx.App.Get().Profile
Profile = wx.App.Get().Main.Profile
if Profile:
conflicts = Profile.CheckConflict(newbinding or self.Key, self.CtlName)
if conflicts:
Expand All @@ -551,7 +551,7 @@ def CheckConflicts(self, newbinding = None):

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

existingKey = button.Key

Expand Down
6 changes: 3 additions & 3 deletions UI/PowerBinderDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def PowerBinderEventHandler(self, _):
bindString = dlg.MakeBindString()
if bindString != self.tgtTxtCtrl.GetValue():
self.tgtTxtCtrl.SetValue(bindString)
wx.App.Get().Profile.SetModified()
wx.App.Get().Main.Profile.SetModified()

def LoadFromData(self, data):
self.PowerBinderDialog().LoadFromData(data)
Expand Down Expand Up @@ -513,7 +513,7 @@ def BuildUI(self, dialog):
return groupSizer

def CalculateValue(self):
page = wx.App.Get().Profile.CustomBinds
page = wx.App.Get().Main.Profile.CustomBinds

total = 0

Expand Down Expand Up @@ -1437,7 +1437,7 @@ def BuildUI(self, dialog):
sizer.Add(self.CommandChoice, 0, wx.ALL, 5)

self.FilePath = wx.TextCtrl(dialog, -1, size = (400, -1),
value = str(wx.App.Get().Profile.GameBindsDir() / 'windows.txt'))
value = str(wx.App.Get().Main.Profile.GameBindsDir() / 'windows.txt'))
sizer.Add(self.FilePath, 0, wx.ALL, 5)

return sizer
Expand Down
2 changes: 1 addition & 1 deletion UI/SimpleBindPane.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def PopulateBindFiles(self):
if not self.checkIfWellFormed():
wx.MessageBox(f"Custom Bind \"{self.Title}\" is not complete or has errors. Not written to bindfile.")
return
resetfile = wx.App.Get().Profile.ResetFile()
resetfile = wx.App.Get().Main.Profile.ResetFile()
bk = self.Ctrls[self.MakeCtlName('BindKey')]
bc = self.Ctrls[self.MakeCtlName('BindContents')]

Expand Down

0 comments on commit 6d5b47c

Please sign in to comment.