diff --git a/images/0.jpg b/images/0.jpg index d801038..de84a46 100644 Binary files a/images/0.jpg and b/images/0.jpg differ diff --git a/images/1.jpg b/images/1.jpg index 73cc5cd..2c7a10a 100644 Binary files a/images/1.jpg and b/images/1.jpg differ diff --git a/images/10.jpg b/images/10.jpg new file mode 100644 index 0000000..c620cf9 Binary files /dev/null and b/images/10.jpg differ diff --git a/images/11.jpg b/images/11.jpg new file mode 100644 index 0000000..3c8889b Binary files /dev/null and b/images/11.jpg differ diff --git a/images/4.jpg b/images/4.jpg new file mode 100644 index 0000000..c64a5c0 Binary files /dev/null and b/images/4.jpg differ diff --git a/images/5.jpg b/images/5.jpg new file mode 100644 index 0000000..7f670e6 Binary files /dev/null and b/images/5.jpg differ diff --git a/images/6.jpg b/images/6.jpg new file mode 100644 index 0000000..5a31c0c Binary files /dev/null and b/images/6.jpg differ diff --git a/images/7.jpg b/images/7.jpg new file mode 100644 index 0000000..8ee08c0 Binary files /dev/null and b/images/7.jpg differ diff --git a/images/8.jpg b/images/8.jpg new file mode 100644 index 0000000..8af802b Binary files /dev/null and b/images/8.jpg differ diff --git a/images/9.jpg b/images/9.jpg new file mode 100644 index 0000000..9b16c04 Binary files /dev/null and b/images/9.jpg differ diff --git a/main/main.py b/main/main.py index 08ca529..bc188de 100644 --- a/main/main.py +++ b/main/main.py @@ -71,6 +71,7 @@ class MainWidget(QWidget): self.system_listWidget.addItem(self.important_item) 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') diff --git a/resource/current.qss b/resource/current.qss index a8be75a..ed37691 100644 --- a/resource/current.qss +++ b/resource/current.qss @@ -36,6 +36,10 @@ QListWidget::item { /* border-right: 4px solid rgb(9, 187, 7);*/ } +#todo_list{ + min-width:700px; + background-color: rgba(211, 211, 211, 0.5); +} /*QPushButton {*/ /* max-width: 120px;*/ /* color: white;*/ @@ -114,6 +118,8 @@ QLabel#AddListAction::hover{ background: #eaeaea; /* padding-right:25px;*/ } + +/*我的一天专门的*/ QLabel#title { /* padding-top:20px;*/ font-size:32px; @@ -130,16 +136,19 @@ QLabel#time_label{ /* margin:50px;*/ /* background-color:blanchedalmond;*/ /*}*/ -QLabel#head_label{ -/* margin: 30px;*/ +/*堆栈页面的 通用 头部标题文字*/ +QLabel#head_label{ + margin-left: 30px; + color:white; + font-weight:bold; } -#my_day{ - background-image:url("../images/2.jpg"); - background-position: center; - border-radius: 10px; - padding-top:40px;} +/*#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);*/ @@ -150,7 +159,8 @@ QLabel#head_label{ /*}*/ - +/*隐藏按钮右侧的下拉三角*/ +QPushButton::menu-indicator{ image:none;} QMenu { /* 半透明效果 */ background-color: rgba(255, 255, 255, 230); diff --git a/view/ChangeThemeLabel.py b/view/ChangeThemeLabel.py new file mode 100644 index 0000000..036566f --- /dev/null +++ b/view/ChangeThemeLabel.py @@ -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() diff --git a/view/MyDayHeadLabel.py b/view/MyDayHeadLabel.py index d8a8d7f..2269d71 100644 --- a/view/MyDayHeadLabel.py +++ b/view/MyDayHeadLabel.py @@ -7,14 +7,9 @@ from PyQt5.QtWidgets import * class HeadLabel(QLabel): def __init__(self): super(HeadLabel, self).__init__() + self.setScaledContents(True) 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 = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"] @@ -30,10 +25,11 @@ class HeadLabel(QLabel): self.font = QFont() self.font.setPointSize(32) 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.setObjectName('time_label') + # self.time_label.setObjectName('time_label') layout.addWidget(self.title) layout.addWidget(self.time_label) self.setLayout(layout) diff --git a/view/MyDayView.py b/view/MyDayView.py index 74e03c3..d9385ae 100644 --- a/view/MyDayView.py +++ b/view/MyDayView.py @@ -4,12 +4,15 @@ from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt from view.MyDayHeadLabel import HeadLabel +from view.ChangeThemeLabel import ChangeTheme class MyDay(QWidget): - def __init__(self): + def __init__(self, parent=None): super(MyDay, self).__init__() self.setObjectName('my_day') + self.setStyleSheet('#my_day{background-image:url("../images/10.jpg")}') + self.setAttribute(Qt.WA_StyledBackground) # todo : 使用网格布局设置背景图 # 下面这一句有问题,需要修复修改主题的实现方法 @@ -28,10 +31,10 @@ class MyDay(QWidget): 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}') + self.todo_list = QListWidget() + self.todo_list.setObjectName('todo_list') # head_widget.setPalette(palette) @@ -39,26 +42,60 @@ class MyDay(QWidget): head_layout.setAlignment(Qt.AlignCenter) # head_left_layout = QVBoxLayout() - layout.addWidget(head_widget, 2) + layout.addWidget(head_widget, 2, Qt.AlignTop) head_label = HeadLabel() - - layout.addStretch(0) - - head_layout.addWidget(head_label,8) + layout.addWidget(self.todo_list, 6, Qt.AlignCenter | Qt.AlignTop) + 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.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.addWidget(self.menu_image, 2) head_layout.addStretch(1) self.setLayout(layout) - # todo : 下面的方法实现点击更换主题的功能 - def menu_action(self): - pass + # self.menu_image.clicked.connect(self.menu_action) + 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 diff --git a/view/SelfListWidgetItem.py b/view/SelfListWidgetItem.py index 4f0eff9..ffee232 100644 --- a/view/SelfListWidgetItem.py +++ b/view/SelfListWidgetItem.py @@ -36,7 +36,7 @@ class SelfListWidgetItem(QListWidgetItem): self.item_name_label = QLabel(self.item_name) # print(self.item_name) self.item_name_label.setObjectName('item_name_label') - # todo 需要设置qss使字体靠中间一点,如果有气泡使气泡靠右 done + layout.addWidget(self.item_name_label, 3) diff --git a/view/ToDoListItem.py b/view/ToDoListItem.py new file mode 100644 index 0000000..cb427a3 --- /dev/null +++ b/view/ToDoListItem.py @@ -0,0 +1,7 @@ +from PyQt5.QtWidgets import * + + +class ToDoListItem(QListWidgetItem): + def __init__(self): + super(ToDoListItem, self).__init__() + self.widget = QWidget()