修复MyDay添加不写入本地文件的bug

This commit is contained in:
liyp 2022-04-29 17:48:18 +08:00
parent 3959ec1904
commit 2495d81e1c
4 changed files with 16 additions and 9 deletions

View file

@ -183,9 +183,6 @@ class MainWidget(QWidget):
self.system_listWidget.setItemWidget(item, item.widget)
def change(self):
print(1)
# 点击创建新的分组
def create_item(self, new_list='新建列表', uid=None):
# 创建一个没有名字的item

View file

@ -26,7 +26,7 @@ class Important(QWidget):
background = get_myday_important_conf('Important', 'Theme')
if not background:
background = '0'
background = '8'
self.setStyleSheet('#important{background-image:url("../images/' + background + '.jpg");border-radius: 10px;}')

View file

@ -6,7 +6,7 @@ from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt, pyqtSignal
from utils.BasicUtils import load_myday_important, remove_todo_list, change_value, change_myday_important_conf
from utils.CreateToDo import CreateToDo
from utils.CreateToDo import CreateToDo, create_myday_important
from view.AddToDoLabel import AddToDoAction
from view.MyDayHeadLabel import HeadLabel
from view.ToDoItem import ToDoItem
@ -170,10 +170,20 @@ class MyDay(QWidget):
if name:
self.add_todo.todo_name.emit(name)
# print('添加的新ToDo' + name)
todo_item = ToDoItem(name)
create_todo = CreateToDo('Todo', name)
change_value(create_todo, 'isMyDay', True)
todo_item = ToDoItem(name, create_todo)
self.todo_list.addItem(todo_item)
self.todo_list.setItemWidget(todo_item, todo_item.widget)
self.add_todo.line_edit.clear()
self.update_signal.emit()
# self.add_todo.todo_name.emit(name)
# # print('添加的新ToDo' + name)
# todo_item = ToDoItem(name)
# change_value(create_todo, 'isImportant', True)
# self.todo_list.addItem(todo_item)
# self.todo_list.setItemWidget(todo_item, todo_item.widget)
# self.add_todo.line_edit.clear()
def todo_list_context(self, position):
# 设置右键菜单
@ -252,8 +262,8 @@ class MyDay(QWidget):
self.dialog.exec_()
def change_name(self, item_name):
print(item_name)
my_day_list = load_myday_important('Important')
# print(item_name)
my_day_list = load_myday_important('MyDay')
change_value(my_day_list[self.todo_list.currentRow()][1], 'title', item_name)
# 重命名发送信号
self.refresh_action()

View file

@ -24,7 +24,7 @@ class ToDoList(QWidget):
super(ToDoList, self).__init__()
self.setObjectName('todolist')
self.setAttribute(Qt.WA_StyledBackground)
# todo : 使用网格布局设置背景图
self.setStyleSheet('#todolist{background-image:url("../images/10.jpg");border-radius: 10px;}')
# 布局样式:最外面一个大的垂直布局,里面的最上面标题是一个水平布局,水平布局显示的是一个垂直布局和一个右边的选项,用来更换背景