From c325b5d1bc42d8fe04447ff65753bc46442cd88e Mon Sep 17 00:00:00 2001 From: liqi Date: Sun, 8 Jun 2025 23:09:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v1/main.py | 473 ++++++++++++++-------------------------- v1/styles/styles.py | 403 ++++++++++++++++++++-------------- v1/views/app_center.py | 229 +++++++++---------- v1/views/login.py | 2 +- v1/views/word_to_pdf.py | 15 +- 5 files changed, 514 insertions(+), 608 deletions(-) diff --git a/v1/main.py b/v1/main.py index edd9e10..f052cc9 100644 --- a/v1/main.py +++ b/v1/main.py @@ -1,335 +1,157 @@ import sys -from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget, QHBoxLayout, QWidget, QMessageBox -from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget, QHBoxLayout, QWidget, QMessageBox, QPushButton, \ + QLabel, QVBoxLayout, QFrame, QSizePolicy +from PyQt5.QtCore import Qt, QPoint from views.login import LoginPage from views.nav import NavBar from views.home import Home from views.word_to_pdf import WordToPDFPage +from views.pdf_tools_page import PDFToolsPage from views.app_center import AppCenter from views.history import HistoryPage -from PyQt5.QtGui import QPalette, QColor +from PyQt5.QtGui import QPalette, QColor, QFont -# 优化的暗色主题样式表 -STYLES_TXT = """ -/* ===== 全局样式 ===== */ -QWidget { - font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; - font-size: 14px; - color: #e2e8f0; - border: none; -} +from styles.styles import STYLES_TXT -/* 输入框 */ -QLineEdit { - background-color: #2d3748; - border: 1px solid #4a5568; - border-radius: 6px; - padding: 10px; - color: #e2e8f0; - min-height: 40px; -} -QLineEdit:focus { - border-color: #818cf8; - outline: none; -} +class CustomTitleBar(QWidget): + """自定义标题栏控件""" -/* ===== 按钮全局样式 ===== */ -QPushButton { - background-color: #4f46e5; - color: white; - border-radius: 8px; /* 增加圆角程度 */ - padding: 10px 16px; - min-height: 40px; /* 增加高度 */ - font-weight: 500; - transition: all 0.2s ease; - border: none; - outline: none; /* 防止点击时出现虚线边框 */ -} + def __init__(self, parent=None): + super().__init__(parent) + self.parent = parent + self.setMouseTracking(True) + self.drag_position = QPoint() + self.setObjectName("customTitleBar") + self.init_ui() -QPushButton:hover { - background-color: #4338ca; - transform: translateY(-2px); - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); -} + def init_ui(self): + """初始化标题栏UI""" + layout = QHBoxLayout(self) + layout.setContentsMargins(15, 8, 15, 8) + layout.setSpacing(12) -QPushButton:pressed { - background-color: #3730a3; - transform: translateY(0); - box-shadow: none; -} + # 添加应用图标和标题 + self.title_label = QLabel("奶酪云工具箱") + self.title_label.setObjectName("titleLabel") + self.title_label.setFont(QFont("Microsoft YaHei UI", 12, QFont.Bold)) + self.title_label.setAlignment(Qt.AlignCenter) -QPushButton:disabled { - background-color: #4a5568; - color: #a0aec0; -} + # 添加拖拽区域(占位区域) + self.drag_area = QWidget() + self.drag_area.setObjectName("dragArea") + self.drag_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) -/* 特殊按钮样式 */ -QPushButton#navBtn { - text-align: left; - padding: 12px 25px; - color: #a0aec0; - border-radius: 8px; - margin: 5px 15px; - font-size: 14px; - background-color: transparent; - border: none; - min-height: auto; /* 覆盖全局最小高度 */ -} + # 添加窗口控制按钮 + self.minimize_btn = QPushButton("—") + self.minimize_btn.setObjectName("minimizeBtn") + self.minimize_btn.setFixedSize(30, 30) + self.minimize_btn.clicked.connect(lambda: self.parent.showMinimized()) -QPushButton#navBtn:hover { - background-color: rgba(79, 70, 229, 0.1); - color: #cbd5e0; -} + self.maximize_btn = QPushButton("□") + self.maximize_btn.setObjectName("maximizeBtn") + self.maximize_btn.setFixedSize(30, 30) + self.maximize_btn.clicked.connect(self.toggle_maximize) -QPushButton#navBtn.active { - background-color: rgba(79, 70, 229, 0.15); - color: #818cf8; - font-weight: 500; -} + self.close_btn = QPushButton("×") + self.close_btn.setObjectName("closeBtn") + self.close_btn.setFixedSize(30, 30) + self.close_btn.clicked.connect(self.parent.close) -QPushButton#logoutBtn { - text-align: left; - padding: 12px 25px; - border-radius: 8px; - margin: 5px 15px; - font-size: 14px; - color: #feb2b2; - background-color: transparent; - border: none; - min-height: auto; /* 覆盖全局最小高度 */ -} + # 将控件添加到布局中 + layout.addWidget(self.title_label) + layout.addWidget(self.drag_area) + layout.addWidget(self.minimize_btn) + layout.addWidget(self.maximize_btn) + layout.addWidget(self.close_btn) -QPushButton#logoutBtn:hover { - color: #f56565; -} + def toggle_maximize(self): + """切换窗口最大化/正常状态""" + if self.parent.isMaximized(): + self.parent.showNormal() + self.maximize_btn.setText("□") + else: + self.parent.showMaximized() + self.maximize_btn.setText("⬜") -/* 操作按钮样式 */ -QPushButton#actionBtn { - background-color: rgba(129, 140, 248, 0.1); - color: #818cf8; - border: 1px solid rgba(129, 140, 248, 0.2); - min-height: auto; /* 覆盖全局最小高度 */ -} + def mousePressEvent(self, event): + """鼠标按下事件处理""" + if event.button() == Qt.LeftButton: + self.drag_position = event.globalPos() - self.parent.frameGeometry().topLeft() + event.accept() -QPushButton#actionBtn:hover { - background-color: rgba(129, 140, 248, 0.2); -} + def mouseMoveEvent(self, event): + """鼠标移动事件处理""" + if event.buttons() == Qt.LeftButton: + self.parent.move(event.globalPos() - self.drag_position) + event.accept() -QPushButton#retryBtn { - background-color: rgba(251, 113, 133, 0.1); - color: #fb7185; - border: 1px solid rgba(251, 113, 133, 0.2); - min-height: auto; /* 覆盖全局最小高度 */ -} - -QPushButton#retryBtn:hover { - background-color: rgba(251, 113, 133, 0.2); -} - -QPushButton#deleteBtn { - background-color: rgba(120, 113, 108, 0.1); - color: #a8a29e; - border: 1px solid rgba(120, 113, 108, 0.2); - min-height: auto; /* 覆盖全局最小高度 */ -} - -QPushButton#deleteBtn:hover { - background-color: rgba(120, 113, 108, 0.2); -} - -/* 卡片按钮样式 */ -QPushButton#appCardBtn { - min-height: auto; /* 覆盖全局最小高度 */ - min-width: 120px; -} - -/* 登录页面按钮 */ -QPushButton#loginBtn { - min-height: auto; /* 覆盖全局最小高度 */ - min-width: 240px; - padding: 14px 30px; - font-size: 16px; -} - -/* 列表控件 */ -QListWidget { - background-color: #2d3748; - border: 1px solid #4a5568; - border-radius: 8px; - padding: 4px; - color: #e2e8f0; - outline: none; -} - -QListWidget::item { - padding: 8px 12px; - border-bottom: 1px solid #4a5568; -} - -QListWidget::item:selected { - background-color: rgba(129, 140, 248, 0.15); - color: #e2e8f0; - border-radius: 4px; -} - -/* 滚动条 */ -QScrollBar:vertical { - background: #2d3748; - width: 10px; - border: none; -} - -QScrollBar::handle:vertical { - background: #4a5568; - min-height: 20px; - border-radius: 4px; -} - -QScrollBar::handle:vertical:hover { - background: #718096; -} - -QScrollBar::add-line:vertical, -QScrollBar::sub-line:vertical { - height: 0; -} - -QScrollBar::add-page:vertical, -QScrollBar::sub-page:vertical { - background: none; -} - -/* 标签 */ -QLabel { - color: #e2e8f0; - background-color: transparent; -} - -/* 菜单栏 */ -/* 导航栏 */ -#navBar { - background-color: #1a202c; - border-right: 1px solid #2d3748; -} - -/* 用户卡片 */ -#userCard { - background-color: #2d3748; - border-radius: 8px; - margin: 15px; - padding: 15px; -} - -/* 导航按钮 */ -#navBtn { - text-align: left; - padding: 12px 25px; - color: #a0aec0; - border-radius: 8px; - margin: 5px 15px; - font-size: 14px; - background-color: transparent; - border: none; -} - -#navBtn:hover { - background-color: rgba(79, 70, 229, 0.1); - color: #cbd5e0; -} - -#navBtn.active { - background-color: rgba(79, 70, 229, 0.15); - color: #818cf8; - font-weight: 500; -} - -/* 退出按钮 */ -#logoutBtn { - text-align: left; - padding: 12px 25px; - border-radius: 8px; - margin: 5px 15px; - font-size: 14px; - color: #feb2b2; - background-color: transparent; - border: none; -} - -#logoutBtn:hover { - color: #f56565; -} - -/* 分割线 */ -QFrame[frameShape="4"] { /* HLine */ - background-color: #2d3748; - margin: 10px 15px; - max-height: 1px; -} - -/* 进度条 */ -QProgressBar { - border-radius: 4px; - height: 8px; - background-color: #2d3748; - border: 1px solid #4a5568; - text-align: center; -} - -QProgressBar::chunk { - background-color: #4f46e5; - border-radius: 4px; -} - -/* 复选框 */ -QCheckBox { - color: #e2e8f0; - spacing: 8px; -} - -QCheckBox::indicator { - width: 16px; - height: 16px; - border: 1px solid #4a5568; - border-radius: 3px; - background-color: #2d3748; -} - -QCheckBox::indicator:checked { - background-color: #4f46e5; - border: 1px solid #4f46e5; -} - -/* 分组框 */ -QGroupBox { - font-weight: bold; - background-color: #2d3748; - border: 1px solid #4a5568; - border-radius: 8px; - margin-top: 1.5ex; - padding-top: 10px; -} - -QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top left; - background-color: transparent; - padding: 0 3px; - left: 9px; -} -""" + def mouseDoubleClickEvent(self, event): + """鼠标双击事件处理""" + if event.button() == Qt.LeftButton: + self.toggle_maximize() + event.accept() class MainWindow(QMainWindow): def __init__(self): super().__init__() self.username = None + self.setWindowFlag(Qt.FramelessWindowHint) # 设置为无边框窗口 self.init_ui() def init_ui(self): self.setWindowTitle("文档处理工具") self.setGeometry(100, 100, 1200, 800) - self.setStyleSheet(STYLES_TXT) + + # 添加自定义标题栏样式 + titlebar_styles = """ + /* 自定义标题栏样式 */ + #customTitleBar { + background-color: #1a202c; + border-bottom: 1px solid #2d3748; + height: 50px; + } + + #titleLabel { + color: #cbd5e0; + font-size: 16px; + font-weight: bold; + } + + #dragArea { + background-color: transparent; + } + + QPushButton#minimizeBtn, + QPushButton#maximizeBtn, + QPushButton#closeBtn { + background-color: transparent; + border: none; + border-radius: 4px; + font-size: 14px; + color: #a0aec0; + padding: 0; + } + + QPushButton#minimizeBtn:hover, + QPushButton#maximizeBtn:hover { + background-color: rgba(74, 85, 104, 0.3); + color: #e2e8f0; + } + + QPushButton#closeBtn:hover { + background-color: rgba(254, 178, 178, 0.3); + color: #f56565; + } + + /* 窗口边框效果 */ + #mainWidget { + border: 1px solid #2d3748; + } + """ + # 合并样式表 + self.setStyleSheet(STYLES_TXT + titlebar_styles) # 设置暗色主题调色板 palette = QPalette() @@ -351,10 +173,29 @@ class MainWindow(QMainWindow): # 主窗口部件 self.main_widget = QWidget() - self.main_layout = QHBoxLayout(self.main_widget) + self.main_widget.setObjectName("mainWidget") + self.main_layout = QVBoxLayout(self.main_widget) self.main_layout.setContentsMargins(0, 0, 0, 0) self.main_layout.setSpacing(0) + # 添加自定义标题栏 + self.title_bar = CustomTitleBar(self) + self.main_layout.addWidget(self.title_bar) + + # 添加分隔线 + separator = QFrame() + separator.setFrameShape(QFrame.HLine) + separator.setFrameShadow(QFrame.Sunken) + separator.setMaximumHeight(1) + separator.setStyleSheet("background-color: #2d3748;") + self.main_layout.addWidget(separator) + + # 主内容区域 + content_widget = QWidget() + content_layout = QHBoxLayout(content_widget) + content_layout.setContentsMargins(0, 0, 0, 0) + content_layout.setSpacing(0) + # 导航栏 (初始隐藏) self.nav_bar = NavBar("") self.nav_bar.setObjectName("navBar") @@ -381,10 +222,13 @@ class MainWindow(QMainWindow): # Word转PDF页 self.word_to_pdf = WordToPDFPage() + # Word转PDF页 + self.pdf_tools_page = PDFToolsPage() + # 使用记录页 self.history_page = HistoryPage() - # 设置页(待实现) + # 设置页(占位) self.settings_page = QWidget() self.settings_page.setObjectName("settingsPage") @@ -393,17 +237,26 @@ class MainWindow(QMainWindow): self.stacked_pages.addWidget(self.app_center) self.stacked_pages.addWidget(self.home) self.stacked_pages.addWidget(self.word_to_pdf) + self.stacked_pages.addWidget(self.pdf_tools_page) self.stacked_pages.addWidget(self.history_page) self.stacked_pages.addWidget(self.settings_page) - # 主布局 - self.main_layout.addWidget(self.nav_bar) - self.main_layout.addWidget(self.stacked_pages, 1) # 设置弹性因子为1 + # 主内容布局 + content_layout.addWidget(self.nav_bar) + content_layout.addWidget(self.stacked_pages, 1) + + # 添加到主布局 + self.main_layout.addWidget(content_widget, 1) self.setCentralWidget(self.main_widget) + # 鼠标悬停在边缘时的调整光标 + self.setMouseTracking(True) + def handle_login_success(self, username): self.username = username + # 更新标题栏显示 + self.title_bar.title_label.setText(f"文档处理工具 - 欢迎 {username}") # 更新导航栏用户信息 self.nav_bar.username = username self.nav_bar.show() @@ -415,6 +268,8 @@ class MainWindow(QMainWindow): self.username = None self.nav_bar.hide() self.stacked_pages.setCurrentWidget(self.login_page) + # 重置标题栏 + self.title_bar.title_label.setText("文档处理工具") def handle_nav_click(self, nav_id): # 确保导航栏状态更新 @@ -434,17 +289,15 @@ class MainWindow(QMainWindow): try: if app_id == "word_to_pdf": self.stacked_pages.setCurrentWidget(self.word_to_pdf) + elif app_id == "pdf_tools_page": + print('1') + self.stacked_pages.setCurrentWidget(self.pdf_tools_page) elif app_id == "history": - # 注意:这里假设历史记录页面尚未开发,暂时显示word_to_pdf页面 - # 实际开发中应替换为正确的历史记录页面 self.stacked_pages.setCurrentWidget(self.word_to_pdf) else: - # 未开发的应用:弹出提示弹窗 self.show_development_popup(app_id) except Exception as e: - # 捕获并打印异常信息,避免程序闪退 print(f"处理应用选择时发生错误: {e}") - # 可以选择显示错误弹窗 QMessageBox.critical(self, "错误", f"发生错误: {str(e)}", QMessageBox.Button.Ok) def show_development_popup(self, app_id): @@ -476,4 +329,4 @@ def main(): if __name__ == "__main__": - main() + main() \ No newline at end of file diff --git a/v1/styles/styles.py b/v1/styles/styles.py index 12130cb..7e68fe1 100644 --- a/v1/styles/styles.py +++ b/v1/styles/styles.py @@ -1,223 +1,172 @@ -styles_txt = """ -/* 全局样式 */ +# 优化的暗色主题样式表 +STYLES_TXT = """ +/* ===== 全局样式 ===== */ QWidget { font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; font-size: 14px; color: #e2e8f0; + border: none; } -/* 登录页面 */ -#loginPage { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #667eea, stop:1 #764ba2); -} - -#loginCard { - background-color: rgba(255, 255, 255, 0.9); - border-radius: 12px; - box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); -} - -#loginTitle { - font-size: 28px; - font-weight: bold; - color: #2d3748; -} - -#formLabel { - font-size: 14px; - font-weight: 600; - color: #4a5568; -} - -#formInput { - background-color: #edf2f7; - border: 1px solid #e2e8f0; +/* 输入框 */ +QLineEdit { + background-color: #2d3748; + border: 1px solid #4a5568; border-radius: 6px; padding: 10px; - color: #2d3748; + color: #e2e8f0; + min-height: 40px; } -#formInput:focus { - border-color: #667eea; +QLineEdit:focus { + border-color: #818cf8; + outline: none; } -#loginBtn { +/* ===== 按钮全局样式 ===== */ +QPushButton { background-color: #4f46e5; color: white; - border-radius: 6px; - padding: 12px; - font-weight: bold; + border-radius: 8px; /* 增加圆角程度 */ + padding: 10px 16px; + min-height: 40px; /* 增加高度 */ + font-weight: 500; + transition: all 0.2s ease; + border: none; + outline: none; /* 防止点击时出现虚线边框 */ } -#loginBtn:hover { +QPushButton:hover { background-color: #4338ca; + transform: translateY(-2px); + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } -/* 导航栏 */ -#navBar { - background-color: #1a202c; +QPushButton:pressed { + background-color: #3730a3; + transform: translateY(0); + box-shadow: none; } -#userFrame { - background-color: #2d3748; - border-radius: 8px; -} - -#userName { - font-size: 16px; - font-weight: bold; - color: white; -} - -#navBtn { - text-align: left; - padding: 12px 20px; - border-radius: 6px; +QPushButton:disabled { + background-color: #4a5568; color: #a0aec0; } -#navBtn:hover { - background-color: #2d3748; - color: white; -} - -#logoutBtn { +/* 特殊按钮样式 */ +QPushButton#navBtn { text-align: left; - padding: 12px 20px; - border-radius: 6px; - color: #e53e3e; + padding: 12px 25px; + color: #a0aec0; + border-radius: 8px; + margin: 5px 15px; + font-size: 14px; + background-color: transparent; + border: none; + min-height: auto; /* 覆盖全局最小高度 */ } -#logoutBtn:hover { - background-color: #2d3748; +QPushButton#navBtn:hover { + background-color: rgba(79, 70, 229, 0.1); + color: #cbd5e0; +} + +QPushButton#navBtn.active { + background-color: rgba(79, 70, 229, 0.15); + color: #818cf8; + font-weight: 500; +} + +QPushButton#logoutBtn { + text-align: left; + padding: 12px 25px; + border-radius: 8px; + margin: 5px 15px; + font-size: 14px; + color: #feb2b2; + background-color: transparent; + border: none; + min-height: auto; /* 覆盖全局最小高度 */ +} + +QPushButton#logoutBtn:hover { color: #f56565; } -/* 应用中心 */ -#appCenter { - background-color: #1a202c; +/* 操作按钮样式 */ +QPushButton#actionBtn { + background-color: rgba(129, 140, 248, 0.1); + color: #818cf8; + border: 1px solid rgba(129, 140, 248, 0.2); + min-height: auto; /* 覆盖全局最小高度 */ } -#pageTitle { - font-size: 24px; - font-weight: bold; - color: white; +QPushButton#actionBtn:hover { + background-color: rgba(129, 140, 248, 0.2); } -#appCard { - border-radius: 12px; - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); - transition: transform 0.2s; +QPushButton#retryBtn { + background-color: rgba(251, 113, 133, 0.1); + color: #fb7185; + border: 1px solid rgba(251, 113, 133, 0.2); + min-height: auto; /* 覆盖全局最小高度 */ } -#appCard:hover { - transform: translateY(-5px); +QPushButton#retryBtn:hover { + background-color: rgba(251, 113, 133, 0.2); } -/* Word转PDF页面 */ -#wordToPdfPage { - background-color: #1a202c; +QPushButton#deleteBtn { + background-color: rgba(120, 113, 108, 0.1); + color: #a8a29e; + border: 1px solid rgba(120, 113, 108, 0.2); + min-height: auto; /* 覆盖全局最小高度 */ } -#leftPanel, #rightPanel { +QPushButton#deleteBtn:hover { + background-color: rgba(120, 113, 108, 0.2); +} + +/* 卡片按钮样式 */ +QPushButton#appCardBtn { + min-height: auto; /* 覆盖全局最小高度 */ + min-width: 120px; +} + +/* 登录页面按钮 */ +QPushButton#loginBtn { + min-height: auto; /* 覆盖全局最小高度 */ + min-width: 240px; + padding: 14px 30px; + font-size: 16px; +} + +/* 列表控件 */ +QListWidget { background-color: #2d3748; - border-radius: 12px; - padding: 20px; -} - -#uploadArea { - border: 2px dashed #4a5568; - border-radius: 8px; - background-color: rgba(74, 85, 104, 0.2); -} - -#uploadArea:hover { - border-color: #667eea; - background-color: rgba(102, 126, 234, 0.1); -} - -#uploadBtn { - background-color: #4f46e5; - color: white; - border-radius: 6px; - padding: 8px 16px; -} - -#uploadBtn:hover { - background-color: #4338ca; -} - -#fileList, #resultList, #logContent { - background-color: #1a202c; border: 1px solid #4a5568; border-radius: 8px; - padding: 8px; + padding: 4px; + color: #e2e8f0; + outline: none; } -#convertBtn { - background-color: #4CAF50; - color: white; - border-radius: 6px; - padding: 8px 16px; -} - -#convertBtn:hover { - background-color: #3d8b40; -} - -#deleteBtn { - background-color: #f44336; - color: white; - border-radius: 6px; - padding: 8px 16px; -} - -#deleteBtn:hover { - background-color: #d32f2f; -} - -#downloadBtn { - background-color: #2196F3; - color: white; - border-radius: 6px; - padding: 8px 16px; -} - -#downloadBtn:hover { - background-color: #1976d2; -} - -#logArea { - background-color: #1a202c; - border-radius: 8px; - padding: 12px; -} - -#logTitle { - font-size: 16px; - font-weight: bold; - color: white; - padding-bottom: 8px; +QListWidget::item { + padding: 8px 12px; border-bottom: 1px solid #4a5568; } -QProgressBar { - border-radius: 4px; - height: 8px; - background-color: #4a5568; -} - -QProgressBar::chunk { - background-color: #4f46e5; +QListWidget::item:selected { + background-color: rgba(129, 140, 248, 0.15); + color: #e2e8f0; border-radius: 4px; } /* 滚动条 */ QScrollBar:vertical { - border: none; background: #2d3748; width: 10px; - margin: 0; + border: none; } QScrollBar::handle:vertical { @@ -230,11 +179,131 @@ QScrollBar::handle:vertical:hover { background: #718096; } -QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { +QScrollBar::add-line:vertical, +QScrollBar::sub-line:vertical { height: 0; } -QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { +QScrollBar::add-page:vertical, +QScrollBar::sub-page:vertical { background: none; } + +/* 标签 */ +QLabel { + color: #e2e8f0; + background-color: transparent; +} + +/* 菜单栏 */ +/* 导航栏 */ +#navBar { + background-color: #1a202c; + border-right: 1px solid #2d3748; +} + +/* 用户卡片 */ +#userCard { + background-color: #2d3748; + border-radius: 8px; + margin: 15px; + padding: 15px; +} + +/* 导航按钮 */ +#navBtn { + text-align: left; + padding: 12px 25px; + color: #a0aec0; + border-radius: 8px; + margin: 5px 15px; + font-size: 14px; + background-color: transparent; + border: none; +} + +#navBtn:hover { + background-color: rgba(79, 70, 229, 0.1); + color: #cbd5e0; +} + +#navBtn.active { + background-color: rgba(79, 70, 229, 0.15); + color: #818cf8; + font-weight: 500; +} + +/* 退出按钮 */ +#logoutBtn { + text-align: left; + padding: 12px 25px; + border-radius: 8px; + margin: 5px 15px; + font-size: 14px; + color: #feb2b2; + background-color: transparent; + border: none; +} + +#logoutBtn:hover { + color: #f56565; +} + +/* 分割线 */ +QFrame[frameShape="4"] { /* HLine */ + background-color: #2d3748; + margin: 10px 15px; + max-height: 1px; +} + +/* 进度条 */ +QProgressBar { + border-radius: 4px; + height: 8px; + background-color: #2d3748; + border: 1px solid #4a5568; + text-align: center; +} + +QProgressBar::chunk { + background-color: #4f46e5; + border-radius: 4px; +} + +/* 复选框 */ +QCheckBox { + color: #e2e8f0; + spacing: 8px; +} + +QCheckBox::indicator { + width: 16px; + height: 16px; + border: 1px solid #4a5568; + border-radius: 3px; + background-color: #2d3748; +} + +QCheckBox::indicator:checked { + background-color: #4f46e5; + border: 1px solid #4f46e5; +} + +/* 分组框 */ +QGroupBox { + font-weight: bold; + background-color: #2d3748; + border: 1px solid #4a5568; + border-radius: 8px; + margin-top: 1.5ex; + padding-top: 10px; +} + +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + background-color: transparent; + padding: 0 3px; + left: 9px; +} """ \ No newline at end of file diff --git a/v1/views/app_center.py b/v1/views/app_center.py index e3f530a..551d510 100644 --- a/v1/views/app_center.py +++ b/v1/views/app_center.py @@ -853,7 +853,7 @@ class AppCenter(QWidget): "desc": "批量将Word文档转换为PDF格式", "color": ("#6366F1", "#4F46E5"), "icon": "word_to_pdf", - "author": "李明", + "author": "年糕崽崽", "upload_time": "2023-06-15", "version": "1.2.0", "category": "文档处理", @@ -865,46 +865,12 @@ class AppCenter(QWidget): ] }, { - "id": "ocr", - "title": "OCR文字识别", - "desc": "从图片中提取文字内容", - "color": ("#4ADE80", "#22C55E"), - "icon": "ocr", - "author": "张伟", - "upload_time": "2023-07-22", - "version": "2.0.1", - "category": "图像处理", - "features": [ - "支持多种图片格式", - "识别准确率高", - "支持多语言识别", - "导出为可编辑文本" - ] - }, - { - "id": "image_convert", - "title": "图片格式转换", - "desc": "转换图像文件格式并优化", - "color": ("#F97316", "#EA580C"), - "icon": "image_convert", - "author": "王芳", - "upload_time": "2023-08-10", - "version": "1.5.3", - "category": "图像处理", - "features": [ - "支持JPEG、PNG、WEBP等格式", - "批量转换功能", - "图片压缩优化", - "保持图片质量" - ] - }, - { - "id": "pdf_merge", - "title": "PDF合并工具", + "id": "pdf_tools_page", + "title": "PDF合并/拆分工具", "desc": "合并多个PDF文件为一个", "color": ("#8B5CF6", "#7C3AED"), "icon": "pdf_merge", - "author": "刘强", + "author": "年糕崽崽", "upload_time": "2023-09-05", "version": "极速版1.1.0", "category": "文档处理", @@ -915,91 +881,108 @@ class AppCenter(QWidget): "支持大文件处理" ] }, - { - "id": "pdf_split", - "title": "PDF拆分工具", - "desc": "拆分PDF文件为多个文档", - "color": ("#EC4899", "#DB2777"), - "icon": "pdf_split", - "author": "陈晓", - "upload_time": "2023-09-18", - "version": "1.0.5", - "category": "文档处理", - "features": [ - "按页码拆分PDF", - "按书签拆分PDF", - "自定义拆分范围", - "批量处理多个文件" - ] - }, - { - "id": "video_compress", - "title": "视频压缩", - "desc": "减小视频文件大小", - "color": ("#3B82F6", "#2563EB"), - "icon": "video_compress", - "author": "赵雷", - "upload_time": "2023-10-02", - "version": "1.3.2", - "category": "媒体工具", - "features": [ - "支持多种视频格式", - "自定义压缩参数", - "保持视频质量", - "批量处理功能" - ] - }, - { - "id": "audio_extract", - "title": "音频提取", - "desc": "从视频中提取音频", - "color": ("#06B6D4", "#0891B2"), - "icon": "audio_extract", - "author": "杨帆", - "upload_time": "2023-10-15", - "version": "1.0.2", - "category": "媒体工具", - "features": [ - "支持常见视频格式", - "无损音频提取", - "批量处理功能", - "转换速度快" - ] - }, - { - "id": "text_summary", - "title": "文本摘要", - "desc": "自动提取文章关键信息", - "color": ("#F59E0B", "#D97706"), - "icon": "text_summary", - "author": "周华", - "upload_time": "2023-10-28", - "version": "2.1.0", - "category": "文档处理", - "features": [ - "多种摘要算法可选", - "自定义摘要长度", - "支持多语言处理", - "处理结果可导出" - ] - }, - { - "id": "color_picker", - "title": "颜色提取器", - "desc": "从图像中提取配色方案", - "color": ("#EC4899", "#DB2777"), - "icon": "color_picker", - "author": "吴敏", - "upload_time": "2023-11-05", - "version": "1.0.0", - "category": "图像处理", - "features": [ - "自动分析主色调", - "提取多种配色方案", - "支持导出配色代码", - "直观的颜色展示" - ] - } + # { + # "id": "ocr", + # "title": "OCR文字识别", + # "desc": "从图片中提取文字内容", + # "color": ("#4ADE80", "#22C55E"), + # "icon": "ocr", + # "author": "张伟", + # "upload_time": "2023-07-22", + # "version": "2.0.1", + # "category": "图像处理", + # "features": [ + # "支持多种图片格式", + # "识别准确率高", + # "支持多语言识别", + # "导出为可编辑文本" + # ] + # }, + # { + # "id": "image_convert", + # "title": "图片格式转换", + # "desc": "转换图像文件格式并优化", + # "color": ("#F97316", "#EA580C"), + # "icon": "image_convert", + # "author": "王芳", + # "upload_time": "2023-08-10", + # "version": "1.5.3", + # "category": "图像处理", + # "features": [ + # "支持JPEG、PNG、WEBP等格式", + # "批量转换功能", + # "图片压缩优化", + # "保持图片质量" + # ] + # }, + # { + # "id": "video_compress", + # "title": "视频压缩", + # "desc": "减小视频文件大小", + # "color": ("#3B82F6", "#2563EB"), + # "icon": "video_compress", + # "author": "赵雷", + # "upload_time": "2023-10-02", + # "version": "1.3.2", + # "category": "媒体工具", + # "features": [ + # "支持多种视频格式", + # "自定义压缩参数", + # "保持视频质量", + # "批量处理功能" + # ] + # }, + # { + # "id": "audio_extract", + # "title": "音频提取", + # "desc": "从视频中提取音频", + # "color": ("#06B6D4", "#0891B2"), + # "icon": "audio_extract", + # "author": "杨帆", + # "upload_time": "2023-10-15", + # "version": "1.0.2", + # "category": "媒体工具", + # "features": [ + # "支持常见视频格式", + # "无损音频提取", + # "批量处理功能", + # "转换速度快" + # ] + # }, + # { + # "id": "text_summary", + # "title": "文本摘要", + # "desc": "自动提取文章关键信息", + # "color": ("#F59E0B", "#D97706"), + # "icon": "text_summary", + # "author": "周华", + # "upload_time": "2023-10-28", + # "version": "2.1.0", + # "category": "文档处理", + # "features": [ + # "多种摘要算法可选", + # "自定义摘要长度", + # "支持多语言处理", + # "处理结果可导出" + # ] + # }, + # { + # "id": "color_picker", + # "title": "颜色提取器", + # "desc": "从图像中提取配色方案", + # "color": ("#EC4899", "#DB2777"), + # "icon": "color_picker", + # "author": "吴敏", + # "upload_time": "2023-11-05", + # "version": "1.0.0", + # "category": "图像处理", + # "features": [ + # "自动分析主色调", + # "提取多种配色方案", + # "支持导出配色代码", + # "直观的颜色展示" + # ] + # } ] diff --git a/v1/views/login.py b/v1/views/login.py index 3f5291a..fec5d66 100644 --- a/v1/views/login.py +++ b/v1/views/login.py @@ -155,7 +155,7 @@ class LoginPage(QWidget): logo_label.setPixmap(logo_pixmap) logo_label.setAlignment(Qt.AlignCenter) - title_label = QLabel("文档处理中心") + title_label = QLabel("奶酪云工具箱") title_label.setObjectName("titleLabel") title_label.setAlignment(Qt.AlignCenter) diff --git a/v1/views/word_to_pdf.py b/v1/views/word_to_pdf.py index 267a90b..c2df61f 100644 --- a/v1/views/word_to_pdf.py +++ b/v1/views/word_to_pdf.py @@ -1,12 +1,13 @@ -import os -import comtypes.client -import random import datetime +import os +import random + +import comtypes.client +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer +from PyQt5.QtGui import QPixmap, QDragEnterEvent, QDropEvent, QDragLeaveEvent from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QFrame, QListWidget, QListWidgetItem, - QFileDialog, QProgressBar, QMessageBox, QSpacerItem) -from PyQt5.QtCore import Qt, QThread, pyqtSignal, QSize, QTimer -from PyQt5.QtGui import QPixmap, QIcon, QDragEnterEvent, QDropEvent, QDragLeaveEvent + QFileDialog, QProgressBar) def generate_unique_filename(original_path): @@ -653,4 +654,4 @@ class WordToPDFPage(QWidget): else: self.findChild(QFrame, "uploadArea").setProperty("hover", False) self.findChild(QFrame, "uploadArea").style().polish(self.findChild(QFrame, "uploadArea")) - super().paintEvent(event) \ No newline at end of file + super().paintEvent(event)