Skip to content

cmyandlqs/sumfinder-pro

Repository files navigation

SumFinder Pro

English | 中文


中文

一款轻量级、易用的财务/数据分析辅助工具,帮助用户快速从大量数字中找出符合特定和值的组合。

功能特点

  • Excel 文件导入 - 支持拖拽或浏览导入 .xlsx/.xls 文件
  • 直接粘贴数字 - 支持从剪贴板直接粘贴数字
  • 灵活参数设置 - 可设置目标和、容差、组合数量
  • 快速查找 - 采用回溯+剪枝算法,快速定位结果
  • 结果一键复制 - 查找结果可直接复制到剪贴板
  • macOS 风格界面 - 简洁美观,操作直观

截图

┌─────────────────────────────────────────────────────────────────────────┐
│  SumFinder Pro                                                   ─ □ ×  │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  ┌───────────────────────────────────────────────────────────────────┐ │
│  │  数据输入                                                          │ │
│  │  📄 导入文件    [浏览...]    或    📋 粘贴数字                      │ │
│  └───────────────────────────────────────────────────────────────────┘ │
│                                                                         │
│  ┌───────────────────────────────────────────────────────────────────┐ │
│  │  查找参数                                                          │ │
│  │  🎯 目标和    [              ]    📏 容差    [    0.01     ]       │ │
│  │        [━━━━━━━━━━ 开始查找 ━━━━━━━━━━]                           │ │
│  └───────────────────────────────────────────────────────────────────┘ │
│                                                                         │
│  ┌───────────────────────────────────────────────────────────────────┐ │
│  │  查找结果                                                          │ │
│  │  ▸ 组合 #1: 281.64 + 150.00 + 98.50 + 33.14 = 563.28              │ │
│  └───────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘

安装运行

方式一:直接运行(需要 Python)

# 1. 克隆项目
git clone https://github.com/yourusername/sumfinder-pro.git
cd sumfinder-pro

# 2. 安装依赖
pip install -r requirements.txt

# 3. 运行
python main.py

方式二:使用打包的 exe(无需 Python)

下载 dist/SumFinderPro.exe,双击运行即可。

使用方法

Excel 文件导入

  1. 点击"浏览"按钮选择 Excel 文件,或直接拖拽文件到窗口
  2. 从下拉列表中选择要查找的列
  3. 查看预览数据,确认有效数字数量

直接粘贴数字

  1. 将数字复制到剪贴板
  2. 粘贴到"粘贴数字"输入框
  3. 支持多种分隔格式:换行、空格、逗号

设置参数并查找

  1. 输入目标和 - 你想找到的和值
  2. 设置容差 - 允许的误差范围(默认 0.01)
  3. 设置组合数量 - 要找几个不同的组合(默认 1)
  4. 点击"开始查找"

数字输入格式

# 换行分隔
24.81
24.81
25.47

# 空格分隔
24.81 24.81 25.47

# 逗号分隔
24.81, 24.81, 25.47

# 混合格式
24.81
24.81, 25.47 31.67

项目结构

sumfinder-pro/
├── main.py                 # 应用入口
├── ui/
│   ├── main_window.py      # 主窗口
│   ├── styles/             # 样式管理
│   └── widgets/            # UI 组件
│       ├── input_panel.py  # 数据输入面板
│       ├── param_panel.py  # 参数设置面板
│       └── result_panel.py # 结果展示面板
├── core/
│   ├── algorithm.py        # 查找算法
│   ├── excel_processor.py  # Excel 处理
│   └── text_parser.py      # 文本解析
├── resources/
│   └── styles/             # QSS 样式表
├── requirements.txt        # 依赖列表
└── README.md              # 说明文档

技术栈

  • Python 3.8+
  • PySide6 - Qt GUI 框架
  • pandas - 数据处理
  • openpyxl - Excel 文件读写

开发

打包

# 安装 PyInstaller
pip install pyinstaller

# 打包成单个 exe
pyinstaller --onefile --windowed --name "SumFinderPro" main.py

# 打包完成后,exe 文件位于 dist/SumFinderPro.exe

代码规范

# 使用 ruff 进行代码检查和格式化
pip install ruff
ruff check .
ruff format .

算法说明

采用回溯+剪枝算法

  1. 数字按绝对值降序排序,优先尝试大数便于剪枝
  2. 使用前缀和预计算,快速判断剩余数能否达到目标
  3. 三种剪枝策略:
    • 当前和超过目标 → 剪枝
    • 剩余数不足以达到目标 → 剪枝
    • 跳过重复数字 → 避免重复搜索

许可证

MIT License

更新日志

v1.0.0 (2026-03-03)

  • 初始版本发布
  • 支持 Excel 导入和直接粘贴
  • macOS 风格界面
  • 多组合查找功能

English

A lightweight and user-friendly financial/data analysis tool that helps users quickly find number combinations that sum to a specific target value.

Features

  • Excel Import - Drag & drop or browse to import .xlsx/.xls files
  • Direct Paste - Paste numbers directly from clipboard
  • Flexible Parameters - Set target sum, tolerance, and combination count
  • Fast Search - Backtracking with pruning algorithm for quick results
  • One-Click Copy - Copy search results directly to clipboard
  • macOS-Style UI - Clean, beautiful, and intuitive interface

Installation

Method 1: Run from Source (Requires Python)

# 1. Clone the project
git clone https://github.com/yourusername/sumfinder-pro.git
cd sumfinder-pro

# 2. Install dependencies
pip install -r requirements.txt

# 3. Run
python main.py

Method 2: Use Packaged exe (No Python Required)

Download dist/SumFinderPro.exe and double-click to run.

Usage

Excel File Import

  1. Click "Browse" to select an Excel file, or drag & drop the file
  2. Select the column to search from the dropdown
  3. Preview the data and confirm the valid number count

Direct Paste

  1. Copy numbers to clipboard
  2. Paste into the "Paste Numbers" input box
  3. Supports multiple delimiters: newline, space, comma

Set Parameters and Search

  1. Enter Target Sum - The sum value you want to find
  2. Set Tolerance - Allowed error range (default 0.01)
  3. Set Combination Count - Number of different combinations to find (default 1)
  4. Click "Start Search"

Number Input Format

# Newline separated
24.81
24.81
25.47

# Space separated
24.81 24.81 25.47

# Comma separated
24.81, 24.81, 25.47

# Mixed format
24.81
24.81, 25.47 31.67

Project Structure

sumfinder-pro/
├── main.py                 # Application entry point
├── ui/
│   ├── main_window.py      # Main window
│   ├── styles/             # Style management
│   └── widgets/            # UI components
├── core/
│   ├── algorithm.py        # Search algorithm
│   ├── excel_processor.py  # Excel processing
│   └── text_parser.py      # Text parsing
├── resources/
│   └── styles/             # QSS stylesheets
├── requirements.txt        # Dependencies
└── README.md              # Documentation

Tech Stack

  • Python 3.8+
  • PySide6 - Qt GUI framework
  • pandas - Data processing
  • openpyxl - Excel file I/O

Development

Building

# Install PyInstaller
pip install pyinstaller

# Package as single exe
pyinstaller --onefile --windowed --name "SumFinderPro" main.py

# The exe file will be at dist/SumFinderPro.exe

Code Formatting

# Use ruff for linting and formatting
pip install ruff
ruff check .
ruff format .

Algorithm

Uses backtracking with pruning:

  1. Sort numbers by absolute value in descending order for efficient pruning
  2. Pre-compute prefix sums for quick remaining sum checks
  3. Three pruning strategies:
    • Current sum exceeds target → prune
    • Remaining numbers insufficient → prune
    • Skip duplicate numbers → avoid duplicate searches

License

MIT License

Changelog

v1.0.0 (2026-03-03)

  • Initial release
  • Excel import and direct paste support
  • macOS-style UI
  • Multi-combination search

About

一款轻量级、易用的财务/数据分析辅助工具,帮助用户快速从大量数字中找出符合特定和值的组合。支持 Excel 文件导入和直接粘贴数字,采用回溯剪枝算法快速查找结果。A lightweight and user-friendly financial/data analysis tool that helps users quickly find number combinations that sum to a specific target value. Supports Excel file import and direct paste, with fast backtracking algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages