refactor(配置管理): 将playwright配置替换为chrome路径配置并更新使用说明
更新配置管理器、主窗口界面和使用说明文档,将原有的playwright目录配置改为chrome浏览器路径配置
This commit is contained in:
@@ -153,15 +153,15 @@ class ConfigDialog(QDialog):
|
||||
layout.addRow("User Agent:", self.user_agent_edit)
|
||||
layout.addRow("刷新间隔(s):", self.interval_spin)
|
||||
|
||||
# Playwright目录配置
|
||||
playwright_dir_layout = QHBoxLayout()
|
||||
self.playwright_dir_edit = QLineEdit(spider_config.get('playwright_dir', ''))
|
||||
self.playwright_dir_edit.setPlaceholderText("留空则自动查找Playwright浏览器")
|
||||
self.playwright_browse_btn = QPushButton("浏览...")
|
||||
self.playwright_browse_btn.clicked.connect(self._browse_playwright_dir)
|
||||
playwright_dir_layout.addWidget(self.playwright_dir_edit)
|
||||
playwright_dir_layout.addWidget(self.playwright_browse_btn)
|
||||
layout.addRow("Playwright目录:", playwright_dir_layout)
|
||||
# Chrome浏览器路径配置
|
||||
chrome_path_layout = QHBoxLayout()
|
||||
self.chrome_path_edit = QLineEdit(spider_config.get('chrome_path', ''))
|
||||
self.chrome_path_edit.setPlaceholderText("留空则自动查找Chrome浏览器")
|
||||
self.chrome_browse_btn = QPushButton("浏览...")
|
||||
self.chrome_browse_btn.clicked.connect(self._browse_chrome_path)
|
||||
chrome_path_layout.addWidget(self.chrome_path_edit)
|
||||
chrome_path_layout.addWidget(self.chrome_browse_btn)
|
||||
layout.addRow("Chrome路径:", chrome_path_layout)
|
||||
|
||||
# UI 配置
|
||||
ui_config = self.config_manager.ui_config
|
||||
@@ -196,16 +196,16 @@ class ConfigDialog(QDialog):
|
||||
button_box.rejected.connect(self.reject)
|
||||
layout.addRow(button_box)
|
||||
|
||||
def _browse_playwright_dir(self):
|
||||
"""浏览Playwright目录"""
|
||||
directory = QFileDialog.getExistingDirectory(
|
||||
def _browse_chrome_path(self):
|
||||
"""浏览Chrome路径"""
|
||||
file_path, _ = QFileDialog.getOpenFileName(
|
||||
self,
|
||||
"选择Playwright浏览器目录",
|
||||
"选择Chrome浏览器可执行文件",
|
||||
"",
|
||||
QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks
|
||||
"Chrome浏览器 (*.exe);;所有文件 (*.*)"
|
||||
)
|
||||
if directory:
|
||||
self.playwright_dir_edit.setText(directory)
|
||||
if file_path:
|
||||
self.chrome_path_edit.setText(file_path)
|
||||
|
||||
def _save_config(self):
|
||||
"""保存配置"""
|
||||
@@ -223,7 +223,7 @@ class ConfigDialog(QDialog):
|
||||
xpath=self.xpath_edit.text(),
|
||||
user_agent=self.user_agent_edit.text(),
|
||||
fetch_interval=self.interval_spin.value(),
|
||||
playwright_dir=self.playwright_dir_edit.text()
|
||||
chrome_path=self.chrome_path_edit.text()
|
||||
)
|
||||
|
||||
# UI
|
||||
|
||||
Reference in New Issue
Block a user