text
stringlengths
1
93.6k
SiGlobal.siui.colors["TOGGLE_BUTTON_ON_BG"])
# svg 图标
self.settings_button.attachment().load(SiGlobal.siui.icons["fi-rr-menu-burger"])
self.add_todo_button.attachment().load(SiGlobal.siui.icons["fi-rr-apps-add"])
self.icon.load('<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" '
'data-name="Layer 1" viewBox="0 0 24 24" width="512" height="512"><path d="M0,8v-1C0,4.243,'
'2.243,2,5,2h1V1c0-.552,.447-1,1-1s1,.448,1,1v1h8V1c0-.552,.447-1,1-1s1,.448,1,1v1h1c2.757,0,'
'5,2.243,5,5v1H0Zm24,2v9c0,2.757-2.243,5-5,5H5c-2.757,0-5-2.243-5-5V10H24Zm-6.168,'
'3.152c-.384-.397-1.016-.409-1.414-.026l-4.754,4.582c-.376,.376-1.007,'
'.404-1.439-.026l-2.278-2.117c-.403-.375-1.035-.354-1.413,.052-.376,.404-.353,1.037,.052,'
'1.413l2.252,2.092c.566,.567,1.32,.879,2.121,.879s1.556-.312,2.108-.866l4.74-4.568c.397-.383,'
'.409-1.017,.025-1.414Z" fill="{}" /></svg>'.format(SiGlobal.siui.colors["SVG_A"]).encode())
self.background_label.setStyleSheet("""background-color: {}; border: 1px solid {}""".format(
SiGlobal.siui.colors["BACKGROUND_COLOR"], SiGlobal.siui.colors["BORDER_COLOR"]))
self.unfold_button.setStyleSheet("color: {}".format(SiGlobal.siui.colors["TEXT_B"]))
class TODOListPanel(ThemedOptionCardPlane):
todoAmountChanged = pyqtSignal(int)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setTitle("全部待办")
self.setUseSignals(True)
self.no_todo_label = SiLabel(self)
self.no_todo_label.setAttribute(Qt.WA_TransparentForMouseEvents)
self.no_todo_label.setAutoAdjustSize(True)
self.no_todo_label.setText("当前没有待办哦")
self.no_todo_label.setAlignment(Qt.AlignCenter)
self.no_todo_label.hide()
self.body().setUseMoveTo(False)
self.body().setShrinking(True)
self.body().setAdjustWidgetsSize(True)
self.footer().setFixedHeight(64)
self.footer().setSpacing(8)
self.footer().setAlignCenter(True)
self.complete_all_button = SiSimpleButton(self)
self.complete_all_button.resize(32, 32)
self.complete_all_button.setHint("全部完成")
self.complete_all_button.clicked.connect(self._onCompleteAllButtonClicked)
self.footer().addWidget(self.complete_all_button, "right")
# 全局方法
SiGlobal.todo_list.addTODO = self.addTODO
def updateTODOAmount(self):
todo_amount = len(self.body().widgets_top)
self.todoAmountChanged.emit(todo_amount)
if todo_amount == 0:
self.no_todo_label.show()
else:
self.no_todo_label.hide()
def reloadStyleSheet(self):
self.setThemeColor(SiGlobal.siui.colors["PANEL_THEME"])
super().reloadStyleSheet()
self.no_todo_label.setStyleSheet("color: {}".format(SiGlobal.siui.colors["TEXT_E"]))
self.complete_all_button.attachment().load(SiGlobal.siui.icons["fi-rr-list-check"])
def _onCompleteAllButtonClicked(self):
for obj in self.body().widgets_top:
if isinstance(obj, SingleTODOOption):
obj.check_box.setChecked(True)
def addTODO(self, text):
new_todo = SingleTODOOption(self)
self.body().addWidget(new_todo)
new_todo.setText(text)
new_todo.show()
new_todo.adjustSize()
SiGlobal.todo_list.todo_list_unfold_button.setChecked(True)
self.adjustSize()
self.updateTODOAmount()
def adjustSize(self):
self.body().adjustSize()
super().adjustSize()
def leaveEvent(self, event):
super().leaveEvent(event)
for index, obj in enumerate(SiGlobal.todo_list.delete_pile):
self.body().removeWidget(obj)
obj.close()
SiGlobal.todo_list.delete_pile = []
if SiGlobal.todo_list.todo_list_unfold_button.isChecked() is True: