1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-18 23:43:02 +08:00

feat(ALConfigWidget): 集成浏览器驱动自动下载功能到配置界面

This commit is contained in:
2026-03-21 00:55:09 +08:00
parent afa1d39051
commit aef28b6d5e
2 changed files with 209 additions and 161 deletions
+17
View File
@@ -29,6 +29,7 @@ from gui.resources.ui.Ui_ALConfigWidget import Ui_ALConfigWidget
from gui.ALSeatMapSelectDialog import ALSeatMapSelectDialog from gui.ALSeatMapSelectDialog import ALSeatMapSelectDialog
from gui.ALSeatMapTable import ALSeatMapTable from gui.ALSeatMapTable import ALSeatMapTable
from gui.ALUserTreeWidget import ALUserTreeWidget, ALUserTreeItemType from gui.ALUserTreeWidget import ALUserTreeWidget, ALUserTreeItemType
from gui.ALWebDriverDownloadDialog import ALWebDriverDownloadDialog
class ALConfigWidget(QWidget, Ui_ALConfigWidget): class ALConfigWidget(QWidget, Ui_ALConfigWidget):
@@ -80,6 +81,7 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
self.AddUserButton.clicked.connect(self.onAddUserButtonClicked) self.AddUserButton.clicked.connect(self.onAddUserButtonClicked)
self.DelUserButton.clicked.connect(self.onDelUserButtonClicked) self.DelUserButton.clicked.connect(self.onDelUserButtonClicked)
self.BrowseBrowserDriverButton.clicked.connect(self.onBrowseBrowserDriverButtonClicked) self.BrowseBrowserDriverButton.clicked.connect(self.onBrowseBrowserDriverButtonClicked)
self.AutoDownloadWebDriverButton.clicked.connect(self.onAutoDownloadWebDriverButtonClicked)
self.BrowseCurrentRunConfigButton.clicked.connect(self.onBrowseCurrentRunConfigButtonClicked) self.BrowseCurrentRunConfigButton.clicked.connect(self.onBrowseCurrentRunConfigButtonClicked)
self.BrowseCurrentUserConfigButton.clicked.connect(self.onBrowseCurrentUserConfigButtonClicked) self.BrowseCurrentUserConfigButton.clicked.connect(self.onBrowseCurrentUserConfigButtonClicked)
self.BrowseExportRunConfigButton.clicked.connect(self.onBrowseExportRunConfigButtonClicked) self.BrowseExportRunConfigButton.clicked.connect(self.onBrowseExportRunConfigButtonClicked)
@@ -948,6 +950,21 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
if browser_driver_path: if browser_driver_path:
self.BrowseBrowserDriverEdit.setText(QDir.toNativeSeparators(browser_driver_path)) self.BrowseBrowserDriverEdit.setText(QDir.toNativeSeparators(browser_driver_path))
@Slot()
def onAutoDownloadWebDriverButtonClicked(
self
):
dialog = ALWebDriverDownloadDialog(self)
dialog.show()
dialog.exec_()
selected_driver_info = dialog.getSelectedDriverInfo()
if selected_driver_info and selected_driver_info.driver_path:
self.BrowserTypeComboBox.setCurrentText(selected_driver_info.driver_type.value)
self.BrowseBrowserDriverEdit.setText(QDir.toNativeSeparators(str(selected_driver_info.driver_path)))
@Slot() @Slot()
def onBrowseCurrentRunConfigButtonClicked( def onBrowseCurrentRunConfigButtonClicked(
self self
+196 -165
View File
@@ -1233,12 +1233,31 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QGroupBox" name="BrowserConfigGroupBox"> <widget class="QFrame" name="SystemConfigSpaceFrame">
<property name="title"> <property name="minimumSize">
<string>浏览器设置</string> <size>
<width>0</width>
<height>270</height>
</size>
</property> </property>
<layout class="QVBoxLayout" name="BrowserConfigLayout"> <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 row="1" column="1" colspan="2">
<widget class="QGroupBox" name="RunModeConfigGroupBox">
<property name="title">
<string>运行模式</string>
</property>
<layout class="QVBoxLayout" name="RunModeConfigLayout">
<property name="spacing"> <property name="spacing">
<number>5</number> <number>5</number>
</property> </property>
@@ -1255,162 +1274,59 @@
<number>3</number> <number>3</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="BrowserTypeLabel"> <widget class="QCheckBox" name="AutoReserveCheckBox">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>100</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>100</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>浏览器类型:</string> <string>自动预约</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="BrowserTypeComboBox"> <widget class="QCheckBox" name="AutoCheckinCheckBox">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>100</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>100</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;脚本运行使用的浏览器类型&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentText">
<string>edge</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="maxVisibleItems">
<number>3</number>
</property>
<property name="maxCount">
<number>3</number>
</property>
<item>
<property name="text">
<string>edge</string>
</property>
</item>
<item>
<property name="text">
<string>chrome</string>
</property>
</item>
<item>
<property name="text">
<string>firefox</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="BrowserDriverLabel">
<property name="minimumSize">
<size>
<width>80</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>驱动路径:</string> <string>自动签到</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="BrowserDriverLayout"> <widget class="QCheckBox" name="AutoRenewalCheckBox">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QLineEdit" name="BrowseBrowserDriverEdit">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>250</width> <width>100</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>300</width> <width>100</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;详情请参阅 &lt;a href=&quot;https://www.autolibrary.kenanzhu.com/manuals&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#69fcff;&quot;&gt;用户手册&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BrowseBrowserDriverButton">
<property name="minimumSize">
<size>
<width>35</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>35</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>...</string> <string>自动续约</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="HeadlessCheckBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;运行时不显示浏览器&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>无头模式</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -1529,15 +1445,12 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="2"> <item row="1" column="0">
<widget class="QGroupBox" name="RunModeConfigGroupBox"> <widget class="QGroupBox" name="BrowserConfigGroupBox">
<property name="title"> <property name="title">
<string>运行模式</string> <string>浏览器设置</string>
</property>
<layout class="QVBoxLayout" name="RunModeConfigLayout">
<property name="spacing">
<number>5</number>
</property> </property>
<layout class="QGridLayout" name="BrowserConfigLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>3</number> <number>3</number>
</property> </property>
@@ -1550,83 +1463,201 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>3</number> <number>3</number>
</property> </property>
<item> <property name="spacing">
<widget class="QCheckBox" name="AutoReserveCheckBox"> <number>5</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="BrowserTypeLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>80</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>80</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>自动预约</string> <string>浏览器类型:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="BrowserTypeComboBox">
<property name="minimumSize">
<size>
<width>80</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;脚本运行使用的浏览器类型&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentText">
<string>edge</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="maxVisibleItems">
<number>3</number>
</property>
<property name="maxCount">
<number>3</number>
</property>
<item>
<property name="text">
<string>edge</string>
</property>
</item>
<item>
<property name="text">
<string>chrome</string>
</property>
</item>
<item>
<property name="text">
<string>firefox</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="BrowserDriverLabel">
<property name="minimumSize">
<size>
<width>175</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>175</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>驱动路径:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="BrowserDriverLayout">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QLineEdit" name="BrowseBrowserDriverEdit">
<property name="minimumSize">
<size>
<width>250</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;详情请参阅 &lt;a href=&quot;https://www.autolibrary.kenanzhu.com/manuals&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#69fcff;&quot;&gt;用户手册&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="AutoCheckinCheckBox"> <widget class="QPushButton" name="BrowseBrowserDriverButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>35</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>35</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>自动签到</string> <string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="AutoRenewalCheckBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>自动续约</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
<item row="2" column="0"> <item row="4" column="0">
<widget class="QFrame" name="SystemConfigSpaceFrame"> <widget class="QCheckBox" name="HeadlessCheckBox">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>270</height> <height>25</height>
</size> </size>
</property> </property>
<property name="frameShape"> <property name="maximumSize">
<enum>QFrame::Shape::NoFrame</enum> <size>
<width>16777215</width>
<height>25</height>
</size>
</property> </property>
<property name="frameShadow"> <property name="toolTip">
<enum>QFrame::Shadow::Plain</enum> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;运行时不显示浏览器&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="lineWidth"> <property name="whatsThis">
<number>0</number> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text">
<string>无头模式</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="AutoDownloadWebDriverButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>25</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string>自动下载驱动</string>
</property>
<property name="icon">
<iconset theme="document-properties"/>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>