mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-17 23:13:03 +08:00
refactor(gui): 重构关于对话框,改用 QTabWidget 分页展示信息与许可证
将原本的单页文本浏览器替换为 TabWidget,分"关于"和"许可证"两个标签页。 同时优化了信息排版和样式,新增 Selenium 版本展示,移除了 UI 文件中的旧控件。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+81
-31
@@ -16,11 +16,16 @@ from PySide6.QtCore import (
|
|||||||
from PySide6.QtGui import QIcon
|
from PySide6.QtGui import QIcon
|
||||||
from PySide6.QtWidgets import (
|
from PySide6.QtWidgets import (
|
||||||
QApplication,
|
QApplication,
|
||||||
QDialog
|
QDialog,
|
||||||
|
QTabWidget,
|
||||||
|
QTextBrowser
|
||||||
)
|
)
|
||||||
|
|
||||||
from gui.ALVersionInfo import (
|
from gui.ALVersionInfo import (
|
||||||
AL_VERSION, AL_COMMIT_SHA, AL_COMMIT_DATE, AL_BUILD_DATE
|
AL_VERSION,
|
||||||
|
AL_COMMIT_SHA,
|
||||||
|
AL_COMMIT_DATE,
|
||||||
|
AL_BUILD_DATE
|
||||||
)
|
)
|
||||||
from gui.resources.ui.Ui_ALAboutDialog import Ui_ALAboutDialog
|
from gui.resources.ui.Ui_ALAboutDialog import Ui_ALAboutDialog
|
||||||
from gui.resources import ALResource
|
from gui.resources import ALResource
|
||||||
@@ -43,12 +48,23 @@ class ALAboutDialog(QDialog, Ui_ALAboutDialog):
|
|||||||
):
|
):
|
||||||
|
|
||||||
self.LogoIconLabel.setPixmap(QIcon(":/res/icons/AutoLibrary_Logo_64.svg").pixmap(48, 48))
|
self.LogoIconLabel.setPixmap(QIcon(":/res/icons/AutoLibrary_Logo_64.svg").pixmap(48, 48))
|
||||||
info_text = self.generateAboutText()
|
self.TabWidget = QTabWidget()
|
||||||
self.AboutInfoBrowser.setHtml(info_text)
|
self.TabWidget.setDocumentMode(True)
|
||||||
browser_font = self.AboutInfoBrowser.font()
|
AboutBrowser = QTextBrowser()
|
||||||
browser_font.setFamily("Courier New")
|
AboutBrowser.setHtml(self.generateAboutText())
|
||||||
self.AboutInfoBrowser.setFont(browser_font)
|
AboutBrowser.setOpenExternalLinks(True)
|
||||||
self.AboutInfoBrowser.setTextInteractionFlags(Qt.TextBrowserInteraction)
|
AboutBrowser.setLineWrapMode(QTextBrowser.LineWrapMode.NoWrap)
|
||||||
|
AboutBrowser.setTextInteractionFlags(Qt.TextBrowserInteraction)
|
||||||
|
BrowserFont = AboutBrowser.font()
|
||||||
|
BrowserFont.setFamilies(["Courier New", "Consolas", "Menlo", "DejaVu Sans Mono", "monospace"])
|
||||||
|
AboutBrowser.setFont(BrowserFont)
|
||||||
|
self.TabWidget.addTab(AboutBrowser, "关于")
|
||||||
|
LicenseBrowser = QTextBrowser()
|
||||||
|
LicenseBrowser.setHtml(self.generateLicenseText())
|
||||||
|
LicenseBrowser.setOpenExternalLinks(True)
|
||||||
|
LicenseBrowser.setTextInteractionFlags(Qt.TextBrowserInteraction)
|
||||||
|
self.TabWidget.addTab(LicenseBrowser, "许可证")
|
||||||
|
self.AboutInfoLayout.addWidget(self.TabWidget)
|
||||||
|
|
||||||
def connectSignals(
|
def connectSignals(
|
||||||
self
|
self
|
||||||
@@ -61,33 +77,57 @@ class ALAboutDialog(QDialog, Ui_ALAboutDialog):
|
|||||||
) -> str:
|
) -> str:
|
||||||
|
|
||||||
os_info = self.getOSInfo()
|
os_info = self.getOSInfo()
|
||||||
|
run_on = f"{os_info['system']} {os_info['version']} {os_info['architecture']}"
|
||||||
|
selenium_ver = self.getSeleniumVersion()
|
||||||
about_text = f"""
|
about_text = f"""
|
||||||
<h4>Version Information:</h4>
|
<b style="font-size:14px;">VERSION: {AL_VERSION}</b><br>
|
||||||
Version: {AL_VERSION}<br>
|
|
||||||
Commit SHA: {AL_COMMIT_SHA}<br>
|
Commit SHA: {AL_COMMIT_SHA}<br>
|
||||||
Commit date: {AL_COMMIT_DATE}<br>
|
Commit date: {AL_COMMIT_DATE}<br>
|
||||||
Build date: {AL_BUILD_DATE}<br>
|
Build date: {AL_BUILD_DATE}<br>
|
||||||
Python version: {platform.python_version()}<br>
|
<br>
|
||||||
Qt version: {self.getQtVersion()}<br>
|
<b style="font-size:14px;">SYSTEM INFORMATION</b><br>
|
||||||
|
Running on: {run_on}<br>
|
||||||
<h4>System Information:</h4>
|
|
||||||
Processor: {platform.processor()}<br>
|
Processor: {platform.processor()}<br>
|
||||||
Operating system: {os_info['system']}<br>
|
<br>
|
||||||
System version: {os_info['version']}<br>
|
<b style="font-size:14px;">DEPENDENCIES</b><br>
|
||||||
System architecture: {os_info['architecture']}<br>
|
Python: {platform.python_version()}<br>
|
||||||
|
Qt(PySide6): {self.getQtVersion()}<br>
|
||||||
<h4>Project Information:</h4>
|
Selenium: {selenium_ver}<br>
|
||||||
License: MIT License<br>
|
<br>
|
||||||
Project repository: <a href="https://www.github.com/KenanZhu/AutoLibrary" style="text-decoration: none;">https://www.github.com/KenanZhu/AutoLibrary</a><br>
|
<b style="font-size:14px;">PROJECT INFORMATION</b><br>
|
||||||
Project website: <a href="https://www.autolibrary.kenanzhu.com" style="text-decoration: none;">https://www.autolibrary.kenanzhu.com</a><br>
|
Website: <a href="https://www.autolibrary.kenanzhu.com" style="text-decoration:none;">https://www.autolibrary.kenanzhu.com</a><br>
|
||||||
|
Repository: <a href="https://www.github.com/KenanZhu/AutoLibrary" style="text-decoration:none;">https://www.github.com/KenanZhu/AutoLibrary</a><br>
|
||||||
<h4>Author Information:</h4>
|
<br>
|
||||||
Developer: KenanZhu<br>
|
<b style="font-size:14px;">AUTHOR</b><br>
|
||||||
Contact: nanoki_zh@163.com<br>
|
Developer/Maintainer: KenanZhu<br>
|
||||||
GitHub: <a href="https://www.github.com/KenanZhu" style="text-decoration: none;">https://www.github.com/KenanZhu</a><br>
|
Contact: <a href="mailto:nanoki_zh@163.com">nanoki_zh@163.com</a><br>
|
||||||
|
GitHub: <a href="https://www.github.com/KenanZhu" style="text-decoration:none;">https://www.github.com/KenanZhu</a><br>
|
||||||
"""
|
"""
|
||||||
return about_text
|
return about_text
|
||||||
|
|
||||||
|
def generateLicenseText(
|
||||||
|
self
|
||||||
|
) -> str:
|
||||||
|
|
||||||
|
return """
|
||||||
|
<b>MIT License</b>
|
||||||
|
<p>Copyright © 2025 - 2026 KenanZhu</p>
|
||||||
|
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:</p>
|
||||||
|
<p>The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.</p>
|
||||||
|
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.</p>"""
|
||||||
|
|
||||||
def getOSInfo(
|
def getOSInfo(
|
||||||
self
|
self
|
||||||
):
|
):
|
||||||
@@ -129,13 +169,23 @@ GitHub: <a href="https://www.github.com/KenanZhu" style="text-decoration: none;"
|
|||||||
except:
|
except:
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
|
|
||||||
|
def getSeleniumVersion(
|
||||||
|
self
|
||||||
|
):
|
||||||
|
|
||||||
|
try:
|
||||||
|
import selenium
|
||||||
|
return selenium.__version__
|
||||||
|
except Exception:
|
||||||
|
return "Unknown"
|
||||||
|
|
||||||
def copyAboutInfo(
|
def copyAboutInfo(
|
||||||
self
|
self
|
||||||
):
|
):
|
||||||
|
|
||||||
about_text = self.AboutInfoBrowser.toPlainText()
|
about_text = self.TabWidget.currentWidget().toPlainText()
|
||||||
clipboard = QApplication.clipboard()
|
Clipboard = QApplication.clipboard()
|
||||||
clipboard.setText(about_text)
|
Clipboard.setText(about_text)
|
||||||
original_text = self.CopyButton.text()
|
original_text = self.CopyButton.text()
|
||||||
self.CopyButton.setText("已复制")
|
self.CopyButton.setText("已复制")
|
||||||
QTimer.singleShot(2000, lambda: self.CopyButton.setText(original_text))
|
QTimer.singleShot(2000, lambda: self.CopyButton.setText(original_text))
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>400</height>
|
<height>600</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -103,53 +103,6 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QFrame" name="AboutInfoSpaceFrame">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>56</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>56</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::Shape::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Shadow::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="lineWidth">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextBrowser" name="AboutInfoBrowser">
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Shadow::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="lineWrapMode">
|
|
||||||
<enum>QTextEdit::LineWrapMode::NoWrap</enum>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="openLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user