File size: 3,559 Bytes
0081600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env python3
"""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()