diff --git a/images/40.jpg b/images/10.jpg similarity index 100% rename from images/40.jpg rename to images/10.jpg diff --git a/images/50.jpg b/images/11.jpg similarity index 100% rename from images/50.jpg rename to images/11.jpg diff --git a/images/edit.svg b/images/edit.svg new file mode 100644 index 0000000..190c9ee --- /dev/null +++ b/images/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/main/main.py b/main/main.py index 6ee8c1f..d39b061 100644 --- a/main/main.py +++ b/main/main.py @@ -4,6 +4,8 @@ from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt import configparser + +from utils.BasicUtils import get_todo_list from utils.CreateToDo import CreateToDo from utils.QSSLoader import QSSLoader from view.ImportantView import Important @@ -71,6 +73,11 @@ class MainWidget(QWidget): self.system_listWidget.addItem(self.important_item) self.system_listWidget.setItemWidget(self.important_item, self.important_item.widget) + load_list = get_todo_list() + # print(load_list) + if load_list: + for load in load_list: + self.load_item(load[0], load[1]) # self.system_listWidget.addScrollBarWidget(False) # 测试添加下面的 @@ -101,22 +108,36 @@ class MainWidget(QWidget): del_action.triggered.connect(self.DeleteItem) pop_menu.exec_(self.custom.mapToGlobal(position)) - # 创建新的分组 - def CreateNewItem(self): - # 创建一个没有名字的item - new_list = '新建列表' - create_todo = CreateToDo('ToDoList', new_list) - item = SelfListWidgetItem(new_list) + def load_item(self, list_name, uid): + item = SelfListWidgetItem(list_name, 0, uid) item.setTextAlignment(Qt.AlignCenter) # 使得item是可以编辑的. item.setFlags(item.flags() | Qt.ItemIsEditable) self.system_listWidget.addItem(item) - todo_list = ToDoList(new_list) - self.stackedWidget.addWidget(todo_list) + todo_list = ToDoList(list_name, uid) # 创建后就可以编辑item,用户自己起名字. # self.system_listWidget.editItem(item) + self.stackedWidget.addWidget(todo_list) + self.system_listWidget.setItemWidget(item, item.widget) + # 创建新的分组 + def CreateNewItem(self, new_list='新建列表', uid=None): + # 创建一个没有名字的item + # new_list = '新建列表' + if not uid: + create_todo_uid = CreateToDo('ToDoList', new_list) + item = SelfListWidgetItem(new_list, 0, create_todo_uid) + item.setTextAlignment(Qt.AlignCenter) + # 使得item是可以编辑的. + item.setFlags(item.flags() | Qt.ItemIsEditable) + self.system_listWidget.addItem(item) + todo_list = ToDoList(new_list, create_todo_uid) + self.stackedWidget.addWidget(todo_list) + # 创建后就可以编辑item,用户自己起名字. + # self.system_listWidget.editItem(item) + self.system_listWidget.setItemWidget(item, item.widget) + # 删除分组 def DeleteItem(self): self.custom.takeItem(self.custom.currentRow()) diff --git a/utils/ReadConfig.py b/test/ReadConfig.py similarity index 85% rename from utils/ReadConfig.py rename to test/ReadConfig.py index 1dbcda4..0582cb0 100644 --- a/utils/ReadConfig.py +++ b/test/ReadConfig.py @@ -18,7 +18,7 @@ home_dir = config['info']['home_dir'] print(users_dir) print(name) print(home_dir) -with open('test.ini', 'w') as config_file: +with open('../utils/test.ini', 'w') as config_file: config.write(config_file) config.add_section('Accounts') @@ -27,5 +27,5 @@ config['Accounts']['name'] = 'admin' config['Accounts']['type'] = 'NextCloud' config['Accounts']['username'] = 'admin' -with open('test.ini', 'w') as config_file: +with open('../utils/test.ini', 'w') as config_file: config.write(config_file) \ No newline at end of file diff --git a/test/SyncTest.py b/test/SyncTest.py index 0f05319..8251ecd 100644 --- a/test/SyncTest.py +++ b/test/SyncTest.py @@ -1,12 +1,12 @@ import os -work_path = os.path.expandvars('$HOME') + '/.config/PyQtToDoList' +work_path = os.path.expandvars('$HOME') + '/.config/PyQtToDoList/ToDoList' # sync_path = os.walk(work_path) # print(sync_path) for root, dirs, files in os.walk(work_path, topdown=False): for name in files: print(os.path.join(root, name).split('/')[-1]) - for name in dirs: - # print(os.path.join(root, name)) - print(os.path.join(root, name).split('/')[-1]) + # for name in dirs: + # # print(os.path.join(root, name)) + # print(os.path.join(root, name).split('/')[-1]) diff --git a/test/TestGetToDoList.py b/test/TestGetToDoList.py new file mode 100644 index 0000000..4b1497f --- /dev/null +++ b/test/TestGetToDoList.py @@ -0,0 +1,57 @@ +import os +import json +import configparser + +from utils import BasicUtils + + +def get_todo_list(): + config_path = BasicUtils.return_work_dir() + todo_path = config_path + 'ToDoList/' + # print(todo_path) + # config = configparser.ConfigParser() + return_todo_list = [] + + for root, dirs, files in os.walk(todo_path, topdown=False): + for name in files: + # print(os.path.join(root, name)) + with open(os.path.join(root, name), 'r') as f: + # print(f.read()) + json_file = json.load(f) + # try: + if json_file['itemType'] == 'ToDoList': + # print(json_file['title'], json_file['uid'], '列表') + return_todo_list.append([json_file['title'], json_file['uid']]) + + # print(return_todo_list) + return return_todo_list + + +def get_to_do(todoListUid): + config_path = BasicUtils.return_work_dir() + todo_path = config_path + 'ToDoList/' + # print(todo_path) + # config = configparser.ConfigParser() + return_todo = [] + + for root, dirs, files in os.walk(todo_path, topdown=False): + for name in files: + # print(os.path.join(root, name)) + with open(os.path.join(root, name), 'r') as f: + # print(f.read()) + json_file = json.load(f) + + # print(json_file['itemType']) + if json_file['itemType'] == 'Todo' and json_file['todoListUid'] == todoListUid: + # print(json_file['title'], json_file['uid'], '待办事项') + return_todo.append([json_file['title'], json_file['uid']]) + return return_todo + + # load_list = get_todo_list() + + +# print(load_list) +# if load_list: +# for load in load_list: +# print(load[0], load[1]) +print(get_to_do('3f1e033f-2051-4c04-b7f6-afd2eb1f54f4')) diff --git a/utils/BasicUtils.py b/utils/BasicUtils.py new file mode 100644 index 0000000..345f9aa --- /dev/null +++ b/utils/BasicUtils.py @@ -0,0 +1,148 @@ +import json +import os +import platform + + +def return_work_dir(): + if platform.system() == 'Linux': + work_path = os.path.expandvars('$HOME') + '/.config/' + if not os.path.exists(work_path): + os.mkdir(work_path) + return os.path.expandvars('$HOME') + '/.config/PyQtToDoList/' + elif platform.system() == 'Windows': + work_path = os.getcwd() + '/config/' + if not os.path.exists(work_path): + os.mkdir(work_path) + return work_path + + +import configparser + + +def read_init_file(): + config = configparser.ConfigParser() + try: + config.read(return_work_dir() + 'PyQtToDoList.ini') + account = config['Account'] + if account: + return [account['webdav_hostname'], account['webdav_login'], account['webdav_password'], account['type']] + except KeyError as e: + return False + + +def get_todo_list(): + config_path = return_work_dir() + todo_path = config_path + 'ToDoList/' + # print(todo_path) + return_todo_list = [] + + for root, dirs, files in os.walk(todo_path, topdown=False): + for name in files: + # print(os.path.join(root, name)) + with open(os.path.join(root, name), 'r') as f: + # print(f.read()) + json_file = json.load(f) + # try: + if json_file['itemType'] == 'ToDoList': + # print(json_file['title'], json_file['uid'], '列表') + return_todo_list.append([json_file['title'], json_file['uid']]) + + # print(return_todo_list) + return return_todo_list + + +def get_todo(todoListUid): + config_path = return_work_dir() + todo_path = config_path + 'ToDoList/' + # print(todo_path) + # config = configparser.ConfigParser() + return_todo = [] + + for root, dirs, files in os.walk(todo_path, topdown=False): + for name in files: + # print(os.path.join(root, name)) + with open(os.path.join(root, name), 'r') as f: + # print(f.read()) + json_file = json.load(f) + + # print(json_file['itemType']) + if json_file['itemType'] == 'Todo' and json_file['todoListUid'] == todoListUid: + # print(json_file['title'], json_file['uid'], '待办事项') + return_todo.append([json_file['title'], json_file['uid']]) + return return_todo + + # load_list = get_todo_list() + + +def load_myday_important(item_type): + config_path = return_work_dir() + todo_path = config_path + 'ToDoList/' + # print(todo_path) + # config = configparser.ConfigParser() + return_todo = [] + + for root, dirs, files in os.walk(todo_path, topdown=False): + for name in files: + # print(os.path.join(root, name)) + with open(os.path.join(root, name), 'r') as f: + # print(f.read()) + json_file = json.load(f) + + # print(json_file['itemType']) + if item_type == 'MyDay': + if json_file['itemType'] == 'Todo' and json_file['done'] and json_file['isMyDay']: + # print(json_file['title'], json_file['uid'], '待办事项') + return_todo.append([json_file['title'], json_file['uid']]) + return return_todo + elif item_type == 'Important': + if json_file['itemType'] == 'Todo' and json_file['done'] and json_file['isImportant']: + # print(json_file['title'], json_file['uid'], '待办事项') + return_todo.append([json_file['title'], json_file['uid']]) + return return_todo + + def get_todo(todoListUid): + config_path = return_work_dir() + todo_path = config_path + 'ToDoList/' + # print(todo_path) + # config = configparser.ConfigParser() + return_todo = [] + + for root, dirs, files in os.walk(todo_path, topdown=False): + for name in files: + # print(os.path.join(root, name)) + with open(os.path.join(root, name), 'r') as f: + # print(f.read()) + json_file = json.load(f) + + # print(json_file['itemType']) + if json_file['itemType'] == 'Todo' and json_file['todoListUid'] == todoListUid: + # print(json_file['title'], json_file['uid'], '待办事项') + return_todo.append([json_file['title'], json_file['uid']]) + return return_todo + + +# 用于修改某个键值对,比如更新修改时期,设置为重要,我的一天等 +def change_value(uid, key, value): + config_path = return_work_dir() + todo_path = config_path + 'ToDoList/' + + # for root, dirs, files in os.walk(todo_path, topdown=False): + # for name in files: + # print(os.path.join(root, name)) + json_file = {} + + with open(todo_path + '{' + uid + '}.otl', 'r') as f: + # print(f.read()) + json_file = json.load(f) + print(json_file) + json_file[key] = value + # print(json_file[key]) + with open(todo_path + '{' + uid + '}.otl', 'w') as f: + json.dump(json_file, f, indent=4, ensure_ascii=False) + + +# +# print(read_init_file()) +# webdav_hostname = read_init_file() +# print(webdav_hostname[2]) +change_value('4f52f02b-4450-405a-9fd1-2005a03006e0', 'isMyDay', False) diff --git a/utils/CreateConfigure.py b/utils/CreateConfigure.py index a3adc27..69d7e24 100644 --- a/utils/CreateConfigure.py +++ b/utils/CreateConfigure.py @@ -1,7 +1,7 @@ import configparser import platform import os -from utils import ReturnWorkDir +from utils import BasicUtils # todo : 用来创建软件的配置信息 diff --git a/utils/CreateToDo.py b/utils/CreateToDo.py index 5506f58..a7011a6 100644 --- a/utils/CreateToDo.py +++ b/utils/CreateToDo.py @@ -3,7 +3,7 @@ import uuid import json from datetime import datetime -from utils import ReturnWorkDir +from utils import BasicUtils """ todo : 暂时创建单个文件存储该列表下所有待办事项,文件命名为 {uuid}.otl @@ -13,78 +13,79 @@ from utils import ReturnWorkDir (可以尝试在待办事项添加 isMyDay属性和isImportant属性) """ +# class CreateToDo: +""" +:param item_type: 创建的类型,为ToDo和ToDoList +:param name: 要创建的ToDoList名字 +:param todo_list_uid : 待办事项列表的uid,可选 +""" -class CreateToDo: - """ - :param item_type: 创建的类型,为ToDo和ToDoList - :param name: 要创建的ToDoList名字 - :param todo_list_uid : 待办事项列表的uid,可选 - """ - def __init__(self, item_type, name, todo_list_uid=None): - uid = str(uuid.uuid4()) - config_path = ReturnWorkDir.return_work_dir() - todo_list_path = config_path + '{' + uid + '}' - # if not os.path.exists(todo_list_path): - # os.mkdir(todo_list_path) - default_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') - print(default_time) - if item_type == 'ToDoList': - try: - """ - createdAt : 创建时间 - dueTo : 完成时间 - itemType : 类型 - notes : 笔记 - title : 标题 - updatedAt : 最后一次更新时间 - """ - os.mkdir(todo_list_path) - out_config = { - "createdAt": default_time, - "dueTo": '', - "itemType": item_type, - "notes": "", - "title": name, - "uid": uid, - "updatedAt": default_time - } - library = { - "title": name, - "uid": uid - } - with open(todo_list_path + '/library.json', 'w') as f: - f.write(json.dumps(library)) - except IOError as e: - print(e) - elif item_type == 'ToDo': - try: - # done : 完成状态 - # todoListUid : 父列表id - out_config = { - "createdAt": default_time, - "done": False, - "dueTo": '', - "itemType": "Todo", - "notes": "", - "title": name, - "todoListUid": todo_list_uid, - "uid": uid, - "updatedAt": default_time - } - with open(todo_list_path + '/' + uid + '.otl', 'w') as f: - f.write(json.dumps(out_config)) - except IOError as e: - print(e) +def CreateToDo(item_type, name, todo_list_uid=None): + uid = str(uuid.uuid4()) + config_path = BasicUtils.return_work_dir() + todo_list_path = config_path + 'ToDoList/' + if not os.path.exists(todo_list_path): + os.mkdir(todo_list_path) + default_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + print(uid) + if item_type == 'ToDoList': + # print(item_type) + try: + """ + createdAt : 创建时间 + dueTo : 完成时间 + itemType : 类型 + notes : 笔记 + title : 标题 + updatedAt : 最后一次更新时间 + """ + # os.mkdir(todo_list_path) + out_config = { + "createdAt": default_time, + "dueTo": '', + "itemType": item_type, + "notes": "", + "title": name, + "uid": uid, + "updatedAt": default_time + } + # library = { + # "title": name, + # "uid": uid + # } + with open(todo_list_path + '{' + uid + '}.otl', 'w') as f: + f.write(json.dumps(out_config, indent=4, ensure_ascii=False)) + # json.dump(out_config, f) + return uid + except IOError as e: + print(e) + return False + elif item_type == 'ToDo': + try: + # done : 完成状态 + # todoListUid : 父列表id + out_config = { + "createdAt": default_time, + "done": False, + "dueTo": '', + "itemType": "Todo", + "notes": "", + "isMyDay": False, + "isImportant": False, + "title": name, + "todoListUid": todo_list_uid, + "uid": uid, + "theme": '0', + "updatedAt": default_time + } + with open(todo_list_path + '{' + uid + '}.otl', 'w') as f: + f.write(json.dumps(out_config, indent=4, ensure_ascii=False)) + return uid - # def get_config_path(self): - # - # # print(platform.system()) - # if platform.system() == 'Linux': - # # print(os.environ['HOME'] + '/.config/PyQtToDoList') - # # print(os.path.expandvars('~')) - # # print(os.path.expandvars('$HOME') + '.config/PyQtToDoList') - # return os.path.expandvars('$HOME') + '/.config/PyQtToDoList' - # elif platform.system() == 'Windows': - # print(os.getcwd() + 'config') - # return os.getcwd() + 'config' + except IOError as e: + print(e) + return False + +# +# CreateToDo('ToDo', 'test1', '3f1e033f-2051-4c04-b7f6-afd2eb1f54f4') diff --git a/utils/ReturnWorkDir.py b/utils/ReturnWorkDir.py deleted file mode 100644 index 385a827..0000000 --- a/utils/ReturnWorkDir.py +++ /dev/null @@ -1,36 +0,0 @@ -import os -import platform - - -def return_work_dir(): - if platform.system() == 'Linux': - work_path = os.path.expandvars('$HOME') + '/.config/' - if not os.path.exists(work_path): - os.mkdir(work_path) - return os.path.expandvars('$HOME') + '/.config/PyQtToDoList/' - elif platform.system() == 'Windows': - work_path = os.getcwd() + '/config/' - if not os.path.exists(work_path): - os.mkdir(work_path) - return work_path - - -import configparser - - -def read_init_file(): - config = configparser.ConfigParser() - try: - config.read(return_work_dir() + 'PyQtToDoList.ini') - account = config['Account'] - if account: - return [account['webdav_hostname'], account['webdav_login'], account['webdav_password'], account['type']] - except KeyError as e: - return False - - -# -# -# print(read_init_file()) -# webdav_hostname = read_init_file() -# print(webdav_hostname[2]) diff --git a/utils/TabWidgetTest.py b/utils/TabWidgetTest.py deleted file mode 100644 index 1a7ab9c..0000000 --- a/utils/TabWidgetTest.py +++ /dev/null @@ -1,68 +0,0 @@ -import sys -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * - -class TabDemo(QTabWidget): - def __init__(self,parent=None): - super(TabDemo, self).__init__(parent) - - #创建3个选项卡小控件窗口 - self.tab1=QWidget() - self.tab2=QWidget() - self.tab3=QWidget() - - #将三个选项卡添加到顶层窗口中 - self.addTab(self.tab1, "Tab 1") - self.addTab(self.tab2, "Tab 2") - self.addTab(self.tab3, "Tab 3") - - #每个选项卡自定义的内容 - self.tab1UI() - self.tab2UI() - self.tab3UI() - - def tab1UI(self): - #表单布局 - layout=QFormLayout() - #添加姓名,地址的单行文本输入框 - layout.addRow('姓名',QLineEdit()) - layout.addRow('地址',QLineEdit()) - #设置选项卡的小标题与布局方式 - self.setTabText(0,'联系方式') - self.tab1.setLayout(layout) - - def tab2UI(self): - #zhu表单布局,次水平布局 - layout=QFormLayout() - sex=QHBoxLayout() - - #水平布局添加单选按钮 - sex.addWidget(QRadioButton('男')) - sex.addWidget(QRadioButton('女')) - - #表单布局添加控件 - layout.addRow(QLabel('性别'),sex) - layout.addRow('生日',QLineEdit()) - - #设置标题与布局 - self.setTabText(1,'个人详细信息') - self.tab2.setLayout(layout) - - def tab3UI(self): - #水平布局 - layout=QHBoxLayout() - - #添加控件到布局中 - layout.addWidget(QLabel('科目')) - layout.addWidget(QCheckBox('物理')) - layout.addWidget(QCheckBox('高数')) - - #设置小标题与布局方式 - self.setTabText(2,'教育程度') - self.tab3.setLayout(layout) -if __name__ == '__main__': - app=QApplication(sys.argv) - demo=TabDemo() - demo.show() - sys.exit(app.exec_()) \ No newline at end of file diff --git a/view/ImportantView.py b/view/ImportantView.py index 19148f5..e4a8eaf 100644 --- a/view/ImportantView.py +++ b/view/ImportantView.py @@ -23,16 +23,14 @@ class Important(QWidget): head_layout = QHBoxLayout() head_widget = QWidget(self) - # head_widget.setStyleSheet('background-color:gray') - # todo : - # head_widget.setMinimumHeight(175) self.todo_list = QListWidget() self.todo_list.setObjectName('todo_list') - # todo : 重写QLabel,实现添加功能 # 添加ToDo的标签 self.add_todo = AddToDoAction() + self.add_todo.line_edit.returnPressed.connect(lambda: self.line_edit_add(self.add_todo.line_edit.text())) + self.add_todo.setAlignment(Qt.AlignCenter) # self.add_todo.setPlaceholderText('添加任务') @@ -144,8 +142,8 @@ class Important(QWidget): count = str(count) # self.menu_label = ChangeTheme() self.setStyleSheet('#important{background-image:url("../images/' + count + '.jpg");' - 'background-position: center; border-radius: 10px;' - '}') + 'background-position: center; border-radius: 10px;' + '}') print('选中:' + count) def line_edit_add(self, name): diff --git a/view/LoginWidget.py b/view/LoginWidget.py index 77961b8..fa2f560 100644 --- a/view/LoginWidget.py +++ b/view/LoginWidget.py @@ -2,7 +2,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import * from PyQt5.QtWidgets import * import configparser -from utils.ReturnWorkDir import * +from utils.BasicUtils import * # diff --git a/view/LoginWidget1.py b/view/LoginWidget1.py index fc257f3..e2b45ba 100644 --- a/view/LoginWidget1.py +++ b/view/LoginWidget1.py @@ -2,7 +2,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import * from PyQt5.QtWidgets import * import configparser -from utils.ReturnWorkDir import * +from utils.BasicUtils import * class LoginWindow(QWidget): diff --git a/view/SelfListWidgetItem.py b/view/SelfListWidgetItem.py index eb82a10..d3acc5b 100644 --- a/view/SelfListWidgetItem.py +++ b/view/SelfListWidgetItem.py @@ -8,11 +8,12 @@ import os class SelfListWidgetItem(QListWidgetItem): """ :param item_name: 列表名称 + :param uid: 当前列表的uuid :param todo_count: 设置剩余代办数量,默认为零 :param show_icon: 设置显示的图标路径,默认为空 """ - def __init__(self, item_name, todo_count=0, show_icon=None): + def __init__(self, item_name, todo_count=0, uid=None, show_icon=None): super(SelfListWidgetItem, self).__init__() layout = QHBoxLayout() # print(show_icon) diff --git a/view/ToDoItem.py b/view/ToDoItem.py index e3650a4..07c1f60 100644 --- a/view/ToDoItem.py +++ b/view/ToDoItem.py @@ -9,9 +9,10 @@ class ToDoItem(QListWidgetItem): :param todo_name : 新建的待办事项名称 """ + # todo : 参数添加uid,方便设置重要和我的一天 def __init__(self, todo_name): super(ToDoItem, self).__init__() - print('添加的新ToDo:' + todo_name) + print(' 添加的新ToDo:' + todo_name) self.widget = QWidget() layout = QHBoxLayout() diff --git a/view/ToDoListView.py b/view/ToDoListView.py index 210f2af..7e9bf2b 100644 --- a/view/ToDoListView.py +++ b/view/ToDoListView.py @@ -1,9 +1,9 @@ import os -import sys from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt +from utils.BasicUtils import get_todo from view.AddToDoLabel import AddToDoAction from view.ToDoItem import ToDoItem @@ -18,7 +18,7 @@ class Menu(QMenu): class ToDoList(QWidget): - def __init__(self, list_name): + def __init__(self, list_name, uid): super(ToDoList, self).__init__() self.setObjectName('todolist') self.setAttribute(Qt.WA_StyledBackground) @@ -32,15 +32,16 @@ class ToDoList(QWidget): head_layout = QHBoxLayout() head_widget = QWidget(self) - # todo : + # head_widget.setMinimumHeight(175) self.todo_list = QListWidget() self.todo_list.setObjectName('todo_list') - # todo : 重写QLabel,实现添加功能 # 添加ToDo的标签 self.add_todo = AddToDoAction() + self.add_todo.line_edit.returnPressed.connect(lambda: self.line_edit_add(self.add_todo.line_edit.text())) + self.add_todo.setAlignment(Qt.AlignCenter) # self.add_todo.setPlaceholderText('添加任务') @@ -139,6 +140,12 @@ class ToDoList(QWidget): label_action5.setText('渐变5') label_action5.triggered.connect(lambda: self.menu_action(5)) self.button_menu.addAction(label_action5) + + # 读取配置文件添加Todo + load_todo = get_todo(uid) + if load_todo: + for load in load_todo: + self.load_todo(load[0], load[1]) # button_menu # for i in range(11): # label_action = QAction(self) @@ -146,17 +153,24 @@ class ToDoList(QWidget): # label_action.setText(str(i)) # label_action.triggered.connect(lambda: self.menu_action(str(i))) # button_menu.addAction(label_action) - # todo : 下面的方法实现点击更换主题的功能 def menu_action(self, count): # 点击按钮 count = str(count) # self.menu_label = ChangeTheme() self.setStyleSheet('#todolist{background-image:url("../images/' + count + '.jpg");' - 'background-position: center; border-radius: 10px;' - '}') + 'background-position: center; border-radius: 10px;' + '}') # print('选中:' + count) + def load_todo(self, name, uid): + todo_item = ToDoItem(name) + + self.todo_list.addItem(todo_item) + self.todo_list.setItemWidget(todo_item, todo_item.widget) + + pass + def line_edit_add(self, name): self.add_todo.todo_name.emit(name) # print('添加的新ToDo:' + name) diff --git a/view/UserLabel.py b/view/UserLabel.py index 4c9f3e9..1f974be 100644 --- a/view/UserLabel.py +++ b/view/UserLabel.py @@ -5,7 +5,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import * from PyQt5.QtWidgets import * import configparser -from utils.ReturnWorkDir import * +from utils.BasicUtils import * from view.LoginWidget import LoginWidget