refactor(配置管理): 将playwright配置替换为chrome路径配置并更新使用说明
更新配置管理器、主窗口界面和使用说明文档,将原有的playwright目录配置改为chrome浏览器路径配置
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
---
|
||||
name: pyinstaller-one
|
||||
description: 用pyinstaller打包,执行这个技能。
|
||||
description: 用pyinstaller打包时,执行这个技能。
|
||||
---
|
||||
|
||||
## 元数据
|
||||
name: pyinstaller个性化打包
|
||||
description: 打包的时候,要求生成为一个exe文件,使用ico等等
|
||||
|
||||
## 概述
|
||||
此 Skill 用于给有GUI界面的python代码,打包的时候,生成一个统一的要求:生成一个exe文件,去掉控制台窗口,使用本目录下的ico文件作为程序的图标。打包时,如果之前有打包过的文件(dist/build 文件夹),自动覆盖旧文件,不用手动确认,一键打包到底。
|
||||
|
||||
## 打包命令示例
|
||||
pyinstaller --onefile --noconsole --icon=图标文件名.ico --distpath=. --hidden-import=PySide6.Qt6Compat python程序名.py
|
||||
|
||||
## 清除多余文件
|
||||
在windows环境下,执行clean.py
|
||||
## 元数据
|
||||
name: pyinstaller个性化打包
|
||||
description: 打包的时候,要求生成为一个exe文件,使用ico等等
|
||||
|
||||
## 概述
|
||||
此 Skill 用于给有GUI界面的python代码,打包的时候,生成一个统一的要求:生成一个exe文件,去掉控制台窗口,使用本目录下的ico文件作为程序的图标。打包时,如果之前有打包过的文件(dist/build 文件夹),自动覆盖旧文件,不用手动确认,一键打包到底。
|
||||
|
||||
## 打包命令示例
|
||||
pyinstaller --onefile --noconsole --icon=图标文件名.ico --distpath=. --hidden-import=PySide6.Qt6Compat python程序名.py
|
||||
|
||||
## 清除多余文件
|
||||
在windows环境下,执行clean.py。
|
||||
@@ -26,7 +26,7 @@ class ConfigManager:
|
||||
"fetch_interval": 60,
|
||||
"retry_times": 3,
|
||||
"retry_interval": 5,
|
||||
"playwright_dir": ""
|
||||
"chrome_path": ""
|
||||
},
|
||||
"ui": {
|
||||
"opacity": 0.9,
|
||||
@@ -133,7 +133,7 @@ class ConfigManager:
|
||||
def update_spider(self, target_url: str = None, xpath: str = None,
|
||||
user_agent: str = None, fetch_interval: int = None,
|
||||
retry_times: int = None, retry_interval: int = None,
|
||||
playwright_dir: str = None):
|
||||
chrome_path: str = None):
|
||||
"""更新爬虫配置"""
|
||||
if target_url:
|
||||
self.config["spider"]["target_url"] = target_url
|
||||
@@ -147,8 +147,8 @@ class ConfigManager:
|
||||
self.config["spider"]["retry_times"] = retry_times
|
||||
if retry_interval:
|
||||
self.config["spider"]["retry_interval"] = retry_interval
|
||||
if playwright_dir:
|
||||
self.config["spider"]["playwright_dir"] = playwright_dir
|
||||
if chrome_path:
|
||||
self.config["spider"]["chrome_path"] = chrome_path
|
||||
logger.info("爬虫配置已更新")
|
||||
self.save_config()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
49
使用说明.md
Normal file
49
使用说明.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# 股吧人气指示器 - 使用说明
|
||||
|
||||
## 系统要求
|
||||
- Windows 10/11 操作系统
|
||||
- Google Chrome 浏览器 (推荐最新版本)
|
||||
|
||||
## Chrome浏览器配置
|
||||
|
||||
### 1. 下载Chrome浏览器
|
||||
如果您还没有安装Chrome浏览器,请按照以下步骤下载:
|
||||
1. 打开网址:https://www.google.cn/chrome/
|
||||
2. 点击"下载Chrome"
|
||||
3. 运行下载的安装程序并按照提示完成安装
|
||||
|
||||
### 2. 找到Chrome可执行文件路径
|
||||
|
||||
#### 方法1:通过开始菜单查找
|
||||
1. 打开开始菜单,找到Google Chrome
|
||||
2. 右键点击,选择"打开文件所在位置"
|
||||
3. 在打开的文件夹中,找到`chrome.exe`文件
|
||||
4. 右键点击`chrome.exe`,选择"属性"
|
||||
5. 在"快捷方式"标签页中,"目标"字段显示了完整的路径
|
||||
|
||||
#### 方法2:默认安装路径
|
||||
- 32位系统:`C:\Program Files\Google\Chrome\Application\chrome.exe`
|
||||
- 64位系统:`C:\Program Files (x86)\Google\Chrome\Application\chrome.exe`
|
||||
|
||||
### 3. 在应用程序中配置Chrome路径
|
||||
1. 打开股吧人气指示器
|
||||
2. 点击"配置"按钮
|
||||
3. 在"Chrome路径"字段中输入找到的Chrome可执行文件路径
|
||||
4. 点击"确定"保存配置
|
||||
|
||||
## 常见问题
|
||||
|
||||
### Q: 应用程序无法运行?
|
||||
A: 请确保您的Windows系统已安装最新的.NET Framework和Visual C++ Redistributable。
|
||||
|
||||
### Q: 无法生成截图?
|
||||
A: 请检查:
|
||||
1. Chrome浏览器是否正常安装
|
||||
2. Chrome路径是否正确配置
|
||||
3. 网络连接是否正常
|
||||
|
||||
### Q: 如何更新Chrome浏览器?
|
||||
A: 打开Chrome浏览器,点击右上角的三个点 → "帮助" → "关于Google Chrome",Chrome会自动检查并更新到最新版本。
|
||||
|
||||
## 联系信息
|
||||
如遇到其他问题,请联系开发者。
|
||||
Reference in New Issue
Block a user