跳转至

IT Help Desk Access Tool(PyQt5)复现与配置

更新时间:2025-11-11 作者:Lifu


概述

一款用于 IT Help Desk 服务的轻量 PyQt5 桌面应用,聚焦“账号访问开通/指引/统计”。特点: - 模块化:app/common/utils.py(纯函数与工具)、app/ui/*.py(主界面与配置界面) - 可配置:所有可配置项集中在 config/config.ini - 可回溯:运行日志 logs/app.log - 可统计:tools/stats.py 支持日志统计(有 matplotlib 则绘图,否则文本回退) - 可选 Outlook 自动化:Windows 环境下,通过 pywin32 调用 COM(可选)

目录结构

  • main.py:程序入口
  • app/
  • common/utils.py:配置 I/O、日志初始化、校验、OS/浏览器辅助
  • ui/main_window.py:主窗体(标签页、菜单、发信、时钟)
  • ui/config_window.py:配置窗体(网站/背景/快捷方式)
  • data/:默认资源
  • config/config.ini:全部配置项
  • logs/app.log:运行日志
  • tools/stats.py:日志统计

环境与依赖

Python 3.8+
PyQt5>=5.15
# 可选:
matplotlib>=3.5(统计图表)
pywin32>=306(仅 Windows;Outlook 自动化)

安装:

pip install -r requirements.txt

快速运行

python main.py

首次运行后,从“设置(Set)”菜单打开配置窗口完成各项定制。

核心配置(config/config.ini)

以下为当前项目中的关键参数与默认值摘要:

[app]
font_family = Segoe UI
font_size = 11
icon = Donut.ico
timezone_offset_hours = 8
window_width = 500
window_height = 467

[logging]
log_dir = logs
log_file = app.log

[user]
bcc_default = [REDACTED]@[REDACTED].com
bcc_enabled_default = True

[websites]
# 常用链接(键=中文/英文名称,值=URL/本地目录)
jira_办公室 = https://[REDACTED].atlassian.net/issues/?filter=18992
betelligent_后台 = https://rdai.[REDACTED].net/admin/#/admin/organization/user
betelligent_prod = https://rdai.[REDACTED].net/#/chat
betelligent_uat_后台 = https://rdai-t.[REDACTED].net/admin/#/admin/organization/user
betelligent_uat = https://rdai-t.[REDACTED].net/#/chat
netskope = C:\Users\YourName\OneDrive - [REDACTED]\Plan\03Betelligent账号\Netskope Fix Script
keep_awake = C:\Users\YourName\clock\keep_awake_gui.py  # 快速保持唤醒

[sendmail]
shortcut_label = Netskope问题排查
shortcut_cmd = C:\Users\YourName\OneDrive - [REDACTED]\Plan\03Betelligent账号\Netskope Fix Script

[background]
mode = color          # color / image
color = #00aaff
image =               # 可留空
layout = center
brightness = 1.00

[teams]
message_text = Hi, Betelligent access has been granted.\nPlease try to visit https://rdai.[REDACTED].net/#/chat.\nI will send the user manual to your email later.

[maintenance]
welcome_text = hi,我是 Betelligent 管理员,您当前是否无法访问?\n请协助我查看您电脑的 Netskope 插件状态,\n右键单击托盘图标,确认是否为“3个绿灯”。
default_image = C:/Users/YourName/brandnew 0926/Netskope Fix Script/3333.png
tbd_text = 请先下载此工具到桌面,双击运行,\n然后再次检查 Netskope 是否为“3个绿灯”,以及 Betelligent 是否可正常访问。
default_directory = C:/Users/YourName/brandnew 0926/Netskope Fix Script

说明: - websites:支持同时配置网页与本地目录/脚本路径;UI 中会生成快捷入口 - sendmail:用于“问题排查”类一键邮件/脚本入口 - background:支持纯色与图片背景;可调亮度与布局 - maintenance:用于“维修/排查”Tab 的引导文案与默认图片/目录

一键复现(建议)

cd C:\Users\YourName\brandnew 0926
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python main.py

常见问题

  • 未安装 matplotlib:statistics 仅输出文本与简单 ASCII 图
  • 无 Outlook 桌面版或未安装 pywin32:发信相关功能自动降级/不可用
  • 字体/图标找不到:请确认 app/data 与工作目录一致;或将 icon 改为绝对路径