Add Installer Script for Inno Setup

master
Sebastian Serfling 2025-05-26 11:03:47 +02:00
parent 4f49e34ca9
commit eab1b5bf2a
4 changed files with 63 additions and 103 deletions

58
dist/install_script.iss vendored Normal file
View File

@ -0,0 +1,58 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "PDFExporter"
#define MyAppVersion "1.0"
#define MyAppPublisher "ITDATA-Gera"
#define MyAppURL "https://itdata-gera.de"
#define MyAppExeName "gui.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{687ECFC0-0B2A-46A7-9D08-3A4CFDD13F1E}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={localappdata}\{#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run
; on anything but x64 and Windows 11 on Arm.
ArchitecturesAllowed=x64compatible
; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the
; install be done in "64-bit mode" on x64 or Windows 11 on Arm,
; meaning it should use the native 64-bit Program Files directory and
; the 64-bit view of the registry.
ArchitecturesInstallIn64BitMode=x64compatible
DisableProgramGroupPage=yes
InfoBeforeFile=C:\Users\Sebastian Serfling\PycharmProjects\PDF_EXPORT_Laudenbach\dist\Before_Install.txt
; Uncomment the following line to run in non administrative install mode (install for current user only).
;PrivilegesRequired=lowest
OutputBaseFilename=PDFExporter
SetupIconFile=C:\Users\Sebastian Serfling\PycharmProjects\PDF_EXPORT_Laudenbach\printer.ico
SolidCompression=yes
WizardStyle=modern
PrivilegesRequired=lowest
[Languages]
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Users\Sebastian Serfling\PycharmProjects\PDF_EXPORT_Laudenbach\dist\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Sebastian Serfling\PycharmProjects\PDF_EXPORT_Laudenbach\dist\export.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

2
gui.py
View File

@ -31,7 +31,7 @@ class CustomerThinkerApp(ctk.CTk):
self.iconbitmap(icon_path) # Setzt das Icon self.iconbitmap(icon_path) # Setzt das Icon
self.title("CustomerThinker PDF Export Tool") self.title("PDFExporter 1.0")
window_width = 400 window_width = 400
window_height = 450 window_height = 450

View File

@ -154,7 +154,10 @@ os.makedirs(label_storage_path, exist_ok=True)
# PDF von der API herunterladen # PDF von der API herunterladen
if url: if url:
response = requests.get(url) body = {
'tkn':'ov;xZ~ksDXf;dV-ci^LJS^N9Pi;Z,~A.QY$5uBc74a9RMjTQ5trhbQx#%hit:gTw'
}
response = requests.post(url, data=body)
if response.status_code == 200: if response.status_code == 200:
file_name = f'{original_storage_path}/original_{timestamp}.pdf' file_name = f'{original_storage_path}/original_{timestamp}.pdf'
with open(file_name, 'wb') as file: with open(file_name, 'wb') as file:

View File

@ -1,101 +0,0 @@
import customtkinter as ctk
import winreg
import subprocess
import sys
import os
# Registry-Pfad definieren
REG_PATH = r"Software\PDFExporter"
def read_registry_value(name):
try:
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, REG_PATH, 0, winreg.KEY_READ)
value, _ = winreg.QueryValueEx(key, name)
winreg.CloseKey(key)
return value
except FileNotFoundError:
return None
def write_registry_value(name, value):
try:
key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, REG_PATH)
winreg.SetValueEx(key, name, 0, winreg.REG_SZ, value)
winreg.CloseKey(key)
except Exception as e:
print(f"Fehler beim Schreiben in Registry: {e}")
# def config_exists():
# return read_registry_value("APIKey") is not None
def save_config_and_close(api_entry, server_entry, label_entry, order_entry, app):
write_registry_value("APIKey", api_entry.get())
write_registry_value("Server", server_entry.get())
write_registry_value("LabelPrinter", label_entry.get())
write_registry_value("OrderPrinter", order_entry.get())
app.destroy()
def show_config_gui():
ctk.set_appearance_mode("System")
ctk.set_default_color_theme("blue")
app = ctk.CTk()
app.title("Erstkonfiguration")
window_width = 400
window_height = 400
# Bildschirmgröße ermitteln
screen_width = app.winfo_screenwidth()
screen_height = app.winfo_screenheight()
# Position zum Zentrieren berechnen
x = int((screen_width / 2) - (window_width / 2))
y = int((screen_height / 2) - (window_height / 2))
app.geometry(f"{window_width}x{window_height}+{x}+{y}")
frame = ctk.CTkFrame(master=app)
frame.pack(pady=20, padx=20, fill="both", expand=True)
# Vorhandene Werte aus der Registry lesen
existing_api = read_registry_value("APIKey") or ""
existing_server = read_registry_value("Server") or ""
existing_label = read_registry_value("LabelPrinter") or ""
existing_order = read_registry_value("OrderPrinter") or ""
api_label = ctk.CTkLabel(master=frame, text="API Key:")
api_label.pack(pady=5)
api_entry = ctk.CTkEntry(master=frame, width=300)
api_entry.insert(0, existing_api)
api_entry.pack()
server_label = ctk.CTkLabel(master=frame, text="Server:")
server_label.pack(pady=5)
server_entry = ctk.CTkEntry(master=frame, width=300)
server_entry.insert(0, existing_server)
server_entry.pack()
label_label = ctk.CTkLabel(master=frame, text="Label-Drucker:")
label_label.pack(pady=5)
label_entry = ctk.CTkEntry(master=frame, width=300)
label_entry.insert(0, existing_label)
label_entry.pack()
order_label = ctk.CTkLabel(master=frame, text="Order-Drucker:")
order_label.pack(pady=5)
order_entry = ctk.CTkEntry(master=frame, width=300)
order_entry.insert(0, existing_order)
order_entry.pack()
save_button = ctk.CTkButton(master=frame, text="Speichern", command=lambda: save_config_and_close(
api_entry, server_entry, label_entry, order_entry, app))
save_button.pack(pady=15)
app.mainloop()
def start_gui_app():
# gui.py im gleichen Verzeichnis starten
script_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "gui.py")
subprocess.Popen([sys.executable, script_path])
show_config_gui()