瞎搞一通没什么进展!
This commit is contained in:
parent
e009539a03
commit
f760d0d1a7
12 changed files with 278 additions and 31 deletions
13
README.md
13
README.md
|
@ -1,3 +1,16 @@
|
|||
# pyqt-todolist
|
||||
|
||||
使用Pyqt开发的todo list软件!
|
||||
|
||||
- [x] 用户信息布局
|
||||
- [ ] 用户信息右键及功能实现
|
||||
- [x] 待办事项列表布局实现
|
||||
- [ ] 待办事项列表功能实现
|
||||
- [ ] 待办事项列表右键功能实现
|
||||
- [ ] 右边`QStackLayout`布局
|
||||
- [ ] “我的一天”和“重要”布局实现
|
||||
- [ ] 添加的通用布局实现
|
||||
- [ ] 更换主题功能
|
||||
- [ ] 登录`nextcloud`及其他`WebDav`和同步功能
|
||||
- [ ] 添加“设置”功能
|
||||
- [ ] 拖拽排序功能
|
0
TODO
Normal file
0
TODO
Normal file
16
main/main.py
16
main/main.py
|
@ -4,6 +4,7 @@ from PyQt5.QtGui import *
|
|||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import Qt
|
||||
from utils.QSSLoader import QSSLoader
|
||||
from view.ImportantView import Important
|
||||
from view.UserLabel import User
|
||||
from view.SelfListWidgetItem import SelfListWidgetItem
|
||||
from view.AddListLabel import AddListAction
|
||||
|
@ -22,6 +23,7 @@ class MainWidget(QWidget):
|
|||
self.sub_layout.addWidget(self.user_label, 2)
|
||||
# 左侧列表
|
||||
self.system_listWidget = QListWidget(self)
|
||||
self.system_listWidget.setFrameShape(QListWidget.NoFrame)
|
||||
self.sub_layout.addWidget(self.system_listWidget, 15)
|
||||
|
||||
# 可自定义添加的listWidget
|
||||
|
@ -42,9 +44,11 @@ class MainWidget(QWidget):
|
|||
|
||||
# 右侧层叠窗口
|
||||
|
||||
my_day=MyDay()
|
||||
self.my_day = MyDay()
|
||||
self.important = Important()
|
||||
self.stackedWidget = QStackedWidget(self)
|
||||
self.stackedWidget.addWidget(my_day)
|
||||
self.stackedWidget.addWidget(self.my_day)
|
||||
self.stackedWidget.addWidget(self.important)
|
||||
|
||||
layout.addLayout(self.sub_layout, 2)
|
||||
|
||||
|
@ -53,7 +57,9 @@ class MainWidget(QWidget):
|
|||
self.one_day = SelfListWidgetItem('我的一天', 1, os.getcwd() + '/../images/sun.svg')
|
||||
self.system_listWidget.setCurrentRow(1)
|
||||
# self.one_day.setSelected(True)
|
||||
self.important = SelfListWidgetItem('重要', 0, os.getcwd() + '/../images/star.svg')
|
||||
self.important_item = SelfListWidgetItem('重要', 0, os.getcwd() + '/../images/star.svg')
|
||||
|
||||
self.system_listWidget.currentRowChanged.connect(self.stackedWidget.setCurrentIndex)
|
||||
|
||||
self.setLayout(layout)
|
||||
self.initUI()
|
||||
|
@ -63,8 +69,8 @@ class MainWidget(QWidget):
|
|||
self.system_listWidget.addItem(self.one_day)
|
||||
self.system_listWidget.setItemWidget(self.one_day, self.one_day.widget)
|
||||
|
||||
self.system_listWidget.addItem(self.important)
|
||||
self.system_listWidget.setItemWidget(self.important, self.important.widget)
|
||||
self.system_listWidget.addItem(self.important_item)
|
||||
self.system_listWidget.setItemWidget(self.important_item, self.important_item.widget)
|
||||
|
||||
# 测试添加下面的
|
||||
# self.two_day = SelfListWidgetItem('我的一天', 1, os.getcwd() + '/../images/sun.svg')
|
||||
|
|
|
@ -47,18 +47,34 @@ QListWidget::item {
|
|||
/*}*/
|
||||
/*QPushButton:pressed,*/
|
||||
/*QPushButton:pressed:focus {*/
|
||||
/* *//* 改变背景色 *//* */
|
||||
/* 改变背景色*/
|
||||
/* background-color: #f50057;*/
|
||||
/* *//* 改变边框风格 *//* */
|
||||
/* 改变边框风格*/
|
||||
/* border-style:inset;*/
|
||||
/* *//* 改变边框风格 *//* */
|
||||
/* 改变边框风格*/
|
||||
/* border-style:inset;*/
|
||||
/*}*/
|
||||
|
||||
/*QPushButton#upload_btn {*/
|
||||
/*设置堆栈按钮样式*/
|
||||
QPushButton#menu_image {
|
||||
/* padding: 3px 20px;*/
|
||||
/* text-align:center;*/
|
||||
/*}*/
|
||||
background-color:#f3f3f3;
|
||||
border-radius:15px;
|
||||
}
|
||||
QPushButton#menu_image:hover {
|
||||
/* padding: 3px 20px;*/
|
||||
/* text-align:center;*/
|
||||
background-color:#dddddd;
|
||||
border-radius:15px;
|
||||
}
|
||||
QPushButton#menu_image:pressed {
|
||||
/* padding: 3px 20px;*/
|
||||
/* text-align:center;*/
|
||||
background-color:#d4d4d4;
|
||||
border-radius:15px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -98,6 +114,32 @@ QLabel#AddListAction::hover{
|
|||
background: #eaeaea;
|
||||
/* padding-right:25px;*/
|
||||
}
|
||||
QLabel#title {
|
||||
/* padding-top:20px;*/
|
||||
font-size:32px;
|
||||
color:white;
|
||||
margin-left: 30px;
|
||||
font-weight:bold;
|
||||
}
|
||||
QLabel#time_label{
|
||||
color:white;
|
||||
margin-left: 30px;
|
||||
font-size:20px;
|
||||
}
|
||||
/*QWidget#head_widget{*/
|
||||
/* margin:50px;*/
|
||||
/* background-color:blanchedalmond;*/
|
||||
/*}*/
|
||||
QLabel#head_label{
|
||||
/* margin: 30px;*/
|
||||
|
||||
}
|
||||
|
||||
#my_day{
|
||||
background-image:url("../images/2.jpg");
|
||||
background-position: center;
|
||||
border-radius: 10px;
|
||||
padding-top:40px;}
|
||||
|
||||
/*QLineEdit {*/
|
||||
/* border: 2px solid rgb(52,52,52);*/
|
||||
|
|
1
test/ConfigparserTest.py
Normal file
1
test/ConfigparserTest.py
Normal file
|
@ -0,0 +1 @@
|
|||
import configparser
|
|
@ -13,10 +13,10 @@ class AddListAction(QLabel):
|
|||
layout = QHBoxLayout()
|
||||
self.widget.setLayout(layout)
|
||||
self.add_image = QLabel()
|
||||
|
||||
self.add_image.setPixmap(QPixmap(os.getcwd() + '/../images/add.png'))
|
||||
# self.add_image.setObjectName('pic_label')
|
||||
|
||||
self.add_text = QLabel("新建列表")
|
||||
layout.addWidget(self.add_image, 3)
|
||||
layout.addWidget(self.add_text, 4)
|
||||
# self.set
|
||||
|
|
49
view/HeadDemo.py
Normal file
49
view/HeadDemo.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'HeadDemo.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.6
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName("Form")
|
||||
Form.resize(400, 300)
|
||||
self.widget = QtWidgets.QWidget(Form)
|
||||
self.widget.setGeometry(QtCore.QRect(40, 90, 276, 90))
|
||||
self.widget.setObjectName("widget")
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget)
|
||||
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.label = QtWidgets.QLabel(self.widget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(32)
|
||||
self.label.setFont(font)
|
||||
self.label.setObjectName("label")
|
||||
self.verticalLayout_2.addWidget(self.label)
|
||||
self.label_2 = QtWidgets.QLabel(self.widget)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.verticalLayout_2.addWidget(self.label_2)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout_2)
|
||||
self.pushButton = QtWidgets.QPushButton(self.widget)
|
||||
self.pushButton.setStyleSheet("")
|
||||
self.pushButton.setObjectName("pushButton")
|
||||
self.horizontalLayout.addWidget(self.pushButton)
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Form.setWindowTitle(_translate("Form", "Form"))
|
||||
self.label.setText(_translate("Form", "我的一天"))
|
||||
self.label_2.setText(_translate("Form", "2022-04-12"))
|
||||
self.pushButton.setText(_translate("Form", "PushButton"))
|
64
view/HeadDemo.ui
Normal file
64
view/HeadDemo.ui
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>90</y>
|
||||
<width>276</width>
|
||||
<height>90</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>32</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我的一天</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>2022-04-12</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
40
view/MyDayHeadLabel.py
Normal file
40
view/MyDayHeadLabel.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
from datetime import datetime
|
||||
|
||||
from PyQt5.QtGui import QFont
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
|
||||
class HeadLabel(QLabel):
|
||||
def __init__(self):
|
||||
super(HeadLabel, self).__init__()
|
||||
self.setObjectName('head_label')
|
||||
layout = QVBoxLayout()
|
||||
# self.resize(200,100)
|
||||
# widget = QWidget(self)
|
||||
# widget.setLayout(layout)
|
||||
# self.setMinimumHeight(300)
|
||||
# self.setMinimumWidth(300)
|
||||
# widget.setMaximumHeight(100)
|
||||
|
||||
# 设置当前时间
|
||||
weekday = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
weekday_index = datetime.now().weekday()
|
||||
month = datetime.now().month
|
||||
day = datetime.now().day
|
||||
|
||||
# 输出日期示例
|
||||
# print(str(month) + '月' + str(day) + '日,' + weekday[weekday_index])
|
||||
|
||||
self.title = QLabel("我的一天")
|
||||
# 设置字体大小
|
||||
self.font = QFont()
|
||||
self.font.setPointSize(32)
|
||||
self.title.setFont(self.font)
|
||||
|
||||
self.title.setObjectName('title')
|
||||
self.time_label = QLabel(str(month) + '月' + str(day) + '日,' + weekday[weekday_index])
|
||||
self.time_label.setObjectName('time_label')
|
||||
layout.addWidget(self.title)
|
||||
layout.addWidget(self.time_label)
|
||||
self.setLayout(layout)
|
||||
self.show()
|
|
@ -3,29 +3,62 @@ import sys
|
|||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import Qt
|
||||
import datetime
|
||||
from view.MyDayHeadLabel import HeadLabel
|
||||
|
||||
|
||||
class MyDay(QWidget):
|
||||
def __init__(self):
|
||||
super(MyDay, self).__init__()
|
||||
self.setObjectName('my_day')
|
||||
self.setAttribute(Qt.WA_StyledBackground)
|
||||
# todo : 使用网格布局设置背景图
|
||||
# 下面这一句有问题,需要修复修改主题的实现方法
|
||||
# self.setStyleSheet('#my_day{background-image:url("../images/2.jpg");')
|
||||
# 无效
|
||||
# palette = QPalette()
|
||||
# palette.setBrush(QPalette.Background,
|
||||
# QBrush(QPixmap(os.getcwd() + "/../images/0.jpg").scaled(self.width(), self.height())))
|
||||
# self.setPalette(palette)
|
||||
|
||||
# 布局样式:最外面一个大的垂直布局,里面的最上面标题是一个水平布局,水平布局显示的是一个垂直布局和一个右边的选项,用来更换背景
|
||||
# 布局样式:继承QWidget,里面一个垂直布局,最上面一个QWidget用来设置头部布局
|
||||
# 头部QWidget里面一个水平布局,水平布局里面一个QWidget(方便设置整体位置),然后是一个
|
||||
layout = QVBoxLayout()
|
||||
head_layout = QHBoxLayout()
|
||||
head_left_layout = QVBoxLayout()
|
||||
layout.addLayout(head_layout)
|
||||
head_layout.addLayout(head_left_layout)
|
||||
|
||||
head_widget = QWidget(self)
|
||||
head_widget.setMaximumHeight(100)
|
||||
# head_widget.
|
||||
# head_widget.setObjectName('head_widget')
|
||||
head_widget.setAttribute(Qt.WA_StyledBackground)
|
||||
# self.setStyleSheet('#head_widget{margin:50px}')
|
||||
|
||||
# head_widget.setPalette(palette)
|
||||
|
||||
head_widget.setLayout(head_layout)
|
||||
head_layout.setAlignment(Qt.AlignCenter)
|
||||
# head_left_layout = QVBoxLayout()
|
||||
|
||||
layout.addWidget(head_widget, 2)
|
||||
head_label = HeadLabel()
|
||||
|
||||
layout.addStretch(0)
|
||||
|
||||
head_layout.addWidget(head_label,8)
|
||||
|
||||
self.menu_image = QPushButton()
|
||||
self.menu_image.setObjectName('menu_image')
|
||||
self.menu_image.setFixedSize(30,30)
|
||||
# self.menu_image.setScaledContents(True)
|
||||
pic_btn = QPixmap(os.getcwd() + "/../images/menu.png")
|
||||
self.menu_image.setIcon(QIcon(pic_btn))
|
||||
# self.menu_image.setFixedSize(QPixmap(os.getcwd() + "/../images/menu.png").size())
|
||||
# head_layout.addLayout(head_left_layout)
|
||||
head_layout.addWidget(self.menu_image,2)
|
||||
head_layout.addStretch(1)
|
||||
|
||||
self.setLayout(layout)
|
||||
# todo : 取消这几个不必要的layout,直接重写QLabel实现上面的标签显示,这样不行
|
||||
# todo : 下面的方法实现点击更换主题的功能
|
||||
def menu_action(self):
|
||||
pass
|
||||
|
||||
# 设置当前时间
|
||||
weekday = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
weekday_index = datetime.datetime.now().weekday()
|
||||
month = datetime.datetime.now().month
|
||||
day = datetime.datetime.now().day
|
||||
print(str(month) + '月' + str(day) + '日,' + weekday[weekday_index])
|
||||
|
||||
self.title = QLabel("我的一天")
|
||||
self.time_label = QLabel(str(month) + '月' + str(day) + '日,' + weekday[weekday_index])
|
||||
head_left_layout.addWidget(self.title)
|
||||
head_left_layout.addWidget(self.time_label)
|
||||
|
|
0
view/StackListItem.py
Normal file
0
view/StackListItem.py
Normal file
|
@ -1,5 +1,4 @@
|
|||
import os
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
|
|
Loading…
Reference in a new issue