-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Night-stars-1/dev
feat: 添加每日界面,未实装
- Loading branch information
Showing
48 changed files
with
426 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,4 +111,4 @@ logs/ | |
gui/ | ||
examples/ | ||
test.* | ||
config.json | ||
config* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
Author: Night-stars-1 nujj1042633805@gmail.com | ||
Date: 2024-04-07 23:54:39 | ||
LastEditTime: 2024-04-10 01:11:23 | ||
LastEditors: Night-stars-1 nujj1042633805@gmail.com | ||
""" | ||
from typing import Optional, Union | ||
|
||
from PyQt5.QtCore import Qt, pyqtSignal | ||
from PyQt5.QtGui import QIcon | ||
from qfluentwidgets import SettingCard, FluentIconBase, LineEdit, PasswordLineEdit, ConfigItem | ||
from qfluentwidgets import qconfig | ||
|
||
|
||
class LineEditCard(SettingCard): | ||
""" card with a push button """ | ||
|
||
text_change = pyqtSignal() | ||
|
||
def __init__(self, icon: Union[str, QIcon, FluentIconBase], holderText: str, title: str, default: str = "", content=None, parent=None, isPassword=False): | ||
""" | ||
Parameters | ||
---------- | ||
text: str | ||
the text of push button | ||
icon: str | QIcon | FluentIconBase | ||
the icon to be drawn | ||
title: str | ||
the title of card | ||
content: str | ||
the content of card | ||
parent: QWidget | ||
parent widget | ||
""" | ||
super().__init__(icon, title, content, parent) | ||
|
||
if isPassword: | ||
self.lineEdit = PasswordLineEdit(self) | ||
else: | ||
self.lineEdit = LineEdit(self) | ||
self.lineEdit.setText(default) | ||
self.lineEdit.setPlaceholderText(holderText) | ||
|
||
self.hBoxLayout.addWidget(self.lineEdit, 0, Qt.AlignRight) | ||
self.hBoxLayout.addSpacing(16) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
Author: Night-stars-1 nujj1042633805@gmail.com | ||
Date: 2024-04-07 23:54:39 | ||
LastEditTime: 2024-04-10 01:11:23 | ||
LastEditors: Night-stars-1 nujj1042633805@gmail.com | ||
""" | ||
from typing import Union | ||
|
||
from PyQt5.QtCore import Qt, pyqtSignal | ||
from PyQt5.QtGui import QIcon | ||
from qfluentwidgets import SettingCard, FluentIconBase, LineEdit, PasswordLineEdit, ConfigItem | ||
from qfluentwidgets import qconfig | ||
|
||
class LineEditSettingCard(SettingCard): | ||
""" Setting card with a push button """ | ||
|
||
text_change = pyqtSignal() | ||
|
||
def __init__(self, configItem: ConfigItem, holderText: str, icon: Union[str, QIcon, FluentIconBase], title: str, content=None, parent=None, isPassword=False): | ||
""" | ||
Parameters | ||
---------- | ||
text: str | ||
the text of push button | ||
icon: str | QIcon | FluentIconBase | ||
the icon to be drawn | ||
title: str | ||
the title of card | ||
content: str | ||
the content of card | ||
parent: QWidget | ||
parent widget | ||
""" | ||
super().__init__(icon, title, content, parent) | ||
self.configItem = configItem | ||
|
||
if isPassword: | ||
self.lineEdit = PasswordLineEdit(self) | ||
else: | ||
self.lineEdit = LineEdit(self) | ||
self.lineEdit.setText(qconfig.get(self.configItem)) | ||
self.lineEdit.setPlaceholderText(holderText) | ||
|
||
self.lineEdit.textChanged.connect(self.textChanged) | ||
self.hBoxLayout.addWidget(self.lineEdit, 0, Qt.AlignRight) | ||
self.hBoxLayout.addSpacing(16) | ||
#self.button.clicked.connect(self.clicked) | ||
|
||
def textChanged(self, text): | ||
qconfig.set(self.configItem, text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
""" | ||
Author: Night-stars-1 nujj1042633805@gmail.com | ||
Date: 2024-04-10 22:54:08 | ||
LastEditTime: 2024-04-10 22:56:06 | ||
LastEditors: Night-stars-1 nujj1042633805@gmail.com | ||
""" | ||
|
||
from loguru import logger | ||
from PyQt5.QtCore import Qt | ||
from PyQt5.QtWidgets import QLabel, QWidget | ||
from qfluentwidgets import CheckBox, ExpandLayout | ||
from qfluentwidgets import FluentIcon as FIF | ||
from qfluentwidgets import ScrollArea, SettingCardGroup | ||
|
||
from ..common.style_sheet import StyleSheet | ||
|
||
DAILYTASKS = [ | ||
"今日首次登录", | ||
"获得5场战斗胜利", | ||
"完成1个治安任务", | ||
"在休息区的黑月商店购买1次桦石", | ||
"成功抬价3次", | ||
"完成1个商会订单", | ||
"通过交易赚到20000铁盟币", | ||
"单笔交易利润达到30000 铁盟币", | ||
"行驶200KM", | ||
"行驶300KM", | ||
"成功砍价1次", | ||
"成功抬价1次", | ||
"通过交易赚到50000铁盟币", | ||
"通过交易赚到100000铁盟币", | ||
] | ||
|
||
|
||
class DailyTaskInterface(ScrollArea): | ||
"""每日任务 interface""" | ||
|
||
def __init__(self, parent=None): | ||
super().__init__(parent=parent) | ||
self.scrollWidget = QWidget(self) | ||
self.expandLayout = ExpandLayout(self.scrollWidget) | ||
|
||
# label | ||
self.settingLabel = QLabel("每日任务", self) | ||
|
||
self.__initWidget() | ||
|
||
def loadSamples(self): | ||
"""load samples""" | ||
# basic input samples | ||
self.configGroup = SettingCardGroup("施工中...", self.scrollWidget) | ||
|
||
for daily_task_name in DAILYTASKS: | ||
self.configGroup.addSettingCard( | ||
CheckBox( | ||
text=daily_task_name, | ||
parent=self.configGroup, | ||
) | ||
) | ||
|
||
def __initWidget(self): | ||
self.resize(1000, 800) | ||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) | ||
self.setViewportMargins(0, 80, 0, 20) | ||
self.setWidget(self.scrollWidget) | ||
self.setWidgetResizable(True) | ||
self.setObjectName("DailyTaskInterface") | ||
|
||
# initialize style sheet | ||
self.scrollWidget.setObjectName("scrollWidget") | ||
self.settingLabel.setObjectName("settingLabel") | ||
StyleSheet.SETTING_INTERFACE.apply(self) | ||
|
||
# initialize layout | ||
self.loadSamples() | ||
self.__initLayout() | ||
|
||
def __initLayout(self): | ||
self.settingLabel.move(36, 30) | ||
|
||
# add setting card group to layout | ||
self.expandLayout.setSpacing(28) | ||
self.expandLayout.setContentsMargins(36, 10, 36, 0) | ||
self.expandLayout.addWidget(self.configGroup) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.