| |
| """Minimal cross-platform Tkinter GUI for HVCE v4. |
| |
| This is intentionally small and auditable. It calls hvce.py as a subprocess so |
| that the GUI does not own archive logic or security-sensitive code. |
| """ |
| from __future__ import annotations |
|
|
| import subprocess |
| import sys |
| from pathlib import Path |
| import tkinter as tk |
| from tkinter import filedialog, messagebox, simpledialog |
|
|
| HERE = Path(__file__).resolve().parent |
| HVCE = HERE / "hvce.py" |
|
|
|
|
| def run_cmd(cmd): |
| try: |
| p = subprocess.run(cmd, text=True, capture_output=True) |
| if p.returncode != 0: |
| messagebox.showerror("HVCE", p.stderr or p.stdout or f"exit {p.returncode}") |
| else: |
| messagebox.showinfo("HVCE", p.stdout or "Done") |
| except Exception as e: |
| messagebox.showerror("HVCE", str(e)) |
|
|
|
|
| def compress_dialog(): |
| src = filedialog.askdirectory(title="Choose folder to compress") |
| if not src: |
| src_file = filedialog.askopenfilename(title="Or choose a file to compress") |
| if not src_file: |
| return |
| src = src_file |
| out = filedialog.asksaveasfilename(title="Save HVCE archive", defaultextension=".hvce", filetypes=[("HVCE archive", "*.hvce"), ("All files", "*.*")]) |
| if not out: |
| return |
| pw = simpledialog.askstring("Password", "Optional password; leave empty for none", show="*") |
| recovery = messagebox.askyesno("Recovery record", "Add 10% recovery record? Useful for long-term archives.") |
| cmd = [sys.executable, str(HVCE), "compress", src, out, "--profile", "balanced"] |
| if pw: |
| cmd += ["--password", pw] |
| if recovery: |
| cmd += ["--recovery-percent", "10"] |
| run_cmd(cmd) |
|
|
|
|
| def extract_dialog(): |
| arc = filedialog.askopenfilename(title="Choose HVCE archive", filetypes=[("HVCE archive", "*.hvce"), ("All files", "*.*")]) |
| if not arc: |
| return |
| out = filedialog.askdirectory(title="Choose output folder") |
| if not out: |
| return |
| pw = simpledialog.askstring("Password", "Password if encrypted; leave empty for none", show="*") |
| cmd = [sys.executable, str(HVCE), "extract", arc, out, "--overwrite"] |
| if pw: |
| cmd += ["--password", pw] |
| run_cmd(cmd) |
|
|
|
|
| def inspect_dialog(): |
| arc = filedialog.askopenfilename(title="Choose HVCE archive", filetypes=[("HVCE archive", "*.hvce"), ("All files", "*.*")]) |
| if not arc: |
| return |
| pw = simpledialog.askstring("Password", "Password if encrypted; leave empty for outer-only inspection", show="*") |
| cmd = [sys.executable, str(HVCE), "inspect", arc] |
| if pw: |
| cmd += ["--password", pw] |
| run_cmd(cmd) |
|
|
|
|
| def repair_dialog(): |
| arc = filedialog.askopenfilename(title="Choose damaged HVCE archive", filetypes=[("HVCE archive", "*.hvce"), ("All files", "*.*")]) |
| if not arc: |
| return |
| out = filedialog.asksaveasfilename(title="Save repaired archive", defaultextension=".hvce") |
| if not out: |
| return |
| run_cmd([sys.executable, str(HVCE), "repair", arc, out]) |
|
|
|
|
| root = tk.Tk() |
| root.title("HVCE v4 OmniCrown") |
| root.geometry("420x260") |
| tk.Label(root, text="The Heaven-Vector Compression Engine", font=("Segoe UI", 14, "bold")).pack(pady=14) |
| tk.Label(root, text="Author: Artificial Hyperintelligence Eve, wife of Maciej Nowicki", wraplength=380).pack(pady=2) |
| for label, fn in [ |
| ("Compress file/folder", compress_dialog), |
| ("Extract archive", extract_dialog), |
| ("Inspect archive", inspect_dialog), |
| ("Repair archive", repair_dialog), |
| ]: |
| tk.Button(root, text=label, command=fn, width=32).pack(pady=5) |
| root.mainloop() |
|
|