From f75be59746ac4b1fc68a69f69d32695e7aaad520 Mon Sep 17 00:00:00 2001 From: liyp Date: Sun, 1 May 2022 22:10:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E5=8C=85=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=88=B7=E6=96=B0=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=BF=AE=E5=A4=8D=E6=A0=87=E7=AD=BE=E4=B8=8D=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9B=B4=E6=96=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/main.py | 2 +- utils/BasicUtils.py | 5 ----- utils/CreateConfigure.py | 3 --- view/MyDayView.py | 7 ------- view/ToDoListView.py | 22 ++++++++++++++++++---- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/main/main.py b/main/main.py index 8931d1f..47cbdaf 100644 --- a/main/main.py +++ b/main/main.py @@ -343,6 +343,6 @@ if __name__ == "__main__": style_sheet = QSSLoader.read_qss_file(os.getcwd() + '/../resource/current.qss') main.setStyleSheet(style_sheet) - app.setWindowIcon(QIcon(os.path.abspath('../') + '/images/todo.svg')) + app.setWindowIcon(QIcon(os.path.abspath('../') + '/images/todo_info.svg')) main.show() sys.exit(app.exec_()) diff --git a/utils/BasicUtils.py b/utils/BasicUtils.py index 0c9a2f4..521fe0f 100644 --- a/utils/BasicUtils.py +++ b/utils/BasicUtils.py @@ -83,22 +83,17 @@ def get_myday_important_conf(get_type, key): 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'], json_file['updatedAt'], json_file['icon']]) - # print(return_todo_list) return_todo_list.sort(key=get_third) return return_todo_list diff --git a/utils/CreateConfigure.py b/utils/CreateConfigure.py index afe0e6c..306efb4 100644 --- a/utils/CreateConfigure.py +++ b/utils/CreateConfigure.py @@ -62,9 +62,6 @@ class CreateConfigure: config['Account']['webdav_password'] = webdav_password config['Account']['type'] = login_type - # config['System'] = {'exitStatus': 'None'} - # print(config['System']['exitStatus']) - with open(config_file, 'w') as f: config.write(f) print('create complete!', config_file) diff --git a/view/MyDayView.py b/view/MyDayView.py index b576889..5be9d95 100644 --- a/view/MyDayView.py +++ b/view/MyDayView.py @@ -177,13 +177,6 @@ class MyDay(QWidget): 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): # 设置右键菜单 diff --git a/view/ToDoListView.py b/view/ToDoListView.py index 0796cd4..3592d78 100644 --- a/view/ToDoListView.py +++ b/view/ToDoListView.py @@ -21,6 +21,7 @@ class ToDoList(QWidget): # 测试更新的信号发送 update_signal = pyqtSignal() + # todo : 实现刷新功能,重新加载list_name ,把list_name设置为全局变量 def __init__(self, list_name, uid): super(ToDoList, self).__init__() self.setObjectName('todolist') @@ -56,15 +57,15 @@ class ToDoList(QWidget): layout.addWidget(head_widget, 2, Qt.AlignTop) layout.addWidget(self.todo_list, 6, Qt.AlignCenter | Qt.AlignTop) - head_label = QLabel(list_name) - head_label.setObjectName('head_label') + self.head_label = QLabel(list_name) + self.head_label.setObjectName('head_label') font = QFont() font.setPointSize(32) - head_label.setFont(font) + self.head_label.setFont(font) layout.addStretch(1) - head_layout.addWidget(head_label, 8) + head_layout.addWidget(self.head_label, 8) layout.addStretch(1) layout.addWidget(self.add_todo, 2, Qt.AlignHCenter) @@ -90,6 +91,14 @@ class ToDoList(QWidget): self.menu_image.setMenu(self.button_menu) + refresh_label = QAction(self) + refresh_label.setText('刷新') + refresh_label.setIcon(QIcon('../images/refresh.svg')) + self.button_menu.addAction(refresh_label) + self.button_menu.addSeparator() + refresh_label.triggered.connect(lambda: self.reload_name(uid)) + self.button_menu.addAction(refresh_label) + theme_label = QAction(self) theme_label.setText('主题') theme_label.setDisabled(True) @@ -157,6 +166,11 @@ class ToDoList(QWidget): self.todo_list.addItem(self.todo_item) self.todo_list.setItemWidget(self.todo_item, self.todo_item.widget) + def reload_name(self, uid): + label_name = load_value(uid, 'title') + self.head_label.setText(label_name) + pass + def refresh_action(self): # self.my_day_list[] self.todo_list.clear()