主题功能简单实现(QMenu不能获取索引),后期还需要更改!
BIN
images/0.jpg
Before Width: | Height: | Size: 558 KiB After Width: | Height: | Size: 300 KiB |
BIN
images/10.jpg
Before Width: | Height: | Size: 161 KiB |
BIN
images/11.jpg
Before Width: | Height: | Size: 226 KiB |
BIN
images/2.jpg
Before Width: | Height: | Size: 300 KiB After Width: | Height: | Size: 558 KiB |
BIN
images/4.jpg
Before Width: | Height: | Size: 324 KiB After Width: | Height: | Size: 167 KiB |
BIN
images/40.jpg
Normal file
After Width: | Height: | Size: 324 KiB |
BIN
images/5.jpg
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 197 KiB |
BIN
images/50.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
images/8.jpg
Before Width: | Height: | Size: 167 KiB After Width: | Height: | Size: 161 KiB |
BIN
images/9.jpg
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 226 KiB |
1
images/login.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1650336574257" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2585" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M548.43904 684.246016c7.16288 0.013312 14.034944-2.83648 19.08736-7.914496L727.109632 512.553984 567.513088 348.763136c-10.724352-10.368-27.833344-10.07104-38.187008 0.659456-10.118144 10.473472-10.118144 27.067392 0 37.540864L654.942208 512.579584 529.32608 638.210048c-10.514432 10.578944-10.461184 27.6736 0.131072 38.201344C534.510592 681.422848 541.329408 684.232704 548.43904 684.246016zM106.651648 538.724352l563.526656 0c14.917632 0 27.014144-12.1088 27.014144-27.021312 0-14.918656-12.096512-27.015168-27.014144-27.015168l-563.526656 0c-14.931968 0-27.015168 12.096512-27.015168 27.015168C79.63648 526.614528 91.71968 538.724352 106.651648 538.724352zM350.04928 890.208256 350.04928 646.255616l54.385664-0.078848 0 211.371008c0 18.044928 14.642176 32.672768 32.687104 32.672768l420.168704 0c18.044928 0 32.673792-14.62784 32.673792-32.672768l0 0-0.831488-690.812928c0-18.044928-14.628864-32.673792-32.673792-32.673792-0.013312 0-0.013312 0-0.013312 0L437.13536 134.061056c-18.044928 0-32.687104 14.628864-32.687104 32.673792l0 210.190336-54.398976 0 0-243.134464c0-29.837312 24.192-54.030336 54.030336-54.030336l486.267904 0c29.838336 0 54.030336 24.192 54.030336 54.030336l0 756.416512c0 29.838336-24.192 54.030336-54.030336 54.030336L404.078592 944.237568C374.24128 944.237568 350.04928 920.045568 350.04928 890.208256z" p-id="2586"></path></svg>
|
After Width: | Height: | Size: 1.7 KiB |
1
images/todo_info.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1650356127030" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2619" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M232.533333 345.6l324.266667 320c17.066667 17.066667 17.066667 42.666667 0 59.733333l-117.333333 115.2c-17.066667 17.066667-42.666667 17.066667-59.733334 0l-324.266666-320c-17.066667-17.066667-17.066667-42.666667 0-59.733333l117.333333-115.2c14.933333-17.066667 42.666667-17.066667 59.733333 0z" fill="#185ABD" p-id="2620"></path><path d="M968.533333 315.733333L439.466667 840.533333c-17.066667 17.066667-42.666667 17.066667-59.733334 0L262.4 725.333333c-17.066667-17.066667-17.066667-42.666667 0-59.733333L791.466667 140.8c17.066667-17.066667 42.666667-17.066667 59.733333 0l117.333333 115.2c17.066667 17.066667 17.066667 42.666667 0 59.733333z" fill="#41A5EE" p-id="2621"></path></svg>
|
After Width: | Height: | Size: 1 KiB |
|
@ -3,7 +3,7 @@ import sys
|
||||||
from PyQt5.QtGui import *
|
from PyQt5.QtGui import *
|
||||||
from PyQt5.QtWidgets import *
|
from PyQt5.QtWidgets import *
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
|
import configparser
|
||||||
from utils.CreateToDo import CreateToDo
|
from utils.CreateToDo import CreateToDo
|
||||||
from utils.QSSLoader import QSSLoader
|
from utils.QSSLoader import QSSLoader
|
||||||
from view.ImportantView import Important
|
from view.ImportantView import Important
|
||||||
|
@ -149,6 +149,7 @@ class MainWindow(QWidget):
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
main = MainWindow()
|
main = MainWindow()
|
||||||
|
main.setWindowTitle('PyQtToDoList')
|
||||||
# print(os.path.abspath('../'))
|
# print(os.path.abspath('../'))
|
||||||
style_sheet = QSSLoader.read_qss_file('../resource/current.qss')
|
style_sheet = QSSLoader.read_qss_file('../resource/current.qss')
|
||||||
main.setStyleSheet(style_sheet)
|
main.setStyleSheet(style_sheet)
|
||||||
|
|
|
@ -102,6 +102,13 @@ QLabel#add_todo_label{
|
||||||
border-bottom-right-radius:3px;
|
border-bottom-right-radius:3px;
|
||||||
background-color: rgba(211, 211, 211, 0.5);
|
background-color: rgba(211, 211, 211, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QLineEdit#login_line{
|
||||||
|
border: none;
|
||||||
|
background:transparent;
|
||||||
|
min-width:400px;
|
||||||
|
}
|
||||||
|
|
||||||
QLineEdit#add_line_edit {
|
QLineEdit#add_line_edit {
|
||||||
border: none;
|
border: none;
|
||||||
background:transparent;
|
background:transparent;
|
||||||
|
@ -112,24 +119,27 @@ QLineEdit#add_line_edit {
|
||||||
min-width:700px;
|
min-width:700px;
|
||||||
|
|
||||||
}
|
}
|
||||||
/*QPushButton {*/
|
QTabWidget{
|
||||||
|
border-style:inset;
|
||||||
|
}
|
||||||
|
/*QPushButton#login_button {*/
|
||||||
/* max-width: 120px;*/
|
/* max-width: 120px;*/
|
||||||
/* color: white;*/
|
/* color: white;*/
|
||||||
/* border-top-left-radius:10px; */
|
/* border-top-left-radius:10px;*/
|
||||||
/* border-top-right-radius:10px;*/
|
/* border-top-right-radius:10px;*/
|
||||||
/* border-bottom-left-radius:10px;*/
|
/* border-bottom-left-radius:10px;*/
|
||||||
/* border-bottom-right-radius:10px;*/
|
/* border-bottom-right-radius:10px;*/
|
||||||
/* background: pink;*/
|
/* background: pink;*/
|
||||||
/*}*/
|
/*}*/
|
||||||
/*QPushButton:pressed,*/
|
QPushButton#login_button:pressed,
|
||||||
/*QPushButton:pressed:focus {*/
|
QPushButton#login_button:pressed:focus {
|
||||||
/* 改变背景色*/
|
/* 改变背景色*/
|
||||||
/* background-color: #f50057;*/
|
background-color: #f50057;
|
||||||
/* 改变边框风格*/
|
/* 改变边框风格*/
|
||||||
/* border-style:inset;*/
|
border-style:inset;
|
||||||
/* 改变边框风格*/
|
/* 改变边框风格*/
|
||||||
/* border-style:inset;*/
|
border-style:inset;
|
||||||
/*}*/
|
}
|
||||||
|
|
||||||
/*设置堆栈按钮样式*/
|
/*设置堆栈按钮样式*/
|
||||||
QPushButton#menu_image {
|
QPushButton#menu_image {
|
||||||
|
@ -174,6 +184,10 @@ QLabel#todo_count_label {
|
||||||
border:1px solid black;
|
border:1px solid black;
|
||||||
font-size:10px;
|
font-size:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QLabel#user_name{
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
/*设置用户名金和用户邮箱样式*/
|
/*设置用户名金和用户邮箱样式*/
|
||||||
|
|
||||||
QLabel#pic_label{
|
QLabel#pic_label{
|
||||||
|
|
42
test/NewWindow.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
class MainWindow(QWidget):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.initUI()
|
||||||
|
|
||||||
|
def initUI(self):
|
||||||
|
# 设置窗口标题和大小
|
||||||
|
self.setWindowTitle('TestWindow')
|
||||||
|
self.resize(400, 300)
|
||||||
|
|
||||||
|
self.collec_btn = QPushButton('打开新窗口', self)
|
||||||
|
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
layout.addWidget(self.collec_btn)
|
||||||
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
self.show()
|
||||||
|
|
||||||
|
|
||||||
|
class NewWindow(QWidget):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setWindowTitle('新窗口')
|
||||||
|
self.resize(280, 230)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
# 创建窗口
|
||||||
|
window = MainWindow()
|
||||||
|
newWin = NewWindow()
|
||||||
|
|
||||||
|
# 显示窗口
|
||||||
|
window.show()
|
||||||
|
window.collec_btn.clicked.connect(newWin.show)
|
||||||
|
# 运行应用,并监听事件
|
||||||
|
sys.exit(app.exec_())
|
|
@ -1,6 +1,7 @@
|
||||||
import configparser
|
import configparser
|
||||||
import platform
|
import platform
|
||||||
import os
|
import os
|
||||||
|
from utils import ReturnWorkDir
|
||||||
|
|
||||||
|
|
||||||
# todo : 用来创建软件的配置信息
|
# todo : 用来创建软件的配置信息
|
||||||
|
@ -13,7 +14,7 @@ class CreateConfigure:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, login_type, webdav_login, webdav_password, webdav_hostname=None):
|
def __init__(self, login_type, webdav_login, webdav_password, webdav_hostname=None):
|
||||||
config_file = self.return_config_file()
|
config_file = ReturnWorkDir.return_work_dir() + 'PyQtToDoList.ini'
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
if not os.path.exists(config_file):
|
if not os.path.exists(config_file):
|
||||||
# print(config_file)
|
# print(config_file)
|
||||||
|
@ -51,14 +52,14 @@ class CreateConfigure:
|
||||||
config.write(f)
|
config.write(f)
|
||||||
print('create complete!', config_file)
|
print('create complete!', config_file)
|
||||||
|
|
||||||
def return_config_file(self):
|
# def return_config_file(self):
|
||||||
if platform.system() == 'Linux':
|
# if platform.system() == 'Linux':
|
||||||
work_path = os.path.expandvars('$HOME') + '/.config/PyQtToDoList'
|
# work_path = os.path.expandvars('$HOME') + '/.config/PyQtToDoList'
|
||||||
if not os.path.exists(work_path):
|
# if not os.path.exists(work_path):
|
||||||
os.mkdir(work_path)
|
# os.mkdir(work_path)
|
||||||
return os.path.expandvars('$HOME') + '/.config/PyQtToDoList/PyQtToDoList.ini'
|
# return os.path.expandvars('$HOME') + '/.config/PyQtToDoList/PyQtToDoList.ini'
|
||||||
elif platform.system() == 'Windows':
|
# elif platform.system() == 'Windows':
|
||||||
return os.getcwd() + '/PyQtToDoList.ini'
|
# return os.getcwd() + '/PyQtToDoList.ini'
|
||||||
|
|
||||||
|
|
||||||
CreateConfigure('NextCloud', 'admin', '19990903@lyp', 'https://cloud.liyp.cc')
|
# CreateConfigure('NextCloud', 'admin', '19990903@lyp', 'https://cloud.liyp.cc')
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
import uuid
|
import uuid
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from utils import ReturnWorkDir
|
||||||
|
|
||||||
"""
|
"""
|
||||||
todo : 暂时创建单个文件存储该列表下所有待办事项,文件命名为 {uuid}.otl
|
todo : 暂时创建单个文件存储该列表下所有待办事项,文件命名为 {uuid}.otl
|
||||||
同级还有 library.json 存储该列表信息
|
同级还有 library.json 存储该列表信息
|
||||||
|
@ -22,8 +23,8 @@ class CreateToDo:
|
||||||
|
|
||||||
def __init__(self, item_type, name, todo_list_uid=None):
|
def __init__(self, item_type, name, todo_list_uid=None):
|
||||||
uid = str(uuid.uuid4())
|
uid = str(uuid.uuid4())
|
||||||
config_path = self.get_config_path()
|
config_path = ReturnWorkDir.return_work_dir()
|
||||||
todo_list_path = config_path + '/{' + uid + '}'
|
todo_list_path = config_path + '{' + uid + '}'
|
||||||
# if not os.path.exists(todo_list_path):
|
# if not os.path.exists(todo_list_path):
|
||||||
# os.mkdir(todo_list_path)
|
# os.mkdir(todo_list_path)
|
||||||
default_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
default_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
@ -76,14 +77,14 @@ class CreateToDo:
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
def get_config_path(self):
|
# def get_config_path(self):
|
||||||
|
#
|
||||||
# print(platform.system())
|
# # print(platform.system())
|
||||||
if platform.system() == 'Linux':
|
# if platform.system() == 'Linux':
|
||||||
# print(os.environ['HOME'] + '/.config/PyQtToDoList')
|
# # print(os.environ['HOME'] + '/.config/PyQtToDoList')
|
||||||
# print(os.path.expandvars('~'))
|
# # print(os.path.expandvars('~'))
|
||||||
# print(os.path.expandvars('$HOME') + '.config/PyQtToDoList')
|
# # print(os.path.expandvars('$HOME') + '.config/PyQtToDoList')
|
||||||
return os.path.expandvars('$HOME') + '/.config/PyQtToDoList'
|
# return os.path.expandvars('$HOME') + '/.config/PyQtToDoList'
|
||||||
elif platform.system() == 'Windows':
|
# elif platform.system() == 'Windows':
|
||||||
print(os.getcwd() + 'config')
|
# print(os.getcwd() + 'config')
|
||||||
return os.getcwd() + 'config'
|
# return os.getcwd() + 'config'
|
||||||
|
|
36
utils/ReturnWorkDir.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
|
||||||
|
|
||||||
|
def return_work_dir():
|
||||||
|
if platform.system() == 'Linux':
|
||||||
|
work_path = os.path.expandvars('$HOME') + '/.config/'
|
||||||
|
if not os.path.exists(work_path):
|
||||||
|
os.mkdir(work_path)
|
||||||
|
return os.path.expandvars('$HOME') + '/.config/PyQtToDoList/'
|
||||||
|
elif platform.system() == 'Windows':
|
||||||
|
work_path = os.getcwd() + '/config/'
|
||||||
|
if not os.path.exists(work_path):
|
||||||
|
os.mkdir(work_path)
|
||||||
|
return work_path
|
||||||
|
|
||||||
|
|
||||||
|
import configparser
|
||||||
|
|
||||||
|
|
||||||
|
def read_init_file():
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
try:
|
||||||
|
config.read(return_work_dir() + 'PyQtToDoList.ini')
|
||||||
|
account = config['Account']
|
||||||
|
if account:
|
||||||
|
return [account['webdav_hostname'], account['webdav_login'], account['webdav_password'], account['type']]
|
||||||
|
except KeyError as e:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# print(read_init_file())
|
||||||
|
# webdav_hostname = read_init_file()
|
||||||
|
# print(webdav_hostname[2])
|
68
utils/TabWidgetTest.py
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
import sys
|
||||||
|
from PyQt5.QtCore import *
|
||||||
|
from PyQt5.QtGui import *
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
|
||||||
|
class TabDemo(QTabWidget):
|
||||||
|
def __init__(self,parent=None):
|
||||||
|
super(TabDemo, self).__init__(parent)
|
||||||
|
|
||||||
|
#创建3个选项卡小控件窗口
|
||||||
|
self.tab1=QWidget()
|
||||||
|
self.tab2=QWidget()
|
||||||
|
self.tab3=QWidget()
|
||||||
|
|
||||||
|
#将三个选项卡添加到顶层窗口中
|
||||||
|
self.addTab(self.tab1, "Tab 1")
|
||||||
|
self.addTab(self.tab2, "Tab 2")
|
||||||
|
self.addTab(self.tab3, "Tab 3")
|
||||||
|
|
||||||
|
#每个选项卡自定义的内容
|
||||||
|
self.tab1UI()
|
||||||
|
self.tab2UI()
|
||||||
|
self.tab3UI()
|
||||||
|
|
||||||
|
def tab1UI(self):
|
||||||
|
#表单布局
|
||||||
|
layout=QFormLayout()
|
||||||
|
#添加姓名,地址的单行文本输入框
|
||||||
|
layout.addRow('姓名',QLineEdit())
|
||||||
|
layout.addRow('地址',QLineEdit())
|
||||||
|
#设置选项卡的小标题与布局方式
|
||||||
|
self.setTabText(0,'联系方式')
|
||||||
|
self.tab1.setLayout(layout)
|
||||||
|
|
||||||
|
def tab2UI(self):
|
||||||
|
#zhu表单布局,次水平布局
|
||||||
|
layout=QFormLayout()
|
||||||
|
sex=QHBoxLayout()
|
||||||
|
|
||||||
|
#水平布局添加单选按钮
|
||||||
|
sex.addWidget(QRadioButton('男'))
|
||||||
|
sex.addWidget(QRadioButton('女'))
|
||||||
|
|
||||||
|
#表单布局添加控件
|
||||||
|
layout.addRow(QLabel('性别'),sex)
|
||||||
|
layout.addRow('生日',QLineEdit())
|
||||||
|
|
||||||
|
#设置标题与布局
|
||||||
|
self.setTabText(1,'个人详细信息')
|
||||||
|
self.tab2.setLayout(layout)
|
||||||
|
|
||||||
|
def tab3UI(self):
|
||||||
|
#水平布局
|
||||||
|
layout=QHBoxLayout()
|
||||||
|
|
||||||
|
#添加控件到布局中
|
||||||
|
layout.addWidget(QLabel('科目'))
|
||||||
|
layout.addWidget(QCheckBox('物理'))
|
||||||
|
layout.addWidget(QCheckBox('高数'))
|
||||||
|
|
||||||
|
#设置小标题与布局方式
|
||||||
|
self.setTabText(2,'教育程度')
|
||||||
|
self.tab3.setLayout(layout)
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app=QApplication(sys.argv)
|
||||||
|
demo=TabDemo()
|
||||||
|
demo.show()
|
||||||
|
sys.exit(app.exec_())
|
|
@ -1,6 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
from PyQt5.QtCore import pyqtSignal, Qt
|
||||||
from PyQt5.QtCore import pyqtSignal
|
|
||||||
from PyQt5.QtGui import *
|
from PyQt5.QtGui import *
|
||||||
from PyQt5.QtWidgets import *
|
from PyQt5.QtWidgets import *
|
||||||
|
|
||||||
|
@ -24,11 +23,15 @@ class AddListAction(QLabel):
|
||||||
layout.addWidget(self.add_image, 3)
|
layout.addWidget(self.add_image, 3)
|
||||||
layout.addWidget(self.add_text, 4)
|
layout.addWidget(self.add_text, 4)
|
||||||
|
|
||||||
# def mousePressEvent(self, QMouseEvent):
|
def mousePressEvent(self, QMouseEvent):
|
||||||
# print('按下QLabel')
|
if QMouseEvent.buttons() == Qt.LeftButton:
|
||||||
# self.setStyleSheet('background-color:#9f9f9f;')
|
print('点击QLabel')
|
||||||
|
|
||||||
def mouseReleaseEvent(self, QMouseEvent):
|
self.create_todo_list.emit()
|
||||||
print('释放QLabel')
|
self.setStyleSheet('background-color:#eaeaea;')
|
||||||
self.create_todo_list.emit()
|
|
||||||
self.setStyleSheet('background-color:#eaeaea;')
|
# def mouseReleaseEvent(self, QMouseEvent):
|
||||||
|
# if QMouseEvent.buttons == Qt.LeftButton:
|
||||||
|
# print('点击QLabel')
|
||||||
|
# self.create_todo_list.emit()
|
||||||
|
# self.setStyleSheet('background-color:#eaeaea;')
|
||||||
|
|
|
@ -5,6 +5,7 @@ from PyQt5.QtWidgets import *
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
|
|
||||||
from view.AddToDoLabel import AddToDoAction
|
from view.AddToDoLabel import AddToDoAction
|
||||||
|
from view.ToDoItem import ToDoItem
|
||||||
|
|
||||||
|
|
||||||
class Important(QWidget):
|
class Important(QWidget):
|
||||||
|
@ -12,7 +13,7 @@ class Important(QWidget):
|
||||||
super(Important, self).__init__()
|
super(Important, self).__init__()
|
||||||
self.setObjectName('important')
|
self.setObjectName('important')
|
||||||
self.setAttribute(Qt.WA_StyledBackground)
|
self.setAttribute(Qt.WA_StyledBackground)
|
||||||
# todo : 使用网格布局设置背景图
|
|
||||||
self.setStyleSheet('#important{background-image:url("../images/10.jpg");border-radius: 10px;}')
|
self.setStyleSheet('#important{background-image:url("../images/10.jpg");border-radius: 10px;}')
|
||||||
|
|
||||||
# 布局样式:最外面一个大的垂直布局,里面的最上面标题是一个水平布局,水平布局显示的是一个垂直布局和一个右边的选项,用来更换背景
|
# 布局样式:最外面一个大的垂直布局,里面的最上面标题是一个水平布局,水平布局显示的是一个垂直布局和一个右边的选项,用来更换背景
|
||||||
|
@ -22,7 +23,7 @@ class Important(QWidget):
|
||||||
head_layout = QHBoxLayout()
|
head_layout = QHBoxLayout()
|
||||||
|
|
||||||
head_widget = QWidget(self)
|
head_widget = QWidget(self)
|
||||||
head_widget.setStyleSheet('background-color:gray')
|
# head_widget.setStyleSheet('background-color:gray')
|
||||||
# todo :
|
# todo :
|
||||||
# head_widget.setMinimumHeight(175)
|
# head_widget.setMinimumHeight(175)
|
||||||
|
|
||||||
|
@ -70,41 +71,89 @@ class Important(QWidget):
|
||||||
# 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())
|
|
||||||
# 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)
|
||||||
# self.menu_image.clicked.connect(self.menu_action)
|
# self.menu_image.clicked.connect(self.menu_action)
|
||||||
|
|
||||||
button_menu = QMenu(self)
|
self.button_menu = QMenu(self)
|
||||||
# 背景透明
|
# 背景透明
|
||||||
button_menu.setAttribute(Qt.WA_TranslucentBackground)
|
self.button_menu.setAttribute(Qt.WA_TranslucentBackground)
|
||||||
# 无边框、去掉自带阴影
|
# 无边框、去掉自带阴影
|
||||||
button_menu.setWindowFlags(
|
self.button_menu.setWindowFlags(
|
||||||
button_menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
self.button_menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
||||||
|
|
||||||
self.menu_image.setMenu(button_menu)
|
self.menu_image.setMenu(self.button_menu)
|
||||||
|
|
||||||
theme_label = QAction(self)
|
theme_label = QAction(self)
|
||||||
theme_label.setText('主题')
|
theme_label.setText('主题')
|
||||||
theme_label.setDisabled(True)
|
theme_label.setDisabled(True)
|
||||||
button_menu.addAction(theme_label)
|
self.button_menu.addAction(theme_label)
|
||||||
button_menu.addSeparator()
|
self.button_menu.addSeparator()
|
||||||
|
#
|
||||||
|
# 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)))
|
||||||
|
# self.button_menu.addAction(label_action)
|
||||||
|
|
||||||
|
# for i in range(11):
|
||||||
|
label_action1 = QAction(self)
|
||||||
|
label_action1.setIcon(QIcon('../images/1.jpg'))
|
||||||
|
label_action1.setText('渐变1')
|
||||||
|
label_action1.triggered.connect(lambda: self.menu_action(1))
|
||||||
|
self.button_menu.addAction(label_action1)
|
||||||
|
|
||||||
|
label_action2 = QAction(self)
|
||||||
|
label_action2.setIcon(QIcon('../images/2.jpg'))
|
||||||
|
label_action2.setText('渐变2')
|
||||||
|
label_action2.triggered.connect(lambda: self.menu_action(2))
|
||||||
|
self.button_menu.addAction(label_action2)
|
||||||
|
|
||||||
|
label_action3 = QAction(self)
|
||||||
|
label_action3.setIcon(QIcon('../images/3.jpg'))
|
||||||
|
label_action3.setText('渐变3')
|
||||||
|
label_action3.triggered.connect(lambda: self.menu_action(3))
|
||||||
|
self.button_menu.addAction(label_action3)
|
||||||
|
|
||||||
|
label_action4 = QAction(self)
|
||||||
|
label_action4.setIcon(QIcon('../images/4.jpg'))
|
||||||
|
label_action4.setText('渐变4')
|
||||||
|
label_action4.triggered.connect(lambda: self.menu_action(4))
|
||||||
|
self.button_menu.addAction(label_action4)
|
||||||
|
|
||||||
|
label_action5 = QAction(self)
|
||||||
|
label_action5.setIcon(QIcon('../images/5.jpg'))
|
||||||
|
label_action5.setText('渐变5')
|
||||||
|
label_action5.triggered.connect(lambda: self.menu_action(5))
|
||||||
|
self.button_menu.addAction(label_action5)
|
||||||
# button_menu
|
# button_menu
|
||||||
for i in range(11):
|
# for i in range(11):
|
||||||
label_action = QAction(self)
|
# label_action = QAction(self)
|
||||||
label_action.setIcon(QIcon('../images/' + str(i) + '.jpg'))
|
# label_action.setIcon(QIcon('../images/' + str(i) + '.jpg'))
|
||||||
label_action.setText(str(i))
|
# label_action.setText(str(i))
|
||||||
label_action.triggered.connect(lambda: self.menu_action(str(i)))
|
# label_action.triggered.connect(lambda: self.menu_action(str(i)))
|
||||||
button_menu.addAction(label_action)
|
# button_menu.addAction(label_action)
|
||||||
# todo : 下面的方法实现点击更换主题的功能
|
# todo : 下面的方法实现点击更换主题的功能
|
||||||
|
|
||||||
def menu_action(self, count):
|
def menu_action(self, count):
|
||||||
# 点击按钮
|
# 点击按钮
|
||||||
|
count = str(count)
|
||||||
# self.menu_label = ChangeTheme()
|
# self.menu_label = ChangeTheme()
|
||||||
self.setStyleSheet('#important{background-image:url("../images/4.jpg");'
|
self.setStyleSheet('#important{background-image:url("../images/' + count + '.jpg");'
|
||||||
'background-position: center; border-radius: 10px;'
|
'background-position: center; border-radius: 10px;'
|
||||||
'}')
|
'}')
|
||||||
print('选中:' + count)
|
print('选中:' + count)
|
||||||
|
|
||||||
|
def line_edit_add(self, name):
|
||||||
|
self.add_todo.todo_name.emit(name)
|
||||||
|
# print('添加的新ToDo:' + name)
|
||||||
|
todo_item = ToDoItem(name)
|
||||||
|
|
||||||
|
self.todo_list.addItem(todo_item)
|
||||||
|
self.todo_list.setItemWidget(todo_item, todo_item.widget)
|
||||||
|
|
||||||
|
self.add_todo.line_edit.clear()
|
||||||
|
|
200
view/LoginWidget.py
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
from PyQt5.QtGui import *
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
import configparser
|
||||||
|
from utils.ReturnWorkDir import *
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# class LoginWindow(QWidget):
|
||||||
|
# def __init__(self):
|
||||||
|
# super().__init__()
|
||||||
|
# self.setStyleSheet('QPushButton#login_button {max-width: 120px;color: white;'
|
||||||
|
# 'border-top-left-radius:10px;border-top-right-radius:10px;'
|
||||||
|
# 'border-bottom-left-radius:10px;border-bottom-right-radius:10px;background: #74d4ec;}'
|
||||||
|
# 'QPushButton#login_button:pressed,QPushButton#login_button:pressed:focus {'
|
||||||
|
# 'background-color: #f50057;border-style:inset;border-style:inset;'
|
||||||
|
# '}')
|
||||||
|
# layout = QVBoxLayout()
|
||||||
|
# self.setLayout(layout)
|
||||||
|
# self.setWindowTitle('登录')
|
||||||
|
# self.resize(500, 600)
|
||||||
|
# self.tab_widget = QTabWidget()
|
||||||
|
# self.tab_widget.setStyleSheet('border:none;background-color:#f3f3f3')
|
||||||
|
# nextcloud_widget = LoginWidget('NextCloud')
|
||||||
|
# self.tab_widget.addTab(nextcloud_widget, 'NextCloud')
|
||||||
|
# self.tab_widget.addTab(LoginWidget('JianGuoYun'), '坚果云')
|
||||||
|
# self.tab_widget.addTab(LoginWidget('WebDav'), 'WebDav')
|
||||||
|
#
|
||||||
|
# # print('open new window')
|
||||||
|
# # self.stack_widget = QStackedWidget()
|
||||||
|
# # self.show()
|
||||||
|
# layout.addWidget(self.tab_widget)
|
||||||
|
# button_layout = QHBoxLayout()
|
||||||
|
# self.test_link = QPushButton('测试连接')
|
||||||
|
# self.test_link.setObjectName('login_button')
|
||||||
|
# self.link = QPushButton('保存配置')
|
||||||
|
# self.link.setObjectName('login_button')
|
||||||
|
# button_layout.addWidget(self.test_link)
|
||||||
|
# button_layout.addWidget(self.link)
|
||||||
|
#
|
||||||
|
# layout.addLayout(button_layout)
|
||||||
|
# self.link.clicked.connect(self.close)
|
||||||
|
|
||||||
|
|
||||||
|
class LoginWidget(QTabWidget):
|
||||||
|
# todo : 添加一个信号,等点击保存后在 main 里面更新未登录的信息
|
||||||
|
"""
|
||||||
|
:param login_type 登录账号类型
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(LoginWidget, self).__init__()
|
||||||
|
self.resize(500, 300)
|
||||||
|
self.setStyleSheet('QLineEdit#lineedit{border: 1px solid gray;background:#f3f3f3;min-width:300px;'
|
||||||
|
'border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-left-radius:5px;'
|
||||||
|
'border-bottom-right-radius:5px;}'
|
||||||
|
'QPushButton#login_button {max-width: 120px;color: white;'
|
||||||
|
'border-top-left-radius:10px;border-top-right-radius:10px;'
|
||||||
|
'border-bottom-left-radius:10px;border-bottom-right-radius:10px;background: #74d4ec;}'
|
||||||
|
'QPushButton#login_button:pressed,QPushButton#login_button:pressed:focus {'
|
||||||
|
'background-color: #f50057;border-style:inset;border-style:inset;'
|
||||||
|
'}')
|
||||||
|
# layout = QVBoxLayout()
|
||||||
|
self.setWindowTitle('登录')
|
||||||
|
|
||||||
|
# host_name_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
# self.host_address = QLabel('服务器地址:')
|
||||||
|
# form_layout = QFormLayout()
|
||||||
|
self.nextcloud_address_lineedit = QLineEdit()
|
||||||
|
self.nextcloud_address_lineedit.setObjectName('lineedit')
|
||||||
|
self.nextcloud_address_lineedit.setPlaceholderText('https://nextcloud.example.com')
|
||||||
|
# host_name_layout.addWidget(self.host_address, 3)
|
||||||
|
# host_name_layout.addWidget(self.host_address_lineedit, 6)
|
||||||
|
|
||||||
|
# host_name_layout = QHBoxLayout()
|
||||||
|
# self.host_address = QLabel('服务器地址:')
|
||||||
|
self.dav_address_lineedit = QLineEdit()
|
||||||
|
self.dav_address_lineedit.setObjectName('lineedit')
|
||||||
|
self.dav_address_lineedit.setPlaceholderText('https://webdav.example.com/dav')
|
||||||
|
|
||||||
|
self.nextcloud_name_lineedit = QLineEdit()
|
||||||
|
self.nextcloud_name_lineedit.setPlaceholderText('用户名')
|
||||||
|
self.nextcloud_name_lineedit.setObjectName('lineedit')
|
||||||
|
# form_layout.addRow('用户:', self.name_lineedit)
|
||||||
|
self.dav_name_lineedit = QLineEdit()
|
||||||
|
self.dav_name_lineedit.setPlaceholderText('用户名')
|
||||||
|
self.dav_name_lineedit.setObjectName('lineedit')
|
||||||
|
|
||||||
|
self.nextcloud_password_lineedit = QLineEdit()
|
||||||
|
self.nextcloud_password_lineedit.setEchoMode(QLineEdit.Password)
|
||||||
|
self.nextcloud_password_lineedit.setPlaceholderText('密码')
|
||||||
|
self.nextcloud_password_lineedit.setObjectName('lineedit')
|
||||||
|
# form_layout.addRow('密码:', self.password_lineedit)
|
||||||
|
self.dav_password_lineedit = QLineEdit()
|
||||||
|
self.dav_password_lineedit.setEchoMode(QLineEdit.Password)
|
||||||
|
self.dav_password_lineedit.setPlaceholderText('密码')
|
||||||
|
self.dav_password_lineedit.setObjectName('lineedit')
|
||||||
|
|
||||||
|
self.jianguoyun_name_lineedit = QLineEdit()
|
||||||
|
self.jianguoyun_name_lineedit.setPlaceholderText('用户名')
|
||||||
|
self.jianguoyun_name_lineedit.setObjectName('lineedit')
|
||||||
|
|
||||||
|
self.jianguoyun_password_lineedit = QLineEdit()
|
||||||
|
self.jianguoyun_password_lineedit.setEchoMode(QLineEdit.Password)
|
||||||
|
self.jianguoyun_password_lineedit.setPlaceholderText('密码')
|
||||||
|
self.jianguoyun_password_lineedit.setObjectName('lineedit')
|
||||||
|
|
||||||
|
button_layout = QHBoxLayout()
|
||||||
|
self.test_link = QPushButton('测试连接')
|
||||||
|
self.test_link.setObjectName('login_button')
|
||||||
|
self.link = QPushButton('保存配置')
|
||||||
|
self.link.setObjectName('login_button')
|
||||||
|
button_layout.addWidget(self.test_link)
|
||||||
|
button_layout.addWidget(self.link)
|
||||||
|
# form_layout.addRow(self.test_link, self.link)
|
||||||
|
|
||||||
|
# layout.addLayout(form_layout)
|
||||||
|
# self.setLayout(layout)
|
||||||
|
# self.show()
|
||||||
|
|
||||||
|
self.test_link.clicked.connect(self.link_test)
|
||||||
|
self.link.clicked.connect(self.close)
|
||||||
|
self.nextcloud_tab = QWidget()
|
||||||
|
self.jianguoyun_tab = QWidget()
|
||||||
|
self.webdav_tab = QWidget()
|
||||||
|
|
||||||
|
self.addTab(self.nextcloud_tab, 'NextCloud')
|
||||||
|
self.addTab(self.jianguoyun_tab, '坚果云')
|
||||||
|
self.addTab(self.webdav_tab, 'WebDav')
|
||||||
|
|
||||||
|
self.initUI1()
|
||||||
|
self.initUI2()
|
||||||
|
self.initUI3()
|
||||||
|
|
||||||
|
# todo : 方向不对,这样设计极其不好,需要更换方式
|
||||||
|
|
||||||
|
def initUI1(self):
|
||||||
|
form_layout = QFormLayout()
|
||||||
|
form_layout.addRow('服务器地址:', self.nextcloud_address_lineedit)
|
||||||
|
form_layout.addRow('用户:', self.nextcloud_name_lineedit)
|
||||||
|
form_layout.addRow('密码:', self.nextcloud_password_lineedit)
|
||||||
|
form_layout.addRow(self.test_link, self.link)
|
||||||
|
self.nextcloud_tab.setLayout(form_layout)
|
||||||
|
|
||||||
|
def initUI2(self):
|
||||||
|
form_layout = QFormLayout()
|
||||||
|
form_layout.addRow('服务器地址:', self.dav_address_lineedit)
|
||||||
|
form_layout.addRow('用户:', self.dav_name_lineedit)
|
||||||
|
form_layout.addRow('密码:', self.dav_password_lineedit)
|
||||||
|
form_layout.addRow(self.test_link, self.link)
|
||||||
|
self.webdav_tab.setLayout(form_layout)
|
||||||
|
pass
|
||||||
|
|
||||||
|
def initUI3(self):
|
||||||
|
form_layout = QFormLayout()
|
||||||
|
form_layout.addRow('用户:', self.jianguoyun_name_lineedit)
|
||||||
|
form_layout.addRow('密码:', self.jianguoyun_password_lineedit)
|
||||||
|
form_layout.addRow(self.test_link, self.link)
|
||||||
|
self.jianguoyun_tab.setLayout(form_layout)
|
||||||
|
pass
|
||||||
|
|
||||||
|
def initUI(self, login_type):
|
||||||
|
form_layout = QFormLayout()
|
||||||
|
|
||||||
|
if login_type == 'NextCloud':
|
||||||
|
print(login_type)
|
||||||
|
form_layout.addRow('服务器地址:', self.nextcloud_address_lineedit)
|
||||||
|
form_layout.addRow('用户:', self.name_lineedit)
|
||||||
|
form_layout.addRow('密码:', self.password_lineedit)
|
||||||
|
form_layout.addRow(self.test_link, self.link)
|
||||||
|
self.nextcloud_tab.setLayout(form_layout)
|
||||||
|
elif login_type == 'WebDav':
|
||||||
|
print(login_type)
|
||||||
|
form_layout.addRow('服务器地址:', self.dav_address_lineedit)
|
||||||
|
|
||||||
|
form_layout.addRow('用户:', self.name_lineedit)
|
||||||
|
form_layout.addRow('密码:', self.password_lineedit)
|
||||||
|
form_layout.addRow(self.test_link, self.link)
|
||||||
|
self.webdav_tab.setLayout(form_layout)
|
||||||
|
else:
|
||||||
|
print(login_type)
|
||||||
|
form_layout.addRow('用户:', self.name_lineedit)
|
||||||
|
form_layout.addRow('密码:', self.password_lineedit)
|
||||||
|
form_layout.addRow(self.test_link, self.link)
|
||||||
|
self.jianguoyun_tab.setLayout(form_layout)
|
||||||
|
# if login_type == 'NextCloud':
|
||||||
|
# self.nextcloud_tab.setLayout(form_layout)
|
||||||
|
# elif login_type == 'WebDav':
|
||||||
|
# self.webdav_tab.setLayout(form_layout)
|
||||||
|
# else:
|
||||||
|
# self.jianguoyun_tab.setLayout(form_layout)
|
||||||
|
|
||||||
|
def link_test(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def save_link(self):
|
||||||
|
self.close()
|
||||||
|
pass
|
116
view/LoginWidget1.py
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
from PyQt5.QtGui import *
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
import configparser
|
||||||
|
from utils.ReturnWorkDir import *
|
||||||
|
|
||||||
|
|
||||||
|
class LoginWindow(QWidget):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
self.setLayout(layout)
|
||||||
|
self.setWindowTitle('登录')
|
||||||
|
self.resize(500, 600)
|
||||||
|
self.tab_widget = QTabWidget()
|
||||||
|
self.tab_widget.setStyleSheet('background-color:#f3f3f3')
|
||||||
|
self.tab_widget.addTab(LoginWidget('NextCloud'), 'NextCloud')
|
||||||
|
self.tab_widget.addTab(LoginWidget('JianGuoYun'), '坚果云')
|
||||||
|
self.tab_widget.addTab(LoginWidget('WebDav'), 'WebDav')
|
||||||
|
|
||||||
|
# print('open new window')
|
||||||
|
# self.stack_widget = QStackedWidget()
|
||||||
|
# self.show()
|
||||||
|
layout.addWidget(self.tab_widget)
|
||||||
|
|
||||||
|
|
||||||
|
class LoginWidget(QWidget):
|
||||||
|
"""
|
||||||
|
:param login_type 登录账号类型
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(LoginWidget, self).__init__()
|
||||||
|
self.setStyleSheet('QLineEdit#lineedit{border: 1px solid gray;background:#f3f3f3;min-width:300px;'
|
||||||
|
'border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-left-radius:5px;'
|
||||||
|
'border-bottom-right-radius:5px;}'
|
||||||
|
'QPushButton#login_button {max-width: 120px;color: white;'
|
||||||
|
'border-top-left-radius:10px;border-top-right-radius:10px;'
|
||||||
|
'border-bottom-left-radius:10px;border-bottom-right-radius:10px;background: #74d4ec;}'
|
||||||
|
'QPushButton#login_button:pressed,QPushButton#login_button:pressed:focus {'
|
||||||
|
'background-color: #f50057;border-style:inset;border-style:inset;'
|
||||||
|
'}')
|
||||||
|
|
||||||
|
self.setWindowTitle('登录')
|
||||||
|
self.resize(500, 600)
|
||||||
|
self.tab_widget = QTabWidget()
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
|
sub_widget = QWidget()
|
||||||
|
self.sub_layout = QVBoxLayout()
|
||||||
|
sub_widget.setLayout(self.sub_layout)
|
||||||
|
|
||||||
|
self.host_name_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
self.host_address = QLabel('服务器地址:')
|
||||||
|
self.host_address_lineedit = QLineEdit()
|
||||||
|
self.host_address_lineedit.setObjectName('lineedit')
|
||||||
|
self.host_address_lineedit.setPlaceholderText('https://nextcloud.example.com')
|
||||||
|
self.host_name_layout.addWidget(self.host_address, 3)
|
||||||
|
self.host_name_layout.addWidget(self.host_address_lineedit, 6)
|
||||||
|
|
||||||
|
self.host_name_layout = QHBoxLayout()
|
||||||
|
self.host_address = QLabel('服务器地址:')
|
||||||
|
self.host_address_lineedit = QLineEdit()
|
||||||
|
self.host_address_lineedit.setObjectName('lineedit')
|
||||||
|
self.host_address_lineedit.setPlaceholderText('https://webdav.example.com/dav')
|
||||||
|
self.host_name_layout.addWidget(self.host_address, 3)
|
||||||
|
self.host_name_layout.addWidget(self.host_address_lineedit, 6)
|
||||||
|
|
||||||
|
name_layout = QHBoxLayout()
|
||||||
|
self.name = QLabel('用户:')
|
||||||
|
self.name_lineedit = QLineEdit()
|
||||||
|
self.name_lineedit.setPlaceholderText('用户名')
|
||||||
|
self.name_lineedit.setObjectName('lineedit')
|
||||||
|
name_layout.addWidget(self.name, 3)
|
||||||
|
name_layout.addWidget(self.name_lineedit)
|
||||||
|
self.sub_layout.addLayout(name_layout)
|
||||||
|
|
||||||
|
password_layout = QHBoxLayout()
|
||||||
|
self.password = QLabel('密码:')
|
||||||
|
self.password_lineedit = QLineEdit()
|
||||||
|
self.password_lineedit.setEchoMode(QLineEdit.Password)
|
||||||
|
self.password_lineedit.setPlaceholderText('密码')
|
||||||
|
self.password_lineedit.setObjectName('lineedit')
|
||||||
|
password_layout.addWidget(self.password, 3)
|
||||||
|
password_layout.addWidget(self.password_lineedit, 6)
|
||||||
|
self.sub_layout.addLayout(password_layout)
|
||||||
|
|
||||||
|
button_layout = QHBoxLayout()
|
||||||
|
self.test_link = QPushButton('测试连接')
|
||||||
|
self.test_link.setObjectName('login_button')
|
||||||
|
self.link = QPushButton('保存配置')
|
||||||
|
self.link.setObjectName('login_button')
|
||||||
|
button_layout.addWidget(self.test_link)
|
||||||
|
button_layout.addWidget(self.link)
|
||||||
|
layout.addLayout(button_layout)
|
||||||
|
self.setLayout(layout)
|
||||||
|
self.sub_widget.show()
|
||||||
|
|
||||||
|
self.test_link.clicked.connect(self.link_test)
|
||||||
|
self.link.clicked.connect(self.close)
|
||||||
|
|
||||||
|
def link_test(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def save_link(self):
|
||||||
|
self.close()
|
||||||
|
pass
|
||||||
|
|
||||||
|
def initUI(self, login_type):
|
||||||
|
if login_type == 'NextCloud':
|
||||||
|
print(login_type)
|
||||||
|
self.sub_layout.addLayout(self.host_name_layout)
|
||||||
|
elif login_type == 'WebDav':
|
||||||
|
print(login_type)
|
||||||
|
self.sub_layout.addLayout(self.host_name_layout)
|
|
@ -8,11 +8,20 @@ from view.MyDayHeadLabel import HeadLabel
|
||||||
from view.ToDoItem import ToDoItem
|
from view.ToDoItem import ToDoItem
|
||||||
|
|
||||||
|
|
||||||
|
class Menu(QMenu):
|
||||||
|
def __init__(self, *__args):
|
||||||
|
super(Menu, self).__init__()
|
||||||
|
self.index = None
|
||||||
|
|
||||||
|
def set_index(self, index):
|
||||||
|
self.index = index
|
||||||
|
|
||||||
|
|
||||||
class MyDay(QWidget):
|
class MyDay(QWidget):
|
||||||
def __init__(self, parent=None):
|
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");border-radius: 10px;}')
|
self.setStyleSheet('#my_day{background-image:url("../images/0.jpg");border-radius: 10px;}')
|
||||||
|
|
||||||
self.setAttribute(Qt.WA_StyledBackground)
|
self.setAttribute(Qt.WA_StyledBackground)
|
||||||
# 下面这一句有问题,需要修复修改主题的实现方法
|
# 下面这一句有问题,需要修复修改主题的实现方法
|
||||||
|
@ -30,7 +39,7 @@ class MyDay(QWidget):
|
||||||
head_layout = QHBoxLayout() # 头部总布局
|
head_layout = QHBoxLayout() # 头部总布局
|
||||||
|
|
||||||
head_widget = QWidget(self)
|
head_widget = QWidget(self)
|
||||||
head_widget.setStyleSheet('background-color:gray')
|
# head_widget.setStyleSheet('background-color:gray')
|
||||||
# head_widget.setMinimumHeight(175)
|
# head_widget.setMinimumHeight(175)
|
||||||
|
|
||||||
# head_widget.setMaximumHeight(180)
|
# head_widget.setMaximumHeight(180)
|
||||||
|
@ -75,38 +84,79 @@ class MyDay(QWidget):
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
# self.menu_image.clicked.connect(self.menu_action)
|
# self.menu_image.clicked.connect(self.menu_action)
|
||||||
|
|
||||||
button_menu = QMenu(self)
|
self.button_menu = QMenu(self)
|
||||||
# 背景透明
|
# 背景透明
|
||||||
button_menu.setAttribute(Qt.WA_TranslucentBackground)
|
self.button_menu.setAttribute(Qt.WA_TranslucentBackground)
|
||||||
# 无边框、去掉自带阴影
|
# 无边框、去掉自带阴影
|
||||||
button_menu.setWindowFlags(
|
self.button_menu.setWindowFlags(
|
||||||
button_menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
self.button_menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
||||||
|
|
||||||
self.menu_image.setMenu(button_menu)
|
self.menu_image.setMenu(self.button_menu)
|
||||||
|
|
||||||
theme_label = QAction(self)
|
theme_label = QAction(self)
|
||||||
theme_label.setText('主题')
|
theme_label.setText('主题')
|
||||||
theme_label.setDisabled(True)
|
theme_label.setDisabled(True)
|
||||||
button_menu.addAction(theme_label)
|
self.button_menu.addAction(theme_label)
|
||||||
button_menu.addSeparator()
|
self.button_menu.addSeparator()
|
||||||
|
#
|
||||||
|
# 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)))
|
||||||
|
# self.button_menu.addAction(label_action)
|
||||||
|
|
||||||
for i in range(11):
|
# for i in range(11):
|
||||||
label_action = QAction(self)
|
label_action1 = QAction(self)
|
||||||
label_action.setIcon(QIcon('../images/' + str(i) + '.jpg'))
|
label_action1.setIcon(QIcon('../images/1.jpg'))
|
||||||
label_action.setText(str(i))
|
label_action1.setText('渐变1')
|
||||||
label_action.triggered.connect(lambda: self.menu_action(str(i)))
|
label_action1.triggered.connect(lambda: self.menu_action(1))
|
||||||
button_menu.addAction(label_action)
|
self.button_menu.addAction(label_action1)
|
||||||
|
|
||||||
# pass
|
label_action2 = QAction(self)
|
||||||
|
label_action2.setIcon(QIcon('../images/2.jpg'))
|
||||||
|
label_action2.setText('渐变2')
|
||||||
|
label_action2.triggered.connect(lambda: self.menu_action(2))
|
||||||
|
self.button_menu.addAction(label_action2)
|
||||||
|
|
||||||
# todo : 下面的方法实现点击更换主题的功能
|
label_action3 = QAction(self)
|
||||||
|
label_action3.setIcon(QIcon('../images/3.jpg'))
|
||||||
|
label_action3.setText('渐变3')
|
||||||
|
label_action3.triggered.connect(lambda: self.menu_action(3))
|
||||||
|
self.button_menu.addAction(label_action3)
|
||||||
|
|
||||||
|
label_action4 = QAction(self)
|
||||||
|
label_action4.setIcon(QIcon('../images/4.jpg'))
|
||||||
|
label_action4.setText('渐变4')
|
||||||
|
label_action4.triggered.connect(lambda: self.menu_action(4))
|
||||||
|
self.button_menu.addAction(label_action4)
|
||||||
|
|
||||||
|
label_action5 = QAction(self)
|
||||||
|
label_action5.setIcon(QIcon('../images/5.jpg'))
|
||||||
|
label_action5.setText('渐变5')
|
||||||
|
label_action5.triggered.connect(lambda: self.menu_action(5))
|
||||||
|
self.button_menu.addAction(label_action5)
|
||||||
|
# print(self.button_menu.size())
|
||||||
|
|
||||||
|
# print(button_menu.actions()[0])
|
||||||
|
# actions = button_menu.actions()
|
||||||
|
# for i in actions:
|
||||||
|
# print(i)
|
||||||
|
# j = 1
|
||||||
|
# i.triggered.connect(lambda: self.menu_action(str(j)))
|
||||||
|
# j += 1
|
||||||
|
|
||||||
|
# pass
|
||||||
|
|
||||||
|
# todo : 下面的方法实现点击更换主题的功能
|
||||||
|
|
||||||
def menu_action(self, count):
|
def menu_action(self, count):
|
||||||
|
count = str(count)
|
||||||
# 点击按钮
|
# 点击按钮
|
||||||
|
|
||||||
self.setStyleSheet('#my_day{background-image:url("../images/4.jpg");'
|
self.setStyleSheet('#my_day{background-image:url("../images/' + count + '.jpg");'
|
||||||
'background-position: center; border-radius: 10px;'
|
'background-position: center; border-radius: 10px;'
|
||||||
'}')
|
'}')
|
||||||
self.head_label.show()
|
self.head_label.show()
|
||||||
|
|
||||||
print('选中:' + count)
|
print('选中:' + count)
|
||||||
|
|
|
@ -5,15 +5,25 @@ from PyQt5.QtWidgets import *
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
|
|
||||||
from view.AddToDoLabel import AddToDoAction
|
from view.AddToDoLabel import AddToDoAction
|
||||||
|
from view.ToDoItem import ToDoItem
|
||||||
|
|
||||||
|
|
||||||
|
class Menu(QMenu):
|
||||||
|
def __init__(self):
|
||||||
|
super(Menu, self).__init__()
|
||||||
|
self.index = None
|
||||||
|
|
||||||
|
def set_index(self, index):
|
||||||
|
self.index = index
|
||||||
|
|
||||||
|
|
||||||
class ToDoList(QWidget):
|
class ToDoList(QWidget):
|
||||||
def __init__(self, list_name):
|
def __init__(self, list_name):
|
||||||
super(ToDoList, self).__init__()
|
super(ToDoList, self).__init__()
|
||||||
self.setObjectName('important')
|
self.setObjectName('todolist')
|
||||||
self.setAttribute(Qt.WA_StyledBackground)
|
self.setAttribute(Qt.WA_StyledBackground)
|
||||||
# todo : 使用网格布局设置背景图
|
# todo : 使用网格布局设置背景图
|
||||||
self.setStyleSheet('#important{background-image:url("../images/10.jpg");border-radius: 10px;}')
|
self.setStyleSheet('#todolist{background-image:url("../images/10.jpg");border-radius: 10px;}')
|
||||||
|
|
||||||
# 布局样式:最外面一个大的垂直布局,里面的最上面标题是一个水平布局,水平布局显示的是一个垂直布局和一个右边的选项,用来更换背景
|
# 布局样式:最外面一个大的垂直布局,里面的最上面标题是一个水平布局,水平布局显示的是一个垂直布局和一个右边的选项,用来更换背景
|
||||||
# 布局样式:继承QWidget,里面一个垂直布局,最上面一个QWidget用来设置头部布局
|
# 布局样式:继承QWidget,里面一个垂直布局,最上面一个QWidget用来设置头部布局
|
||||||
|
@ -77,33 +87,82 @@ class ToDoList(QWidget):
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
# self.menu_image.clicked.connect(self.menu_action)
|
# self.menu_image.clicked.connect(self.menu_action)
|
||||||
|
|
||||||
button_menu = QMenu(self)
|
self.button_menu = QMenu(self)
|
||||||
# 背景透明
|
# 背景透明
|
||||||
button_menu.setAttribute(Qt.WA_TranslucentBackground)
|
self.button_menu.setAttribute(Qt.WA_TranslucentBackground)
|
||||||
# 无边框、去掉自带阴影
|
# 无边框、去掉自带阴影
|
||||||
button_menu.setWindowFlags(
|
self.button_menu.setWindowFlags(
|
||||||
button_menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
self.button_menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
||||||
|
|
||||||
self.menu_image.setMenu(button_menu)
|
self.menu_image.setMenu(self.button_menu)
|
||||||
|
|
||||||
theme_label = QAction(self)
|
theme_label = QAction(self)
|
||||||
theme_label.setText('主题')
|
theme_label.setText('主题')
|
||||||
theme_label.setDisabled(True)
|
theme_label.setDisabled(True)
|
||||||
button_menu.addAction(theme_label)
|
self.button_menu.addAction(theme_label)
|
||||||
button_menu.addSeparator()
|
self.button_menu.addSeparator()
|
||||||
|
#
|
||||||
|
# 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)))
|
||||||
|
# self.button_menu.addAction(label_action)
|
||||||
|
|
||||||
|
# for i in range(11):
|
||||||
|
label_action1 = QAction(self)
|
||||||
|
label_action1.setIcon(QIcon('../images/1.jpg'))
|
||||||
|
label_action1.setText('渐变1')
|
||||||
|
label_action1.triggered.connect(lambda: self.menu_action(1))
|
||||||
|
self.button_menu.addAction(label_action1)
|
||||||
|
|
||||||
|
label_action2 = QAction(self)
|
||||||
|
label_action2.setIcon(QIcon('../images/2.jpg'))
|
||||||
|
label_action2.setText('渐变2')
|
||||||
|
label_action2.triggered.connect(lambda: self.menu_action(2))
|
||||||
|
self.button_menu.addAction(label_action2)
|
||||||
|
|
||||||
|
label_action3 = QAction(self)
|
||||||
|
label_action3.setIcon(QIcon('../images/3.jpg'))
|
||||||
|
label_action3.setText('渐变3')
|
||||||
|
label_action3.triggered.connect(lambda: self.menu_action(3))
|
||||||
|
self.button_menu.addAction(label_action3)
|
||||||
|
|
||||||
|
label_action4 = QAction(self)
|
||||||
|
label_action4.setIcon(QIcon('../images/4.jpg'))
|
||||||
|
label_action4.setText('渐变4')
|
||||||
|
label_action4.triggered.connect(lambda: self.menu_action(4))
|
||||||
|
self.button_menu.addAction(label_action4)
|
||||||
|
|
||||||
|
label_action5 = QAction(self)
|
||||||
|
label_action5.setIcon(QIcon('../images/5.jpg'))
|
||||||
|
label_action5.setText('渐变5')
|
||||||
|
label_action5.triggered.connect(lambda: self.menu_action(5))
|
||||||
|
self.button_menu.addAction(label_action5)
|
||||||
# button_menu
|
# button_menu
|
||||||
for i in range(11):
|
# for i in range(11):
|
||||||
label_action = QAction(self)
|
# label_action = QAction(self)
|
||||||
label_action.setIcon(QIcon('../images/' + str(i) + '.jpg'))
|
# label_action.setIcon(QIcon('../images/' + str(i) + '.jpg'))
|
||||||
label_action.setText(str(i))
|
# label_action.setText(str(i))
|
||||||
label_action.triggered.connect(lambda: self.menu_action(str(i)))
|
# label_action.triggered.connect(lambda: self.menu_action(str(i)))
|
||||||
button_menu.addAction(label_action)
|
# button_menu.addAction(label_action)
|
||||||
# todo : 下面的方法实现点击更换主题的功能
|
# todo : 下面的方法实现点击更换主题的功能
|
||||||
|
|
||||||
def menu_action(self, count):
|
def menu_action(self, count):
|
||||||
# 点击按钮
|
# 点击按钮
|
||||||
|
count = str(count)
|
||||||
# self.menu_label = ChangeTheme()
|
# self.menu_label = ChangeTheme()
|
||||||
self.setStyleSheet('#important{background-image:url("../images/4.jpg");'
|
self.setStyleSheet('#todolist{background-image:url("../images/' + count + '.jpg");'
|
||||||
'background-position: center; border-radius: 10px;'
|
'background-position: center; border-radius: 10px;'
|
||||||
'}')
|
'}')
|
||||||
print('选中:' + count)
|
# print('选中:' + count)
|
||||||
|
|
||||||
|
def line_edit_add(self, name):
|
||||||
|
self.add_todo.todo_name.emit(name)
|
||||||
|
# print('添加的新ToDo:' + name)
|
||||||
|
todo_item = ToDoItem(name)
|
||||||
|
|
||||||
|
self.todo_list.addItem(todo_item)
|
||||||
|
self.todo_list.setItemWidget(todo_item, todo_item.widget)
|
||||||
|
|
||||||
|
self.add_todo.line_edit.clear()
|
||||||
|
|
|
@ -1,12 +1,31 @@
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtGui import *
|
from PyQt5.QtGui import *
|
||||||
from PyQt5.QtWidgets import *
|
from PyQt5.QtWidgets import *
|
||||||
|
import configparser
|
||||||
|
from utils.ReturnWorkDir import *
|
||||||
|
from view.LoginWidget import LoginWidget
|
||||||
|
|
||||||
|
|
||||||
def about_qt():
|
# class LoginWindow(QWidget):
|
||||||
# 关于Qt
|
# def __init__(self):
|
||||||
QApplication.instance().aboutQt()
|
# super().__init__()
|
||||||
|
# layout = QVBoxLayout()
|
||||||
|
# self.setLayout(layout)
|
||||||
|
# self.setWindowTitle('登录')
|
||||||
|
# self.resize(500, 600)
|
||||||
|
# self.tab_widget = QTabWidget()
|
||||||
|
# self.tab_widget.setStyleSheet('background-color:#f3f3f3')
|
||||||
|
# self.tab_widget.addTab(LoginWidget('NextCloud'), 'NextCloud')
|
||||||
|
# self.tab_widget.addTab(LoginWidget('JianGuoYun'), '坚果云')
|
||||||
|
# self.tab_widget.addTab(LoginWidget('WebDav'), 'WebDav')
|
||||||
|
#
|
||||||
|
# # print('open new window')
|
||||||
|
# # self.stack_widget = QStackedWidget()
|
||||||
|
# # self.show()
|
||||||
|
# layout.addWidget(self.tab_widget)
|
||||||
|
|
||||||
|
|
||||||
class User(QLabel):
|
class User(QLabel):
|
||||||
|
@ -31,9 +50,15 @@ class User(QLabel):
|
||||||
self.user_name = QLabel("本地账号")
|
self.user_name = QLabel("本地账号")
|
||||||
self.user_name.setObjectName('user_name')
|
self.user_name.setObjectName('user_name')
|
||||||
self.user_mail = QLabel('未同步')
|
self.user_mail = QLabel('未同步')
|
||||||
# self.user_mail.setObjectName('user_mail')
|
|
||||||
|
# 读取文件内容
|
||||||
|
self.account = read_init_file()
|
||||||
|
if self.account:
|
||||||
|
self.user_name.setText(self.account[1])
|
||||||
|
self.user_mail.setText(self.account[3])
|
||||||
|
# self.user_mail.setObjectName('user_mail')
|
||||||
self.user_mail.setStyleSheet('font-size:14px')
|
self.user_mail.setStyleSheet('font-size:14px')
|
||||||
# self.menu_label = QLabel('')
|
# self.menu_label = QLabel('')type
|
||||||
# self.menu_label.setObjectName('menu')
|
# self.menu_label.setObjectName('menu')
|
||||||
# self.menu_label.setPixmap(
|
# self.menu_label.setPixmap(
|
||||||
# QPixmap(os.path.abspath('../') + '/images/up-down.svg').scaled(20, 20, Qt.IgnoreAspectRatio,
|
# QPixmap(os.path.abspath('../') + '/images/up-down.svg').scaled(20, 20, Qt.IgnoreAspectRatio,
|
||||||
|
@ -71,7 +96,10 @@ class User(QLabel):
|
||||||
self.context_menu.addAction(QIcon(os.getcwd() + '/../images/setting.svg'), '设置', self.setting)
|
self.context_menu.addAction(QIcon(os.getcwd() + '/../images/setting.svg'), '设置', self.setting)
|
||||||
|
|
||||||
self.context_menu.addAction(QIcon(os.getcwd() + '/../images/sync.svg'), '同步', self.sync)
|
self.context_menu.addAction(QIcon(os.getcwd() + '/../images/sync.svg'), '同步', self.sync)
|
||||||
self.context_menu.addAction(QIcon(os.getcwd() + '/../images/exit.svg'), '登出', self.exit_account)
|
if self.account:
|
||||||
|
self.context_menu.addAction(QIcon(os.getcwd() + '/../images/exit.svg'), '登出', self.exit_account)
|
||||||
|
else:
|
||||||
|
self.context_menu.addAction(QIcon(os.getcwd() + '/../images/login.svg'), '登录', self.login_account)
|
||||||
|
|
||||||
# todo 设置右键点击事件
|
# todo 设置右键点击事件
|
||||||
|
|
||||||
|
@ -83,3 +111,20 @@ class User(QLabel):
|
||||||
|
|
||||||
def exit_account(self):
|
def exit_account(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def login_account(self):
|
||||||
|
|
||||||
|
self.login_window = LoginWidget()
|
||||||
|
self.login_window.show()
|
||||||
|
|
||||||
|
# if __name__ == '__main__':
|
||||||
|
# app = QApplication(sys.argv)
|
||||||
|
# # 创建窗口
|
||||||
|
# window = User()
|
||||||
|
# # newWin = LoginWindow()
|
||||||
|
#
|
||||||
|
# # 显示窗口
|
||||||
|
# window.show()
|
||||||
|
# # window.collec_btn.clicked.connect(newWin.show)
|
||||||
|
# # 运行应用,并监听事件
|
||||||
|
# sys.exit(app.exec_())
|
||||||
|
|