Skip to content

Commit

Permalink
修复自动英雄选择卡片的 enable 逻辑错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Sep 15, 2023
1 parent 828e8b8 commit 6ec5253
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/view/auxiliary_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def setEnabled(self, a0: bool) -> None:

if not cfg.get(cfg.enableAutoSelectChampion):
self.autoSelectChampionCard.lineEdit.setEnabled(a0)
if a0:
self.autoSelectChampionCard.validate()

self.removeTokensCard.pushButton.setEnabled(a0)

Expand Down Expand Up @@ -680,13 +682,15 @@ def validate(self):
if text not in self.champions and self.switchButton.checked:
self.setValue("", False)

self.__onLineEditTextChanged()
self.__onLineEditTextChanged(text)

def __onLineEditTextChanged(self):
enable = self.lineEdit.text() in self.champions
def __onLineEditTextChanged(self, text):
enable = text in self.champions

self.switchButton.setEnabled(enable)

self.setValue(text, self.switchButton.isChecked())

def __onCheckedChanged(self, isChecked: bool):
self.lineEdit.setEnabled(not isChecked)
self.setValue(self.lineEdit.text(), isChecked)
Expand Down

0 comments on commit 6ec5253

Please sign in to comment.