Remove Rewrite Tab

This commit is contained in:
DazedAnon 2026-06-13 18:29:07 -05:00
parent b2ef2b1d4e
commit ec5d5956a7
5 changed files with 0 additions and 1260 deletions

View file

@ -223,7 +223,6 @@ class UpdateDialog(QDialog):
from gui.config_tab import ConfigTab
from gui.translation_tab import TranslationTab
from gui.workflow_tab import WorkflowTab
from gui.rewrite_tab import RewriteTab
class DazedMTLGUI(QMainWindow):
"""Main GUI window for the DazedMTLTool."""
@ -424,13 +423,6 @@ class DazedMTLGUI(QMainWindow):
btn_config.clicked.connect(lambda: self.switch_page(2))
sidebar_layout.addWidget(btn_config)
self.nav_buttons.append(btn_config)
# Rewrite button (fourth)
btn_rewrite = self.create_nav_button("✏️", "Rewrite")
btn_rewrite.setToolTip("Rewrite — fix over-limit dialogue messages")
btn_rewrite.clicked.connect(lambda: self.switch_page(3))
sidebar_layout.addWidget(btn_rewrite)
self.nav_buttons.append(btn_rewrite)
sidebar_layout.addStretch()
@ -492,10 +484,6 @@ class DazedMTLGUI(QMainWindow):
self.config_tab = ConfigTab()
self.config_tab.config_changed.connect(self.on_config_changed)
self.content_stack.addWidget(self.config_tab)
# Rewrite Tab (index 3)
self.rewrite_tab = RewriteTab(self)
self.content_stack.addWidget(self.rewrite_tab)
def show_update_dialog(self):
"""Open the update dialog and check for a newer version."""

View file

@ -40,7 +40,6 @@ _LINUX_NAV_FALLBACKS: dict[str, str] = {
"\U00002694": "\u2694",
"\U0001F504": "\u21bb", # 🔄 Update → ↻
"\U00002699\uFE0F": "\u2699", # ⚙️ Config → ⚙
"\U0000270F\uFE0F": "\u270E", # ✏️ Rewrite → ✎
"\U000026A1": "\u26a1", # ⚡ Workflow
}

File diff suppressed because it is too large Load diff

View file

@ -1,68 +0,0 @@
#!/usr/bin/env python3
"""Scan a folder of JSON files and write violations.json listing every over-limit message.
Usage:
python scan_violations.py [--folder FOLDER] [--output OUTPUT]
Defaults:
--folder translated
--output violations.json
"""
import json
import sys
import argparse
from pathlib import Path
MAX_LINES = 3
MAX_LINE_LEN = 60
NEWLINE = "\r\n"
def is_violation(text: str) -> bool:
lines = text.split(NEWLINE)
if len(lines) > MAX_LINES:
return True
return any(len(line) > MAX_LINE_LEN for line in lines)
def scan_folder(folder: Path) -> list[dict]:
violations = []
for f in sorted(folder.glob("*.json")):
try:
data = json.loads(f.read_text(encoding="utf-8"))
except Exception as e:
print(f"Warning: could not read {f.name}: {e}", file=sys.stderr)
continue
if not isinstance(data, list):
continue
for i, entry in enumerate(data):
if not isinstance(entry, dict):
continue
m = entry.get("message")
if isinstance(m, str) and is_violation(m):
violations.append({"file": f.name, "index": i, "original": m})
return violations
def main():
parser = argparse.ArgumentParser(description="Scan JSON files for over-limit messages")
parser.add_argument("--folder", default="translated", help="Folder to scan (default: translated)")
parser.add_argument("--output", default="violations.json", help="Output file (default: violations.json)")
args = parser.parse_args()
folder = Path(args.folder)
if not folder.exists():
print(f"Error: folder '{folder}' does not exist", file=sys.stderr)
sys.exit(1)
violations = scan_folder(folder)
Path(args.output).write_text(
json.dumps(violations, ensure_ascii=False, indent=2), encoding="utf-8"
)
print(f"Found {len(violations)} violations → {args.output}")
if __name__ == "__main__":
main()

View file

@ -1,171 +0,0 @@
# Skill: Fix over-limit game dialogue messages via LLM API
## Files needed
| File | Purpose |
|------|---------|
| `scan_violations.py` | Run this first to generate violations.json |
| `vocab.txt` | Glossary — terms the LLM must preserve exactly |
| `output/` folder | The tool reads and writes JSON files here directly |
---
## scan_violations.py
Run this to produce `violations.json` before starting the rewrite tool.
```python
#!/usr/bin/env python3
"""Scan output/*.json and write violations.json listing every over-limit message."""
import json
from pathlib import Path
OUTPUT = Path("output") # adjust if running from a different working directory
MAX_LINES = 3
MAX_LINE_LEN = 60
NEWLINE = "\r\n"
def is_violation(text: str) -> bool:
lines = text.split(NEWLINE)
if len(lines) > MAX_LINES:
return True
return any(len(line) > MAX_LINE_LEN for line in lines)
violations = []
for f in sorted(OUTPUT.glob("*.json")):
data = json.loads(f.read_text(encoding="utf-8"))
for i, entry in enumerate(data):
if not isinstance(entry, dict):
continue
m = entry.get("message")
if isinstance(m, str) and is_violation(m):
violations.append({"file": f.name, "index": i, "original": m})
Path("violations.json").write_text(
json.dumps(violations, ensure_ascii=False, indent=2), encoding="utf-8"
)
print(f"Found {len(violations)} violations → violations.json")
```
---
## violations.json entry format
```json
{
"file": "yst00183.json",
"index": 2,
"original": "Though significantly behind schedule, we completed the\r\nsurvey without losing a single crew member..."
}
```
---
## Inline validation
```python
def is_valid(text: str) -> list[str]:
"""Return list of issues, empty if valid."""
issues = []
lines = text.split("\r\n")
if len(lines) > 3:
issues.append(f"{len(lines)} lines (max 3)")
for i, line in enumerate(lines, 1):
if len(line) > 60:
issues.append(f"line {i} is {len(line)} chars (max 60)")
return issues
```
---
## System prompt
```
You are an editor for a visual novel translation. Rewrite dialogue so it fits
the game's text box.
Hard limits (non-negotiable):
- Maximum 3 lines
- Maximum 60 characters per line (every character counts)
- Break lines on spaces only — never mid-word
- Use \r\n between lines (not \n)
Rewriting rules:
1. Preserve ALL meaning — every fact and clause must survive in condensed form
2. NEVER truncate — do not drop the last sentence or clause to make it fit;
rephrase earlier parts more tightly instead
3. If a line ends a sentence, the next line begins with a capital letter
4. Preserve these terms exactly: Settler, Assimilation, Synchronization,
Those Things, We, Inspector, Suppressant, Brain Dive, Mutant Form,
Mimicry, Resource War, Resource Crisis, Quarantine, Debris Field
Reply with ONLY the rewritten text. Use literal \r\n between lines.
No explanation, no quotes, no markdown.
```
---
## User prompt per message
```
Rewrite this to fit in 3 lines of max 60 characters each.
Keep all meaning. Do not drop the ending.
Original:
{original_flat}
```
`{original_flat}` = `original` with `\r\n` replaced by `\n` for readability.
---
## Retry prompt (on validation failure)
```
VALIDATION FAILED: {issues}
Rewrite more tightly. Every character counts — including spaces and punctuation.
Do NOT drop any meaning from the original. Rephrase earlier parts to make room.
```
---
## Good vs bad example
**Original (5 lines — over limit):**
```
Though significantly behind schedule, we completed the
survey without losing a single crew member, and should
arrive at Earth within two weeks by Earth time. Securing a
modest amount of resources during the voyage to Jupiter is
our primary achievement.
```
**Correct rewrite — all meaning kept, 3 lines:**
```
We finished behind schedule but without losing any crew.\r\nWe should reach Earth in two weeks. Securing some\r\nresources en route to Jupiter is our main achievement.
```
**Wrong rewrite — truncated (NEVER do this):**
```
We finished behind schedule but without losing any crew.\r\nWe should reach Earth in two weeks.
```
---
## Apply logic
```python
import json
from pathlib import Path
OUTPUT = Path("path/to/INKAN_RE_DL/output")
def apply(file: str, index: int, rewrite: str):
path = OUTPUT / file
data = json.loads(path.read_text(encoding="utf-8"))
data[index]["message"] = rewrite
path.write_text(json.dumps(data, ensure_ascii=False, indent=4) + "\n", encoding="utf-8")
```
Write per-file after all rewrites for that file are collected to minimise disk writes.