Skip to content

Commit

Permalink
将搜索界面筛选组件改为垂直布局,并本地化
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Sep 18, 2023
1 parent 16b504a commit b4968cb
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 158 deletions.
1 change: 1 addition & 0 deletions Seraphine.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ SOURCES += app/view/main_window.py \
app/view/game_info_interface.py \
app/components/game_infobar_widget.py \
app/components/loose_switch_setting_card.py \
app/components/mode_filter_widget.py \

TRANSLATIONS += app/resource/i18n/Seraphine.zh_CN.ts
27 changes: 16 additions & 11 deletions app/components/mode_filter_widget.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QApplication
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout
from qfluentwidgets import CheckBox
from typing import List, Tuple

Expand All @@ -14,14 +14,14 @@ def __init__(self, parent=None):

self.selected: List[int] = []

self.hBoxLayout = QHBoxLayout(self)
self.hBoxLayout = QVBoxLayout(self)
self.hBoxLayout.setAlignment(Qt.AlignCenter)

# TODO 本地化
self.rankSoloCheckBox = CheckBox(self.tr("Rank solo"))
self.rankFlexCheckBox = CheckBox(self.tr("Rank Flex"))
self.rankSoloCheckBox = CheckBox(self.tr("Ranked solo"))
self.rankFlexCheckBox = CheckBox(self.tr("Ranked Flex"))
self.normalCheckBox = CheckBox(self.tr("Normal"))
self.aramCheckBox = CheckBox(self.tr("Aram"))
self.aramCheckBox = CheckBox(self.tr("A.R.A.M."))

self.checkBoxDict = {
self.rankSoloCheckBox: 420, # 单双排
Expand All @@ -31,12 +31,16 @@ def __init__(self, parent=None):
}

for checkBox, num in self.checkBoxDict.items():
checkBox.stateChanged.connect(lambda state, num=num: self.updateSelected(state, num))
checkBox.stateChanged.connect(
lambda state, num=num: self.updateSelected(state, num))

self.hBoxLayout.addWidget(self.rankSoloCheckBox, alignment=Qt.AlignCenter)
self.hBoxLayout.addWidget(self.rankFlexCheckBox, alignment=Qt.AlignCenter)
self.hBoxLayout.addWidget(self.normalCheckBox, alignment=Qt.AlignCenter)
self.hBoxLayout.addWidget(self.aramCheckBox, alignment=Qt.AlignCenter)
self.hBoxLayout.addWidget(
self.rankSoloCheckBox, alignment=Qt.AlignLeft)
self.hBoxLayout.addWidget(
self.rankFlexCheckBox, alignment=Qt.AlignLeft)
self.hBoxLayout.addWidget(
self.normalCheckBox, alignment=Qt.AlignLeft)
self.hBoxLayout.addWidget(self.aramCheckBox, alignment=Qt.AlignLeft)

self.setLayout(self.hBoxLayout)

Expand All @@ -57,7 +61,8 @@ def setCallback(self, func):
@return:
"""
for checkBox, num in self.checkBoxDict.items():
checkBox.stateChanged.connect(lambda state, num=num, func=func: self.updateSelected(state, num, func))
checkBox.stateChanged.connect(
lambda state, num=num, func=func: self.updateSelected(state, num, func))

def getFilterMode(self) -> Tuple[int]:
"""
Expand Down
33 changes: 0 additions & 33 deletions app/components/title_bar.py

This file was deleted.

Binary file modified app/resource/i18n/Seraphine.zh_CN.qm
Binary file not shown.
Loading

0 comments on commit b4968cb

Please sign in to comment.