Compare commits
No commits in common. "c76ba7c4d12bcbc6f02b4b9b5152aa3bacfe0da5" and "6d552cd291bacde66053805ce89150c302b5be6f" have entirely different histories.
c76ba7c4d1
...
6d552cd291
|
|
@ -1,5 +0,0 @@
|
||||||
/pdf_export.spec
|
|
||||||
/gui.spec
|
|
||||||
/dist/
|
|
||||||
/build/
|
|
||||||
/Output/
|
|
||||||
106
gui.py
106
gui.py
|
|
@ -10,17 +10,19 @@ import winreg
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
# Wenn das Skript in einer exe läuft, sind die Dateien im temporären Ordner
|
# Wenn das Skript in einer exe läuft, sind die Dateien im temporären Ordner
|
||||||
bundle_dir = sys._MEIPASS
|
bundle_dir = sys._MEIPASS
|
||||||
pdf_export_path = os.path.join('export.exe')
|
pdf_export_path = os.path.join('./export.exe')
|
||||||
else:
|
else:
|
||||||
# Wenn das Skript nicht in einer exe läuft, benutze das aktuelle Arbeitsverzeichnis
|
# Wenn das Skript nicht in einer exe läuft, benutze das aktuelle Arbeitsverzeichnis
|
||||||
bundle_dir = os.path.dirname(os.path.abspath(__file__))
|
bundle_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
pdf_export_path = os.path.join('dist/export.exe')
|
pdf_export_path = os.path.join('./export.exe')
|
||||||
|
|
||||||
print(pdf_export_path)
|
print(pdf_export_path)
|
||||||
# Pfade für eingebundene Ressourcen
|
# Pfade für eingebundene Ressourcen
|
||||||
logo_path = os.path.join(bundle_dir, 'logo.png')
|
logo_path = os.path.join(bundle_dir, 'logo.png')
|
||||||
gif_path = os.path.join(bundle_dir, 'printer.gif')
|
gif_path = os.path.join(bundle_dir, 'printer.gif')
|
||||||
reg_check_path = os.path.join(bundle_dir, 'reg_check.py')
|
reg_check_path = os.path.join(bundle_dir, 'reg_check.py')
|
||||||
|
|
||||||
|
|
||||||
icon_path = os.path.join(bundle_dir, 'printer.ico')
|
icon_path = os.path.join(bundle_dir, 'printer.ico')
|
||||||
|
|
||||||
class CustomerThinkerApp(ctk.CTk):
|
class CustomerThinkerApp(ctk.CTk):
|
||||||
|
|
@ -56,49 +58,26 @@ class CustomerThinkerApp(ctk.CTk):
|
||||||
|
|
||||||
self.build_gui()
|
self.build_gui()
|
||||||
self.load_gif()
|
self.load_gif()
|
||||||
# self.update_file_dropdown()
|
self.update_file_dropdown()
|
||||||
|
|
||||||
def build_gui(self):
|
def build_gui(self):
|
||||||
# Titel
|
# Titel
|
||||||
self.title_label = ctk.CTkLabel(self, text="PDF Export Tool", font=ctk.CTkFont(size=24, weight="bold"))
|
self.title_label = ctk.CTkLabel(self, text="PDF Export Tool", font=ctk.CTkFont(size=24, weight="bold"))
|
||||||
self.title_label.pack(pady=20)
|
self.title_label.pack(pady=20)
|
||||||
|
|
||||||
# Button Aufträge drucken
|
# Button
|
||||||
self.run_button = ctk.CTkButton(self, text="Alle Aufträge drucken", command=self.run_script,width=200,height=60,font=ctk.CTkFont(size=18) )
|
self.run_button = ctk.CTkButton(self, text="Alle Aufträge drucken", command=self.run_script)
|
||||||
self.run_button.pack(pady=50)
|
self.run_button.pack(pady=10)
|
||||||
|
|
||||||
# Auswahl: Letzte Labels oder Orders
|
# Auswahl: Letzte Labels oder Orders
|
||||||
# self.dropdown_select = ctk.CTkComboBox(self, values=["Letzte Labels", "Letzte Orders"],
|
self.dropdown_select = ctk.CTkComboBox(self, values=["Letzte Labels", "Letzte Orders"],
|
||||||
# command=self.update_file_dropdown, width=200)
|
command=self.update_file_dropdown, width=200)
|
||||||
# self.dropdown_select.set("Auswählen")
|
self.dropdown_select.set("Auswählen")
|
||||||
# self.dropdown_select.pack(pady=10)
|
self.dropdown_select.pack(pady=10)
|
||||||
|
|
||||||
# Werte-Dropdown
|
# Werte-Dropdown
|
||||||
# self.dropdown_values = ctk.CTkComboBox(self, values=[], command=self.file_selected, width=200)
|
self.dropdown_values = ctk.CTkComboBox(self, values=[], command=self.file_selected, width=200)
|
||||||
# self.dropdown_values.pack(pady=10)
|
self.dropdown_values.pack(pady=10)
|
||||||
|
|
||||||
# Archiv Buttons
|
|
||||||
button_frame = ctk.CTkFrame(self, fg_color="transparent")
|
|
||||||
button_frame.pack(pady=0)
|
|
||||||
|
|
||||||
## Archive Label
|
|
||||||
self.labels_button = ctk.CTkButton(
|
|
||||||
button_frame,
|
|
||||||
text="Archiv Labels",
|
|
||||||
command=self.open_labels_folder,
|
|
||||||
width=100,
|
|
||||||
height=50
|
|
||||||
)
|
|
||||||
self.labels_button.pack(side="left",padx=10, pady=0)
|
|
||||||
|
|
||||||
self.paketlist_button = ctk.CTkButton(
|
|
||||||
button_frame,
|
|
||||||
text="Archiv Paketlisten",
|
|
||||||
command=self.open_paketlist_folder,
|
|
||||||
width=100,
|
|
||||||
height=50
|
|
||||||
)
|
|
||||||
self.paketlist_button.pack(side="right",padx=10, pady=0)
|
|
||||||
|
|
||||||
# Status
|
# Status
|
||||||
self.status_label = ctk.CTkLabel(self, text="", font=ctk.CTkFont(size=16))
|
self.status_label = ctk.CTkLabel(self, text="", font=ctk.CTkFont(size=16))
|
||||||
|
|
@ -108,7 +87,6 @@ class CustomerThinkerApp(ctk.CTk):
|
||||||
self.status_label_logo = ctk.CTkLabel(self, text="")
|
self.status_label_logo = ctk.CTkLabel(self, text="")
|
||||||
self.status_label_logo.pack(pady=10)
|
self.status_label_logo.pack(pady=10)
|
||||||
|
|
||||||
|
|
||||||
# Logo unten rechts
|
# Logo unten rechts
|
||||||
self.logo_image = ctk.CTkImage(Image.open(logo_path), size=(50, 50)) # Hier dein Logo
|
self.logo_image = ctk.CTkImage(Image.open(logo_path), size=(50, 50)) # Hier dein Logo
|
||||||
self.logo_label = ctk.CTkLabel(self, image=self.logo_image, text="", fg_color="transparent")
|
self.logo_label = ctk.CTkLabel(self, image=self.logo_image, text="", fg_color="transparent")
|
||||||
|
|
@ -117,8 +95,6 @@ class CustomerThinkerApp(ctk.CTk):
|
||||||
self.logo_label.bind("<Leave>", self.on_logo_leave) # Wenn die Maus das Logo verlässt
|
self.logo_label.bind("<Leave>", self.on_logo_leave) # Wenn die Maus das Logo verlässt
|
||||||
self.logo_label.place(x=0, y=0, anchor="se") # Vorläufige Position setzen
|
self.logo_label.place(x=0, y=0, anchor="se") # Vorläufige Position setzen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Konfigurations-Button unten links
|
# Konfigurations-Button unten links
|
||||||
self.config_button = ctk.CTkButton(self, text="Konfiguration", width=100, command=self.run_reg_check)
|
self.config_button = ctk.CTkButton(self, text="Konfiguration", width=100, command=self.run_reg_check)
|
||||||
self.config_button.place(x=10, y=self.winfo_height() - 10, anchor="sw")
|
self.config_button.place(x=10, y=self.winfo_height() - 10, anchor="sw")
|
||||||
|
|
@ -135,15 +111,6 @@ class CustomerThinkerApp(ctk.CTk):
|
||||||
# Konfig-Button links unten
|
# Konfig-Button links unten
|
||||||
self.config_button.place(x=10, y=self.winfo_height() - 10, anchor="sw")
|
self.config_button.place(x=10, y=self.winfo_height() - 10, anchor="sw")
|
||||||
|
|
||||||
def open_labels_folder(self):
|
|
||||||
folder_path = os.path.abspath("label")
|
|
||||||
if sys.platform == "win32":
|
|
||||||
os.startfile(folder_path)
|
|
||||||
|
|
||||||
def open_paketlist_folder(self):
|
|
||||||
folder_path = os.path.abspath("orders")
|
|
||||||
if sys.platform == "win32":
|
|
||||||
os.startfile(folder_path)
|
|
||||||
|
|
||||||
def open_link(self, event=None):
|
def open_link(self, event=None):
|
||||||
webbrowser.open("https://www.itdata-gera.de") # Ändere dies auf die gewünschte URL
|
webbrowser.open("https://www.itdata-gera.de") # Ändere dies auf die gewünschte URL
|
||||||
|
|
@ -173,28 +140,28 @@ class CustomerThinkerApp(ctk.CTk):
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
# def update_file_dropdown(self, event=None):
|
def update_file_dropdown(self, event=None):
|
||||||
# selected_option = self.dropdown_select.get()
|
selected_option = self.dropdown_select.get()
|
||||||
# directory = self.labels_dir if selected_option == "Letzte Labels" else self.orders_dir
|
directory = self.labels_dir if selected_option == "Letzte Labels" else self.orders_dir
|
||||||
# files = self.load_files(directory)
|
files = self.load_files(directory)
|
||||||
#
|
|
||||||
# if files:
|
|
||||||
# self.dropdown_values.configure(values=files)
|
|
||||||
# self.dropdown_values.set(files[0])
|
|
||||||
# else:
|
|
||||||
# self.dropdown_values.configure(values=[])
|
|
||||||
# self.dropdown_values.set("")
|
|
||||||
#
|
|
||||||
# self.run_button.configure(text="Alle Aufträge drucken", command=self.run_script)
|
|
||||||
|
|
||||||
# def file_selected(self, event=None):
|
if files:
|
||||||
# selected_file = self.dropdown_values.get()
|
self.dropdown_values.configure(values=files)
|
||||||
# if not selected_file:
|
self.dropdown_values.set(files[0])
|
||||||
# return
|
else:
|
||||||
# selected_folder = self.labels_dir if self.dropdown_select.get() == "Letzte Labels" else self.orders_dir
|
self.dropdown_values.configure(values=[])
|
||||||
# full_path = os.path.join(selected_folder, selected_file)
|
self.dropdown_values.set("")
|
||||||
#
|
|
||||||
# self.run_button.configure(text=f"{selected_file} drucken", command=lambda: self.run_single_file(full_path))
|
self.run_button.configure(text="Alle Aufträge drucken", command=self.run_script)
|
||||||
|
|
||||||
|
def file_selected(self, event=None):
|
||||||
|
selected_file = self.dropdown_values.get()
|
||||||
|
if not selected_file:
|
||||||
|
return
|
||||||
|
selected_folder = self.labels_dir if self.dropdown_select.get() == "Letzte Labels" else self.orders_dir
|
||||||
|
full_path = os.path.join(selected_folder, selected_file)
|
||||||
|
|
||||||
|
self.run_button.configure(text=f"{selected_file} drucken", command=lambda: self.run_single_file(full_path))
|
||||||
|
|
||||||
def run_script(self):
|
def run_script(self):
|
||||||
print("run_script")
|
print("run_script")
|
||||||
|
|
@ -215,7 +182,6 @@ class CustomerThinkerApp(ctk.CTk):
|
||||||
result = subprocess.run([self.script_path], capture_output=True, text=True)
|
result = subprocess.run([self.script_path], capture_output=True, text=True)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
self.set_status("✅ Alle Aufträge wurden gedruckt!", "green")
|
self.set_status("✅ Alle Aufträge wurden gedruckt!", "green")
|
||||||
self.stop_animation()
|
|
||||||
else:
|
else:
|
||||||
self.set_status("❌ Fehler beim Ausführen des Skripts.", "red")
|
self.set_status("❌ Fehler beim Ausführen des Skripts.", "red")
|
||||||
self.show_error(result.stderr)
|
self.show_error(result.stderr)
|
||||||
|
|
@ -245,13 +211,11 @@ class CustomerThinkerApp(ctk.CTk):
|
||||||
self.status_label.configure(text=text, text_color=color)
|
self.status_label.configure(text=text, text_color=color)
|
||||||
|
|
||||||
def start_animation(self):
|
def start_animation(self):
|
||||||
self.status_label_logo.pack(pady=10)
|
|
||||||
self.animation_running = True
|
self.animation_running = True
|
||||||
self.animate()
|
self.animate()
|
||||||
|
|
||||||
def stop_animation(self):
|
def stop_animation(self):
|
||||||
self.animation_running = False
|
self.animation_running = False
|
||||||
self.status_label_logo.pack_forget()
|
|
||||||
|
|
||||||
def animate(self):
|
def animate(self):
|
||||||
if self.animation_running and self.frames:
|
if self.animation_running and self.frames:
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ ArchitecturesAllowed=x64compatible
|
||||||
; the 64-bit view of the registry.
|
; the 64-bit view of the registry.
|
||||||
ArchitecturesInstallIn64BitMode=x64compatible
|
ArchitecturesInstallIn64BitMode=x64compatible
|
||||||
DisableProgramGroupPage=yes
|
DisableProgramGroupPage=yes
|
||||||
InfoBeforeFile=C:\Users\Sebastian Serfling\PycharmProjects\PDF_EXPORT_Laudenbach\Before_Install.txt
|
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).
|
; Uncomment the following line to run in non administrative install mode (install for current user only).
|
||||||
;PrivilegesRequired=lowest
|
;PrivilegesRequired=lowest
|
||||||
OutputBaseFilename=PDFExporter
|
OutputBaseFilename=PDFExporter
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue