优化部分不必要的包
This commit is contained in:
parent
2495d81e1c
commit
f6345e7739
11 changed files with 19 additions and 64 deletions
|
@ -117,7 +117,7 @@ class MainWidget(QWidget):
|
|||
# 二级菜单
|
||||
action1 = QAction(QIcon(os.getcwd() + '/../images/icon/星宿.svg'), "星宿", self)
|
||||
action2 = QAction(QIcon(os.getcwd() + '/../images/icon/度假.svg'), "度假", self)
|
||||
action3 = QAction(QIcon(os.getcwd() + '/../images/icon/冰淇淋.svg'), "冰淇淋", self)
|
||||
action3 = QAction(QIcon(os.getcwd() + '/../images/icon/冰淇淋.svg'), "美食", self)
|
||||
action4 = QAction(QIcon(os.getcwd() + '/../images/icon/学习.svg'), "学习", self)
|
||||
action5 = QAction(QIcon(os.getcwd() + '/../images/icon/工作.svg'), "工作", self)
|
||||
action6 = QAction(QIcon(os.getcwd() + '/../images/icon/购物.svg'), "购物", self)
|
||||
|
|
|
@ -3,7 +3,6 @@ import json
|
|||
import os
|
||||
import platform
|
||||
from datetime import datetime
|
||||
import configparser
|
||||
|
||||
|
||||
def return_work_dir():
|
||||
|
|
|
@ -5,15 +5,7 @@ from datetime import datetime
|
|||
|
||||
from utils import BasicUtils
|
||||
|
||||
"""
|
||||
todo : 暂时创建单个文件存储该列表下所有待办事项,文件命名为 {uuid}.otl
|
||||
同级还有 library.json 存储该列表信息
|
||||
上一级创建一个配置文件,里边保存“我的一天”、“重要” 的 列表uuid/待办事项uuid
|
||||
始终还是要读取文件,选择尽量少的读取和写入
|
||||
(可以尝试在待办事项添加 isMyDay属性和isImportant属性)
|
||||
"""
|
||||
|
||||
# class CreateToDo:
|
||||
"""
|
||||
:param item_type: 创建的类型,为ToDo和ToDoList
|
||||
:param name: 要创建的ToDoList名字
|
||||
|
@ -30,7 +22,6 @@ def CreateToDo(item_type, name, todo_list_uid=None):
|
|||
default_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
print('<CreateToDo>' + uid)
|
||||
if item_type == 'ToDoList':
|
||||
# print(item_type)
|
||||
try:
|
||||
"""
|
||||
createdAt : 创建时间
|
||||
|
@ -40,7 +31,6 @@ def CreateToDo(item_type, name, todo_list_uid=None):
|
|||
title : 标题
|
||||
updatedAt : 最后一次更新时间
|
||||
"""
|
||||
# os.mkdir(todo_list_path)
|
||||
out_config = {
|
||||
"createdAt": default_time,
|
||||
"dueTo": '',
|
||||
|
@ -52,10 +42,6 @@ def CreateToDo(item_type, name, todo_list_uid=None):
|
|||
"icon": '星宿',
|
||||
"updatedAt": default_time
|
||||
}
|
||||
# library = {
|
||||
# "title": name,
|
||||
# "uid": uid
|
||||
# }
|
||||
with open(todo_list_path + '{' + uid + '}.otl', 'w') as f:
|
||||
f.write(json.dumps(out_config, indent=4, ensure_ascii=False))
|
||||
# json.dump(out_config, f)
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
import os
|
||||
from webdav4.fsspec import WebdavFileSystem
|
||||
import configparser
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, QThread
|
||||
from utils.BasicUtils import read_init_file, return_work_dir
|
||||
from webdav4.client import HTTPError, Client
|
||||
|
||||
|
||||
|
@ -13,7 +9,7 @@ class LinkTest(QThread):
|
|||
super(LinkTest, self).__init__()
|
||||
|
||||
def check(self, address, name, password):
|
||||
# print(address, name, password)
|
||||
|
||||
try:
|
||||
client = Client(base_url=address,
|
||||
auth=(name, password), timeout=5000)
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import os
|
||||
from webdav4.fsspec import WebdavFileSystem
|
||||
import configparser
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, QThread
|
||||
from utils.BasicUtils import read_init_file, return_work_dir, return_config_dir
|
||||
from webdav4.client import HTTPError, Client
|
||||
|
||||
|
||||
class Sync(QThread):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtWidgets import QLabel, QLineEdit, QHBoxLayout
|
||||
from PyQt5.QtGui import QPixmap
|
||||
from PyQt5.QtCore import Qt, pyqtSignal
|
||||
|
||||
|
|
|
@ -2,12 +2,14 @@ import os
|
|||
import sys
|
||||
import time
|
||||
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtGui import QFont, QPixmap, QIcon
|
||||
from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout,
|
||||
QListWidget, QLabel, QMenu, QAction,
|
||||
QDialog, QLineEdit, QPushButton)
|
||||
from PyQt5.QtCore import Qt, pyqtSignal
|
||||
|
||||
from utils.BasicUtils import load_myday_important, remove_todo_list, change_value, get_todo, get_myday_important_conf, \
|
||||
change_myday_important_conf
|
||||
from utils.BasicUtils import (load_myday_important, remove_todo_list,
|
||||
change_value, get_todo, get_myday_important_conf, change_myday_important_conf)
|
||||
from utils.CreateToDo import CreateToDo
|
||||
from view.AddToDoLabel import AddToDoAction
|
||||
from view.ToDoItem import ToDoItem
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from view.UI_Tips import Ui_Dialog
|
||||
from PyQt5.QtWidgets import QApplication, QDialog
|
||||
from PyQt5.QtCore import Qt, QTimer, QRect
|
||||
import sys
|
||||
|
||||
|
||||
# 创建静态变量的装饰器,参考 https://www.jianshu.com/p/3ed1037b7c18
|
||||
|
@ -13,7 +12,6 @@ def static_vars(**kwargs):
|
|||
|
||||
return decorate
|
||||
|
||||
|
||||
class TipUi(QDialog):
|
||||
def __init__(self, text: str, parent=None):
|
||||
# 设置ui
|
||||
|
@ -58,9 +56,3 @@ class TipUi(QDialog):
|
|||
def show_tip(text):
|
||||
TipUi.show_tip.tip = TipUi(text)
|
||||
TipUi.show_tip.tip.show()
|
||||
|
||||
#
|
||||
# if __name__ == '__main__':
|
||||
# app = QApplication(sys.argv)
|
||||
# TipUi.show_tip('连接成功!')
|
||||
# sys.exit(app.exec_())
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import os
|
||||
import time
|
||||
|
||||
from PyQt5 import QtGui
|
||||
from PyQt5.QtCore import Qt, pyqtSignal
|
||||
from PyQt5.QtGui import QPixmap, QIcon
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtWidgets import QListWidgetItem, QWidget, QHBoxLayout, QPushButton, QLabel
|
||||
from PyQt5.QtCore import Qt
|
||||
|
||||
from utils.BasicUtils import change_value
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import os
|
||||
import time
|
||||
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtGui import QFont, QPixmap, QIcon
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QListWidget, QLabel, QPushButton, QMenu, QAction, \
|
||||
QLineEdit, QDialog
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, QPropertyAnimation, QRect, QEasingCurve
|
||||
|
||||
from utils.BasicUtils import get_todo, change_value, load_value, remove_todo_list
|
||||
|
@ -132,17 +133,6 @@ class ToDoList(QWidget):
|
|||
self.todo_list.customContextMenuRequested.connect(self.todo_list_context)
|
||||
self.load_theme()
|
||||
|
||||
#
|
||||
# def initUI(self):
|
||||
# # 读取配置文件添加Todo
|
||||
# # thread_action = ThreadAction()
|
||||
# self.todo_list.clear()
|
||||
#
|
||||
# load_todo = get_todo(self.uid)
|
||||
# if load_todo:
|
||||
# for load in load_todo:
|
||||
# self.load_todo(load[0], load[1])
|
||||
|
||||
def load_theme(self):
|
||||
theme = str(load_value(self.uid, 'Theme'))
|
||||
self.setStyleSheet('#todolist{background-image:url("../images/' + theme + '.jpg");'
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import os
|
||||
from PyQt5.QtCore import Qt, pyqtSignal
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
import configparser
|
||||
from utils.BasicUtils import *
|
||||
from PyQt5.QtGui import QPixmap, QIcon
|
||||
from PyQt5.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout, QMenu, QWidget
|
||||
from utils.BasicUtils import read_init_file, return_work_dir
|
||||
from utils.CreateConfigure import CreateConfigure
|
||||
from utils.Sync import Sync
|
||||
from view.LoginWidget import LoginWidget
|
||||
|
@ -19,7 +19,6 @@ class User(QLabel):
|
|||
self.widget = QWidget(self)
|
||||
self.widget.setMaximumWidth(300)
|
||||
self.setObjectName('User')
|
||||
# todo:修改布局使适合微软todo的样式,设置点击事件,使用右键菜单的样式添加设置、同步、退出,暂时就这样
|
||||
|
||||
layout = QHBoxLayout()
|
||||
info_layout = QVBoxLayout()
|
||||
|
@ -57,6 +56,8 @@ class User(QLabel):
|
|||
self.user_mail.setText('未同步')
|
||||
# self.user_mail.setObjectName('user_mail')
|
||||
|
||||
# 设置右键菜单
|
||||
self.context_menu = QMenu(self)
|
||||
# 背景透明
|
||||
self.context_menu.setAttribute(Qt.WA_TranslucentBackground)
|
||||
# 无边框、去掉自带阴影
|
||||
|
@ -74,8 +75,6 @@ class User(QLabel):
|
|||
def contextMenuEvent(self, event):
|
||||
self.context_menu.exec_(event.globalPos())
|
||||
|
||||
# todo 设置右键点击事件
|
||||
|
||||
def setting(self):
|
||||
self.setting_widget = SettingWidget()
|
||||
self.setting_widget.show()
|
||||
|
@ -101,7 +100,6 @@ class User(QLabel):
|
|||
def exit_account(self):
|
||||
|
||||
config_path = return_work_dir() + 'PyQtToDoList.ini'
|
||||
# print(config_path)
|
||||
try:
|
||||
if os.path.exists(config_path):
|
||||
os.remove(config_path)
|
||||
|
@ -109,7 +107,6 @@ class User(QLabel):
|
|||
except Exception as e:
|
||||
print(e)
|
||||
self.update_signal.emit()
|
||||
pass
|
||||
|
||||
def login_account(self):
|
||||
self.login_window = LoginWidget()
|
||||
|
|
Loading…
Reference in a new issue