From c6d49c4af44c72247a5bda9909c8c5e6036a3363 Mon Sep 17 00:00:00 2001 From: liyp Date: Sat, 16 Apr 2022 21:45:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=87=A0=E4=B8=AA=E5=B0=8Fbu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- images/icon/冰淇淋.svg | 1 + images/icon/冲浪.svg | 1 + images/icon/星宿.svg | 1 + images/icon/沙滩.svg | 1 + images/icon/行李箱.svg | 1 + images/icon/购物.svg | 1 + main/main.py | 12 +++++------- resource/current.qss | 13 ++++++++----- utils/nextcloud.py | 15 +++++++++++++++ view/AddListLabel.py | 10 +++++++--- view/MyDayHeadLabel.py | 2 +- view/MyDayView.py | 8 +++++--- 13 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 images/icon/冰淇淋.svg create mode 100644 images/icon/冲浪.svg create mode 100644 images/icon/星宿.svg create mode 100644 images/icon/沙滩.svg create mode 100644 images/icon/行李箱.svg create mode 100644 images/icon/购物.svg diff --git a/README.md b/README.md index f2d63e5..fca6418 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - [ ] 待办事项列表功能实现 - [ ] 待办事项列表右键功能实现 - [ ] 右边`QStackLayout`布局 -- [ ] “我的一天”和“重要”布局实现 +- [x] “我的一天”和“重要”布局实现 - [ ] 添加的通用布局实现 - [ ] 更换主题功能 - [ ] 登录`nextcloud`及其他`WebDav`和同步功能 diff --git a/images/icon/冰淇淋.svg b/images/icon/冰淇淋.svg new file mode 100644 index 0000000..945d700 --- /dev/null +++ b/images/icon/冰淇淋.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icon/冲浪.svg b/images/icon/冲浪.svg new file mode 100644 index 0000000..55e5d90 --- /dev/null +++ b/images/icon/冲浪.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icon/星宿.svg b/images/icon/星宿.svg new file mode 100644 index 0000000..c0cebc7 --- /dev/null +++ b/images/icon/星宿.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icon/沙滩.svg b/images/icon/沙滩.svg new file mode 100644 index 0000000..5418fbe --- /dev/null +++ b/images/icon/沙滩.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icon/行李箱.svg b/images/icon/行李箱.svg new file mode 100644 index 0000000..aaa048e --- /dev/null +++ b/images/icon/行李箱.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icon/购物.svg b/images/icon/购物.svg new file mode 100644 index 0000000..cbcbb66 --- /dev/null +++ b/images/icon/购物.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/main/main.py b/main/main.py index bc188de..9479dc6 100644 --- a/main/main.py +++ b/main/main.py @@ -26,12 +26,9 @@ class MainWidget(QWidget): self.system_listWidget.setFrameShape(QListWidget.NoFrame) self.sub_layout.addWidget(self.system_listWidget, 15) - # 可自定义添加的listWidget - # self.custom = QListWidget(self) - # self.sub_layout.addWidget(self.custom, 7) - # 添加最下边的QLabel self.add_list_action = AddListAction() + self.add_list_action.create_todo_list.connect(self.CreateNewItem) # self.add_item_label.setPixmap(QPixmap()) self.sub_layout.addWidget(self.add_list_action, 1) @@ -104,13 +101,14 @@ class MainWidget(QWidget): # 创建新的分组 def CreateNewItem(self): # 创建一个没有名字的item - item = QListWidgetItem("") + item = SelfListWidgetItem('新建列表') item.setTextAlignment(Qt.AlignCenter) # 使得item是可以编辑的. item.setFlags(item.flags() | Qt.ItemIsEditable) - self.custom.addItem(item) + self.system_listWidget.addItem(item) # 创建后就可以编辑item,用户自己起名字. - self.custom.editItem(item) + # self.system_listWidget.editItem(item) + self.system_listWidget.setItemWidget(item, item.widget) # 删除分组 def DeleteItem(self): diff --git a/resource/current.qss b/resource/current.qss index dd45ab5..2168048 100644 --- a/resource/current.qss +++ b/resource/current.qss @@ -1,10 +1,10 @@ /*去掉item虚线边框*/ -* { +/** {*/ /* background: #f3f3f3;*/ /* color: black ;*/ -padding:0px; -margin:0px; -} +/*padding:0px;*/ +/*margin:0px;*/ +/*}*/ QListWidget, QListView, QTreeWidget, QTreeView { outline-style: 0px; @@ -41,7 +41,8 @@ QListWidget::item { QListWidget#todo_list{ min-width:700px; - min-height:650px; + min-height:520px; +/* max-height:600px;*/ border-top-left-radius:3px; border-top-right-radius:3px; border-bottom-left-radius:3px; @@ -210,8 +211,10 @@ QLabel#time_label{ /*堆栈页面的 通用 头部标题文字*/ QLabel#head_label{ + min-height:150px; margin-left: 30px; color:white; + background-color:red; font-weight:bold; } diff --git a/utils/nextcloud.py b/utils/nextcloud.py index e69de29..629124c 100644 --- a/utils/nextcloud.py +++ b/utils/nextcloud.py @@ -0,0 +1,15 @@ +from webdav3.client import Client + +import configparser + +options = { + 'webdav_hostname': "https://cloud.liyp.cc/remote.php/dav/files/admin/", + 'webdav_login': "admin", + 'webdav_password': "" +} +client = Client(options) +# client.execute_request('list') +list1 = client.list('/') +print(list1) +exist = client.check('OpenTodoList') +print(exist) diff --git a/view/AddListLabel.py b/view/AddListLabel.py index 24f55ca..e521057 100644 --- a/view/AddListLabel.py +++ b/view/AddListLabel.py @@ -1,10 +1,13 @@ import os +from PyQt5.QtCore import pyqtSignal from PyQt5.QtGui import * from PyQt5.QtWidgets import * class AddListAction(QLabel): + create_todo_list = pyqtSignal() + def __init__(self): super(AddListAction, self).__init__() self.widget = QWidget(self) @@ -21,10 +24,11 @@ class AddListAction(QLabel): layout.addWidget(self.add_image, 3) layout.addWidget(self.add_text, 4) - def mousePressEvent(self, QMouseEvent): - print('按下QLabel') - self.setStyleSheet('background-color:#9f9f9f;') + # def mousePressEvent(self, QMouseEvent): + # print('按下QLabel') + # self.setStyleSheet('background-color:#9f9f9f;') def mouseReleaseEvent(self, QMouseEvent): print('释放QLabel') + self.create_todo_list.emit() self.setStyleSheet('background-color:#eaeaea;') diff --git a/view/MyDayHeadLabel.py b/view/MyDayHeadLabel.py index 7adc86a..4482871 100644 --- a/view/MyDayHeadLabel.py +++ b/view/MyDayHeadLabel.py @@ -10,7 +10,7 @@ class HeadLabel(QLabel): self.setScaledContents(True) self.setObjectName('head_label') layout = QVBoxLayout() - self.setMinimumHeight(170) + # self.setMinimumHeight(170) # 设置当前时间 weekday = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"] diff --git a/view/MyDayView.py b/view/MyDayView.py index 4d61a25..9396c92 100644 --- a/view/MyDayView.py +++ b/view/MyDayView.py @@ -30,16 +30,16 @@ class MyDay(QWidget): head_layout = QHBoxLayout() # 头部总布局 head_widget = QWidget(self) - head_widget.setMinimumHeight(175) + # head_widget.setMinimumHeight(175) - head_widget.setMaximumHeight(200) + # head_widget.setMaximumHeight(180) head_widget.setAttribute(Qt.WA_StyledBackground) self.todo_list = QListWidget() self.todo_list.setFrameShape(QListWidget.NoFrame) self.todo_list.setObjectName('todo_list') - # 添加ToDo的标签 + # 最下面的添加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) @@ -52,6 +52,8 @@ class MyDay(QWidget): # head_left_layout = QVBoxLayout() layout.addWidget(head_widget, 2, Qt.AlignTop) + + # layout.addSpacing(1) self.head_label = HeadLabel() layout.addWidget(self.todo_list, 6, Qt.AlignCenter | Qt.AlignTop) head_layout.addWidget(self.head_label, 8)