From 3d5ec2f8f4ec87554156257b133edd58b0d03d71 Mon Sep 17 00:00:00 2001 From: faroukbmiled Date: Sat, 23 Sep 2023 13:02:45 +0100 Subject: [PATCH] added description line in details --- boiiiwd_package/src/library_tab.py | 27 ++++++++++++++------------- boiiiwd_package/src/main.py | 20 ++++++++++++-------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/boiiiwd_package/src/library_tab.py b/boiiiwd_package/src/library_tab.py index 57dd9c7..e3cbe4d 100644 --- a/boiiiwd_package/src/library_tab.py +++ b/boiiiwd_package/src/library_tab.py @@ -642,26 +642,27 @@ class LibraryTab(ctk.CTkScrollableFrame): buttons_frame.grid(row=3, column=0, columnspan=2, padx=20, pady=(0, 20), sticky="nsew") # fillers - name_label = ctk.CTkLabel(info_frame, text=f"Name: {map_name} (View...)") + name_label = ctk.CTkLabel(info_frame, text=f"Name: {map_name}") name_label.grid(row=0, column=0, columnspan=2, sticky="w", padx=20, pady=5) - name_label_tooltip = CTkToolTip(name_label, message="View description", topmost=True) - name_label.configure(cursor="hand2") - name_label.bind("", lambda e: show_description(e)) + + shortened_description = f"{description[:30]}... (View)" if len(description) > 30 else description + description_lab = ctk.CTkLabel(info_frame, text=f"Description: {shortened_description.strip()}") + description_lab.grid(row=1, column=0, columnspan=2, sticky="w", padx=20, pady=5) + description_lab_tooltip = CTkToolTip(description_lab, message="View description", topmost=True) + description_lab.configure(cursor="hand2") + description_lab.bind("", lambda e: show_description(e)) id_label = ctk.CTkLabel(info_frame, text=f"ID: {workshop_id} | Folder: {os.path.basename(folder)}") - id_label.grid(row=1, column=0, columnspan=2, sticky="w", padx=20, pady=5) - - # folder_name = ctk.CTkLabel(info_frame, text=f"") - # folder_name.grid(row=1, column=1, columnspan=2, sticky="w", padx=20, pady=5) + id_label.grid(row=2, column=0, columnspan=2, sticky="w", padx=20, pady=5) type_label = ctk.CTkLabel(info_frame, text=f"Type: {map_mod_type}") - type_label.grid(row=2, column=0, columnspan=2, sticky="w", padx=20, pady=5) + type_label.grid(row=3, column=0, columnspan=2, sticky="w", padx=20, pady=5) size_label = ctk.CTkLabel(info_frame, text=f"{size_text} {map_size}") - size_label.grid(row=3, column=0, columnspan=2, sticky="w", padx=20, pady=5) + size_label.grid(row=4, column=0, columnspan=2, sticky="w", padx=20, pady=5) date_created_label = ctk.CTkLabel(info_frame, text=f"Posted: {date_created}") - date_created_label.grid(row=4, column=0, columnspan=2, sticky="w", padx=20, pady=5) + date_created_label.grid(row=5, column=0, columnspan=2, sticky="w", padx=20, pady=5) if date_updated != "Not updated" and date_updated != "Offline": date_updated_label = ctk.CTkLabel(info_frame, text=f"Updated: {date_updated} 🔗") @@ -671,10 +672,10 @@ class LibraryTab(ctk.CTkScrollableFrame): webbrowser.open(f"https://steamcommunity.com/sharedfiles/filedetails/changelog/{workshop_id}")) else: date_updated_label = ctk.CTkLabel(info_frame, text=f"Updated: {date_updated}") - date_updated_label.grid(row=5, column=0, columnspan=2, sticky="w", padx=20, pady=5) + date_updated_label.grid(row=6, column=0, columnspan=2, sticky="w", padx=20, pady=5) date_updated_label = ctk.CTkLabel(info_frame, text=f"Downloaded at: {down_date}") - date_updated_label.grid(row=6, column=0, columnspan=2, sticky="w", padx=20, pady=5) + date_updated_label.grid(row=7, column=0, columnspan=2, sticky="w", padx=20, pady=5) stars_image_label = ctk.CTkLabel(stars_frame) stars_width, stars_height = stars_image_size diff --git a/boiiiwd_package/src/main.py b/boiiiwd_package/src/main.py index ef9c6f8..fe9421a 100644 --- a/boiiiwd_package/src/main.py +++ b/boiiiwd_package/src/main.py @@ -702,20 +702,24 @@ class BOIIIWD(ctk.CTk): buttons_frame.grid(row=3, column=0, columnspan=2, padx=20, pady=(0, 20), sticky="nsew") # fillers - name_label = ctk.CTkLabel(info_frame, text=f"Name: {map_name} (View...)") + name_label = ctk.CTkLabel(info_frame, text=f"Name: {map_name}") name_label.grid(row=0, column=0, columnspan=2, sticky="w", padx=20, pady=5) - name_label_tooltip = CTkToolTip(name_label, message="View description", topmost=True) - name_label.configure(cursor="hand2") - name_label.bind("", lambda e: show_description(e)) + + shortened_description = f"{description[:30]}... (View)" if len(description) > 30 else description + description_lab = ctk.CTkLabel(info_frame, text=f"Description: {shortened_description.strip()}") + description_lab.grid(row=1, column=0, columnspan=2, sticky="w", padx=20, pady=5) + description_lab_tooltip = CTkToolTip(description_lab, message="View description", topmost=True) + description_lab.configure(cursor="hand2") + description_lab.bind("", lambda e: show_description(e)) type_label = ctk.CTkLabel(info_frame, text=f"Type: {map_mod_type}") - type_label.grid(row=1, column=0, columnspan=2, sticky="w", padx=20, pady=5) + type_label.grid(row=2, column=0, columnspan=2, sticky="w", padx=20, pady=5) size_label = ctk.CTkLabel(info_frame, text=f"Size: {map_size}") - size_label.grid(row=2, column=0, columnspan=2, sticky="w", padx=20, pady=5) + size_label.grid(row=3, column=0, columnspan=2, sticky="w", padx=20, pady=5) date_created_label = ctk.CTkLabel(info_frame, text=f"Posted: {date_created}") - date_created_label.grid(row=3, column=0, columnspan=2, sticky="w", padx=20, pady=5) + date_created_label.grid(row=4, column=0, columnspan=2, sticky="w", padx=20, pady=5) if date_updated != "Not updated": date_updated_label = ctk.CTkLabel(info_frame, text=f"Updated: {date_updated} 🔗") @@ -726,7 +730,7 @@ class BOIIIWD(ctk.CTk): else: date_updated_label = ctk.CTkLabel(info_frame, text=f"Updated: {date_updated}") - date_updated_label.grid(row=4, column=0, columnspan=2, sticky="w", padx=20, pady=5) + date_updated_label.grid(row=5, column=0, columnspan=2, sticky="w", padx=20, pady=5) stars_image_label = ctk.CTkLabel(stars_frame) stars_width, stars_height = stars_image_size