Skip to content

Commit

Permalink
给自动选择英雄添加恢复默认按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Jun 5, 2024
1 parent 87f3b78 commit 28e86a0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
Binary file modified app/resource/i18n/Seraphine.zh_CN.qm
Binary file not shown.
9 changes: 7 additions & 2 deletions app/resource/i18n/Seraphine.zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<translation type="obsolete">已启用,自动选择:</translation>
</message>
<message>
<location filename="../../view/auxiliary_interface.py" line="1554"/>
<location filename="../../view/auxiliary_interface.py" line="1559"/>
<source>Disabled</source>
<translation>未启用</translation>
</message>
Expand Down Expand Up @@ -221,10 +221,15 @@
<translation>辅助:</translation>
</message>
<message>
<location filename="../../view/auxiliary_interface.py" line="1554"/>
<location filename="../../view/auxiliary_interface.py" line="1559"/>
<source>Enabled</source>
<translation>已启用</translation>
</message>
<message>
<location filename="../../view/auxiliary_interface.py" line="1389"/>
<source>Reset</source>
<translation>恢复默认</translation>
</message>
</context>
<context>
<name>AuxiliaryInterface</name>
Expand Down
29 changes: 19 additions & 10 deletions app/view/auxiliary_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ def __init__(self, title, content=None,
self.tr("Completed before timeout:"))
self.enableTimeoutSwtichButton = SwitchButton(
indicatorPos=IndicatorPosition.RIGHT)
self.resetButton = PushButton(self.tr("Reset"))

self.__initWidget()
self.__initLayout()
Expand Down Expand Up @@ -1417,6 +1418,9 @@ def __initWidget(self):
self.enableTimeoutSwtichButton.setEnabled(checked)
self.enableTimeoutSwtichButton.setChecked(timeoutChecked)

self.resetButton.clicked.connect(self.__onResetButtonClicked)
self.resetButton.setMinimumWidth(100)

self.__updateStatusLabel()

def __initLayout(self):
Expand All @@ -1427,21 +1431,20 @@ def __initLayout(self):
self.defaultCfgLayout.setSizeConstraint(QHBoxLayout.SetMinimumSize)

self.defaultCfgLayout.addWidget(
self.defaultHintLabel, 0, 0, alignment=Qt.AlignLeft)
self.defaultHintLabel, 0, 0, Qt.AlignLeft)

self.defaultCfgLayout.addWidget(
self.defaultLabel, 1, 0, alignment=Qt.AlignLeft)
self.defaultLabel, 1, 0, Qt.AlignLeft)
self.defaultCfgLayout.addWidget(
self.defaultChampions, 1, 1, alignment=Qt.AlignHCenter)
self.defaultChampions, 1, 1, Qt.AlignHCenter)
self.defaultCfgLayout.addWidget(
self.defaultSelectButton, 1, 2, alignment=Qt.AlignRight)
self.defaultSelectButton, 1, 2, Qt.AlignRight)

self.rankCfgLayout.setVerticalSpacing(19)
self.rankCfgLayout.setContentsMargins(48, 18, 44, 18)
self.rankCfgLayout.setSizeConstraint(QHBoxLayout.SetMinimumSize)

self.rankCfgLayout.addWidget(
self.rankLabel, 0, 0, alignment=Qt.AlignLeft)
self.rankCfgLayout.addWidget(self.rankLabel, 0, 0, Qt.AlignLeft)

for i, ty in enumerate(['top', 'jug', 'mid', 'bot', 'sup']):
label = getattr(self, f"{ty}Label")
Expand All @@ -1457,13 +1460,15 @@ def __initLayout(self):
self.buttonsLayout.setSizeConstraint(QHBoxLayout.SetMinimumSize)

self.buttonsLayout.addWidget(
self.enableLabel, 0, 0, alignment=Qt.AlignLeft)
self.enableLabel, 0, 0, Qt.AlignLeft)
self.buttonsLayout.addWidget(
self.enableSwitchButton, 0, 1, Qt.AlignRight)
self.buttonsLayout.addWidget(
self.enableSwitchButton, 0, 1, alignment=Qt.AlignRight)
self.enableTimeoutCompleteLabel, 1, 0, Qt.AlignLeft)
self.buttonsLayout.addWidget(
self.enableTimeoutCompleteLabel, 1, 0, alignment=Qt.AlignLeft)
self.enableTimeoutSwtichButton, 1, 1, Qt.AlignRight)
self.buttonsLayout.addWidget(
self.enableTimeoutSwtichButton, 1, 1, alignment=Qt.AlignRight)
self.resetButton, 2, 1, Qt.AlignRight)

self.viewLayout.setSpacing(0)
self.viewLayout.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -1554,6 +1559,10 @@ def __updateStatusLabel(self):
text = self.tr("Enabled") if checked else self.tr("Disabled")
self.statusLabel.setText(text)

def __onResetButtonClicked(self):
for ty in ['default', 'top', 'jug', 'mid', 'bot', 'sup']:
self.__onChampionsChanged([], ty)


class ChampionsCard(QFrame):
def __init__(self, parent=None):
Expand Down

0 comments on commit 28e86a0

Please sign in to comment.