又是没什么进展的一天!修改“我的一天”头部布局,添加“重要”
BIN
images/0.jpg
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 558 KiB |
BIN
images/1.jpg
Before Width: | Height: | Size: 644 KiB After Width: | Height: | Size: 79 KiB |
BIN
images/10.jpg
Normal file
After Width: | Height: | Size: 161 KiB |
BIN
images/11.jpg
Normal file
After Width: | Height: | Size: 226 KiB |
BIN
images/4.jpg
Normal file
After Width: | Height: | Size: 324 KiB |
BIN
images/5.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
images/6.jpg
Normal file
After Width: | Height: | Size: 141 KiB |
BIN
images/7.jpg
Normal file
After Width: | Height: | Size: 258 KiB |
BIN
images/8.jpg
Normal file
After Width: | Height: | Size: 167 KiB |
BIN
images/9.jpg
Normal file
After Width: | Height: | Size: 197 KiB |
|
@ -71,6 +71,7 @@ class MainWidget(QWidget):
|
||||||
|
|
||||||
self.system_listWidget.addItem(self.important_item)
|
self.system_listWidget.addItem(self.important_item)
|
||||||
self.system_listWidget.setItemWidget(self.important_item, self.important_item.widget)
|
self.system_listWidget.setItemWidget(self.important_item, self.important_item.widget)
|
||||||
|
# self.system_listWidget.addScrollBarWidget(False)
|
||||||
|
|
||||||
# 测试添加下面的
|
# 测试添加下面的
|
||||||
# self.two_day = SelfListWidgetItem('我的一天', 1, os.getcwd() + '/../images/sun.svg')
|
# self.two_day = SelfListWidgetItem('我的一天', 1, os.getcwd() + '/../images/sun.svg')
|
||||||
|
|
|
@ -36,6 +36,10 @@ QListWidget::item {
|
||||||
/* border-right: 4px solid rgb(9, 187, 7);*/
|
/* border-right: 4px solid rgb(9, 187, 7);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#todo_list{
|
||||||
|
min-width:700px;
|
||||||
|
background-color: rgba(211, 211, 211, 0.5);
|
||||||
|
}
|
||||||
/*QPushButton {*/
|
/*QPushButton {*/
|
||||||
/* max-width: 120px;*/
|
/* max-width: 120px;*/
|
||||||
/* color: white;*/
|
/* color: white;*/
|
||||||
|
@ -114,6 +118,8 @@ QLabel#AddListAction::hover{
|
||||||
background: #eaeaea;
|
background: #eaeaea;
|
||||||
/* padding-right:25px;*/
|
/* padding-right:25px;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*我的一天专门的*/
|
||||||
QLabel#title {
|
QLabel#title {
|
||||||
/* padding-top:20px;*/
|
/* padding-top:20px;*/
|
||||||
font-size:32px;
|
font-size:32px;
|
||||||
|
@ -130,16 +136,19 @@ QLabel#time_label{
|
||||||
/* margin:50px;*/
|
/* margin:50px;*/
|
||||||
/* background-color:blanchedalmond;*/
|
/* background-color:blanchedalmond;*/
|
||||||
/*}*/
|
/*}*/
|
||||||
QLabel#head_label{
|
|
||||||
/* margin: 30px;*/
|
|
||||||
|
|
||||||
|
/*堆栈页面的 通用 头部标题文字*/
|
||||||
|
QLabel#head_label{
|
||||||
|
margin-left: 30px;
|
||||||
|
color:white;
|
||||||
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
#my_day{
|
/*#my_day{*/
|
||||||
background-image:url("../images/2.jpg");
|
/* background-image:url("../images/2.jpg");*/
|
||||||
background-position: center;
|
/* background-position: center;*/
|
||||||
border-radius: 10px;
|
/* border-radius: 10px;*/
|
||||||
padding-top:40px;}
|
/* padding-top:40px;}*/
|
||||||
|
|
||||||
/*QLineEdit {*/
|
/*QLineEdit {*/
|
||||||
/* border: 2px solid rgb(52,52,52);*/
|
/* border: 2px solid rgb(52,52,52);*/
|
||||||
|
@ -150,7 +159,8 @@ QLabel#head_label{
|
||||||
|
|
||||||
/*}*/
|
/*}*/
|
||||||
|
|
||||||
|
/*隐藏按钮右侧的下拉三角*/
|
||||||
|
QPushButton::menu-indicator{ image:none;}
|
||||||
QMenu {
|
QMenu {
|
||||||
/* 半透明效果 */
|
/* 半透明效果 */
|
||||||
background-color: rgba(255, 255, 255, 230);
|
background-color: rgba(255, 255, 255, 230);
|
||||||
|
|
14
view/ChangeThemeLabel.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from PyQt5.QtGui import QFont
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
|
||||||
|
|
||||||
|
class ChangeTheme(QLabel):
|
||||||
|
def __init__(self):
|
||||||
|
super(ChangeTheme, self).__init__()
|
||||||
|
self.setScaledContents(True)
|
||||||
|
self.widget = QWidget()
|
||||||
|
self.label = QLabel('主题')
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
layout.addWidget(self.label)
|
||||||
|
self.widget.setLayout(layout)
|
||||||
|
self.widget.show()
|
|
@ -7,14 +7,9 @@ from PyQt5.QtWidgets import *
|
||||||
class HeadLabel(QLabel):
|
class HeadLabel(QLabel):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(HeadLabel, self).__init__()
|
super(HeadLabel, self).__init__()
|
||||||
|
self.setScaledContents(True)
|
||||||
self.setObjectName('head_label')
|
self.setObjectName('head_label')
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
# self.resize(200,100)
|
|
||||||
# widget = QWidget(self)
|
|
||||||
# widget.setLayout(layout)
|
|
||||||
# self.setMinimumHeight(300)
|
|
||||||
# self.setMinimumWidth(300)
|
|
||||||
# widget.setMaximumHeight(100)
|
|
||||||
|
|
||||||
# 设置当前时间
|
# 设置当前时间
|
||||||
weekday = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
weekday = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||||
|
@ -30,10 +25,11 @@ class HeadLabel(QLabel):
|
||||||
self.font = QFont()
|
self.font = QFont()
|
||||||
self.font.setPointSize(32)
|
self.font.setPointSize(32)
|
||||||
self.title.setFont(self.font)
|
self.title.setFont(self.font)
|
||||||
|
# todo: 需要调整布局,修复字体溢出
|
||||||
|
|
||||||
self.title.setObjectName('title')
|
# self.title.setObjectName('title')
|
||||||
self.time_label = QLabel(str(month) + '月' + str(day) + '日,' + weekday[weekday_index])
|
self.time_label = QLabel(str(month) + '月' + str(day) + '日,' + weekday[weekday_index])
|
||||||
self.time_label.setObjectName('time_label')
|
# self.time_label.setObjectName('time_label')
|
||||||
layout.addWidget(self.title)
|
layout.addWidget(self.title)
|
||||||
layout.addWidget(self.time_label)
|
layout.addWidget(self.time_label)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
|
@ -4,12 +4,15 @@ from PyQt5.QtGui import *
|
||||||
from PyQt5.QtWidgets import *
|
from PyQt5.QtWidgets import *
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from view.MyDayHeadLabel import HeadLabel
|
from view.MyDayHeadLabel import HeadLabel
|
||||||
|
from view.ChangeThemeLabel import ChangeTheme
|
||||||
|
|
||||||
|
|
||||||
class MyDay(QWidget):
|
class MyDay(QWidget):
|
||||||
def __init__(self):
|
def __init__(self, parent=None):
|
||||||
super(MyDay, self).__init__()
|
super(MyDay, self).__init__()
|
||||||
self.setObjectName('my_day')
|
self.setObjectName('my_day')
|
||||||
|
self.setStyleSheet('#my_day{background-image:url("../images/10.jpg")}')
|
||||||
|
|
||||||
self.setAttribute(Qt.WA_StyledBackground)
|
self.setAttribute(Qt.WA_StyledBackground)
|
||||||
# todo : 使用网格布局设置背景图
|
# todo : 使用网格布局设置背景图
|
||||||
# 下面这一句有问题,需要修复修改主题的实现方法
|
# 下面这一句有问题,需要修复修改主题的实现方法
|
||||||
|
@ -28,10 +31,10 @@ class MyDay(QWidget):
|
||||||
|
|
||||||
head_widget = QWidget(self)
|
head_widget = QWidget(self)
|
||||||
head_widget.setMaximumHeight(100)
|
head_widget.setMaximumHeight(100)
|
||||||
# head_widget.
|
|
||||||
# head_widget.setObjectName('head_widget')
|
|
||||||
head_widget.setAttribute(Qt.WA_StyledBackground)
|
head_widget.setAttribute(Qt.WA_StyledBackground)
|
||||||
# self.setStyleSheet('#head_widget{margin:50px}')
|
self.todo_list = QListWidget()
|
||||||
|
self.todo_list.setObjectName('todo_list')
|
||||||
|
|
||||||
# head_widget.setPalette(palette)
|
# head_widget.setPalette(palette)
|
||||||
|
|
||||||
|
@ -39,26 +42,60 @@ class MyDay(QWidget):
|
||||||
head_layout.setAlignment(Qt.AlignCenter)
|
head_layout.setAlignment(Qt.AlignCenter)
|
||||||
# head_left_layout = QVBoxLayout()
|
# head_left_layout = QVBoxLayout()
|
||||||
|
|
||||||
layout.addWidget(head_widget, 2)
|
layout.addWidget(head_widget, 2, Qt.AlignTop)
|
||||||
head_label = HeadLabel()
|
head_label = HeadLabel()
|
||||||
|
layout.addWidget(self.todo_list, 6, Qt.AlignCenter | Qt.AlignTop)
|
||||||
layout.addStretch(0)
|
head_layout.addWidget(head_label, 8)
|
||||||
|
|
||||||
head_layout.addWidget(head_label,8)
|
|
||||||
|
|
||||||
self.menu_image = QPushButton()
|
self.menu_image = QPushButton()
|
||||||
self.menu_image.setObjectName('menu_image')
|
self.menu_image.setObjectName('menu_image')
|
||||||
self.menu_image.setFixedSize(30,30)
|
self.menu_image.setFixedSize(30, 30)
|
||||||
# self.menu_image.setScaledContents(True)
|
# self.menu_image.setScaledContents(True)
|
||||||
pic_btn = QPixmap(os.getcwd() + "/../images/menu.png")
|
pic_btn = QPixmap(os.getcwd() + "/../images/menu.png")
|
||||||
self.menu_image.setIcon(QIcon(pic_btn))
|
self.menu_image.setIcon(QIcon(pic_btn))
|
||||||
# self.menu_image.setFixedSize(QPixmap(os.getcwd() + "/../images/menu.png").size())
|
# self.menu_image.setFixedSize(QPixmap(os.getcwd() + "/../images/menu.png").size())
|
||||||
# head_layout.addLayout(head_left_layout)
|
# head_layout.addLayout(head_left_layout)
|
||||||
head_layout.addWidget(self.menu_image,2)
|
head_layout.addWidget(self.menu_image, 2)
|
||||||
head_layout.addStretch(1)
|
head_layout.addStretch(1)
|
||||||
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
# todo : 下面的方法实现点击更换主题的功能
|
# self.menu_image.clicked.connect(self.menu_action)
|
||||||
def menu_action(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
button_menu = QMenu(self)
|
||||||
|
# 背景透明
|
||||||
|
button_menu.setAttribute(Qt.WA_TranslucentBackground)
|
||||||
|
# 无边框、去掉自带阴影
|
||||||
|
button_menu.setWindowFlags(
|
||||||
|
button_menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
||||||
|
|
||||||
|
self.menu_image.setMenu(button_menu)
|
||||||
|
|
||||||
|
theme_label = QAction(self)
|
||||||
|
theme_label.setText('主题')
|
||||||
|
theme_label.setDisabled(True)
|
||||||
|
button_menu.addAction(theme_label)
|
||||||
|
button_menu.addSeparator()
|
||||||
|
# button_menu
|
||||||
|
for i in range(11):
|
||||||
|
label_action = QAction(self)
|
||||||
|
label_action.setIcon(QIcon('../images/' + str(i) + '.jpg'))
|
||||||
|
label_action.setText(str(i))
|
||||||
|
label_action.triggered.connect(lambda: self.menu_action(str(i)))
|
||||||
|
button_menu.addAction(label_action)
|
||||||
|
|
||||||
|
# pass
|
||||||
|
|
||||||
|
# todo : 下面的方法实现点击更换主题的功能
|
||||||
|
|
||||||
|
def menu_action(self, count):
|
||||||
|
# 点击按钮
|
||||||
|
# self.menu_label = ChangeTheme()
|
||||||
|
self.setStyleSheet('#my_day{background-image:url("../images/3.jpg");'
|
||||||
|
'background-position: center; border-radius: 10px;'
|
||||||
|
' padding-top:40px;}')
|
||||||
|
print('选中:' + count)
|
||||||
|
# self.palette = QPalette()
|
||||||
|
# self.palette.setBrush(self.palette.Background, QBrush(QPixmap('../images/' + count + '.png')))
|
||||||
|
# self.setPalette(self.palette)
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
|
@ -36,7 +36,7 @@ class SelfListWidgetItem(QListWidgetItem):
|
||||||
self.item_name_label = QLabel(self.item_name)
|
self.item_name_label = QLabel(self.item_name)
|
||||||
# print(self.item_name)
|
# print(self.item_name)
|
||||||
self.item_name_label.setObjectName('item_name_label')
|
self.item_name_label.setObjectName('item_name_label')
|
||||||
# todo 需要设置qss使字体靠中间一点,如果有气泡使气泡靠右 done
|
|
||||||
|
|
||||||
layout.addWidget(self.item_name_label, 3)
|
layout.addWidget(self.item_name_label, 3)
|
||||||
|
|
||||||
|
|
7
view/ToDoListItem.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
|
||||||
|
|
||||||
|
class ToDoListItem(QListWidgetItem):
|
||||||
|
def __init__(self):
|
||||||
|
super(ToDoListItem, self).__init__()
|
||||||
|
self.widget = QWidget()
|