Skip to content

Commit 02d082b

Browse files
michaelbeijerclaude
andcommitted
fix: F&R case handling, correct version in standalone builds (#163, #165) (v1.9.274)
- Disable QCompleter on F&R HistoryComboBox so uppercase history entries no longer overwrite lowercase input (#163) - Bundle pyproject.toml in PyInstaller builds so _read_version() finds the correct version instead of falling back to a stale hardcoded string (#165) - Add importlib.metadata fallback in _read_version() for pip installs - Fix create_release_zip.py to read version from pyproject.toml directly - Make macOS spec read CFBundleVersion dynamically from pyproject.toml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5db91a3 commit 02d082b

File tree

9 files changed

+51
-19
lines changed

9 files changed

+51
-19
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22

33
All notable changes to Supervertaler are documented in this file.
44

5-
**Current Version:** v1.9.273 (February 17, 2026)
5+
**Current Version:** v1.9.274 (February 17, 2026)
66

77

8+
## v1.9.274 - February 17, 2026
9+
10+
### Bug Fixes
11+
12+
- **Find & Replace: uppercase history no longer overwrites lowercase input** — The `HistoryComboBox` in the F&R dialog had an auto-created `QCompleter` with case-insensitive matching, which forced previously searched uppercase terms (e.g. "COMMISSIONING") over lowercase input. Disabled the completer; the dropdown history is still accessible via the arrow button. Resolves [#163](https://github.com/michaelbeijer/Supervertaler/issues/163).
13+
- **Standalone builds now show the correct version number** — PyInstaller `.exe` builds always displayed "v1.9.227" because `pyproject.toml` was not bundled, causing `_read_version()` to fall back to a hardcoded string. Fixed by: (1) adding `pyproject.toml` to the `datas` list in both Windows and macOS `.spec` files, (2) adding an `importlib.metadata` fallback for `pip install` users, (3) fixing `create_release_zip.py` to read the version from `pyproject.toml` instead of regex-parsing `Supervertaler.py`, and (4) making the macOS `.spec` read `CFBundleVersion` dynamically from `pyproject.toml` instead of a hardcoded stale value. Resolves [#165](https://github.com/michaelbeijer/Supervertaler/issues/165).
14+
15+
---
16+
817
## v1.9.273 - February 17, 2026
918

1019
### Bug Fixes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
**Professional AI-enhanced translation workbench** with multi-LLM support (GPT-4, Claude, Gemini, Ollama), translation memory, glossary management, and seamless CAT tool integration (memoQ, Trados, CafeTran, Phrase, Déjà Vu).
88

9-
**Latest release:** v1.9.273 - Fix TM matches not showing when revisiting segments.
9+
**Latest release:** v1.9.274 - Fix F&R case handling, correct version display in standalone builds.
1010

1111
---
1212

Supervertaler.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,28 @@
3333

3434
# Version Information — read from pyproject.toml (single source of truth)
3535
def _read_version():
36-
"""Read version from pyproject.toml so there's only one place to update."""
36+
"""Read version from pyproject.toml, importlib.metadata, or hardcoded fallback."""
3737
import os as _os
38+
# 1. Try pyproject.toml (works in dev mode and PyInstaller builds that bundle it)
3839
try:
39-
import tomllib
40-
except ImportError:
4140
try:
42-
import tomli as tomllib # Python < 3.11
41+
import tomllib
4342
except ImportError:
44-
return "1.9.227" # Fallback
45-
try:
43+
import tomli as tomllib # Python < 3.11
4644
_toml_path = _os.path.join(_os.path.dirname(_os.path.abspath(__file__)), "pyproject.toml")
4745
with open(_toml_path, "rb") as f:
4846
_data = tomllib.load(f)
4947
return _data["project"]["version"]
5048
except Exception:
51-
return "1.9.227" # Fallback if running from dist without pyproject.toml
49+
pass
50+
# 2. Try importlib.metadata (works for pip install)
51+
try:
52+
from importlib.metadata import version
53+
return version("supervertaler")
54+
except Exception:
55+
pass
56+
# 3. Last-resort hardcoded fallback
57+
return "1.9.227"
5258

5359
__version__ = _read_version()
5460
__phase__ = "0.9"

Supervertaler.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ a = Analysis(
66
pathex=[],
77
binaries=[],
88
datas=[
9+
('pyproject.toml', '.'),
910
('docs', 'docs'),
1011
('modules', 'modules'),
1112
('assets', 'assets'),

Supervertaler_macOS.spec

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22
# macOS build spec for Supervertaler
33
# Usage: pyinstaller Supervertaler_macOS.spec --noconfirm --clean
44

5+
# Read version from pyproject.toml at build time
6+
try:
7+
import tomllib
8+
except ImportError:
9+
import tomli as tomllib
10+
with open('pyproject.toml', 'rb') as _f:
11+
_version = tomllib.load(_f)['project']['version']
12+
513
a = Analysis(
614
['Supervertaler.py'],
715
pathex=[],
816
binaries=[],
917
datas=[
18+
('pyproject.toml', '.'),
1019
('docs', 'docs'),
1120
('modules', 'modules'),
1221
('assets', 'assets'),
@@ -84,8 +93,8 @@ app = BUNDLE(
8493
info_plist={
8594
'CFBundleName': 'Supervertaler',
8695
'CFBundleDisplayName': 'Supervertaler',
87-
'CFBundleVersion': '1.9.254',
88-
'CFBundleShortVersionString': '1.9.254',
96+
'CFBundleVersion': _version,
97+
'CFBundleShortVersionString': _version,
8998
'NSHighResolutionCapable': True,
9099
'NSMicrophoneUsageDescription':
91100
'Supervertaler uses the microphone for voice dictation.',

create_release_zip.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,17 @@ def _ensure_readme_first(dist_dir: Path, version: str, flavor: str | None = None
4949
readme_path.write_text(text, encoding="utf-8")
5050

5151
def get_version():
52-
"""Extract version from Supervertaler.py"""
53-
with open("Supervertaler.py", "r", encoding="utf-8") as f:
54-
content = f.read()
55-
match = re.search(r'__version__\s*=\s*["\']([^"\']+)["\']', content)
56-
return match.group(1) if match else "unknown"
52+
"""Extract version from pyproject.toml (single source of truth)."""
53+
try:
54+
try:
55+
import tomllib
56+
except ImportError:
57+
import tomli as tomllib
58+
with open("pyproject.toml", "rb") as f:
59+
data = tomllib.load(f)
60+
return data["project"]["version"]
61+
except Exception:
62+
return "unknown"
5763

5864
def create_release_zip(
5965
dist_dir: Path,

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h1 class="hero-title">
7070
Supervertaler
7171
<span class="gradient-text">The Ultimate Translation Workbench</span>
7272
</h1>
73-
<p class="version-badge">v1.9.273</p>
73+
<p class="version-badge">v1.9.274</p>
7474
<p class="hero-subtitle">
7575
AI-enhanced translation workbench. Work with ChatGPT, Claude, and Gemini simultaneously.
7676
Built by translators, for translators and writers.
@@ -707,7 +707,7 @@ <h2 class="section-title">Get Supervertaler</h2>
707707
<div style="text-align: center; margin: 40px 0;">
708708
<div class="download-card featured"
709709
style="border: 3px solid #6366F1; max-width: 700px; margin: 0 auto;">
710-
<div class="download-badge" style="background: #6366F1;">v1.9.273</div>
710+
<div class="download-badge" style="background: #6366F1;">v1.9.274</div>
711711
<h3>🎨 Supervertaler</h3>
712712
<p class="download-description" style="font-weight: 600; color: #6366F1; margin-bottom: 10px;">
713713
Modern Professional Interface

modules/find_replace_qt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class HistoryComboBox(QComboBox):
146146
def __init__(self, parent=None):
147147
super().__init__(parent)
148148
self.setEditable(True)
149+
self.setCompleter(None) # Disable auto-complete (fixes #163: uppercase history overwriting lowercase input)
149150
self.setInsertPolicy(QComboBox.InsertPolicy.NoInsert)
150151
self.setMaxVisibleItems(15)
151152
self.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToContents)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "supervertaler"
7-
version = "1.9.273"
7+
version = "1.9.274"
88
description = "Professional AI-enhanced translation workbench with multi-LLM support, glossary system, TM, spellcheck, voice commands, and PyQt6 interface. Batteries included (core)."
99
readme = "README.md"
1010
requires-python = ">=3.10"

0 commit comments

Comments
 (0)