|
22 | 22 | import os |
23 | 23 | import sys |
24 | 24 | import tkinter as tk |
| 25 | +import traceback |
25 | 26 | from pathlib import Path |
26 | 27 | from pprint import pprint |
| 28 | +from tkinter import filedialog, messagebox |
27 | 29 |
|
28 | 30 | import customtkinter |
| 31 | +from PIL import Image |
| 32 | + |
| 33 | +from vuegen import report_generator |
29 | 34 |
|
30 | 35 | # from vuegen.__main__ import main |
31 | 36 | from vuegen.report import ReportType |
32 | | -from vuegen.utils import get_logger |
| 37 | +from vuegen.utils import get_logger, print_completion_message |
33 | 38 |
|
34 | 39 | customtkinter.set_appearance_mode("system") |
35 | 40 | customtkinter.set_default_color_theme("dark-blue") |
36 | | -import traceback |
37 | | -from tkinter import filedialog, messagebox |
38 | | - |
39 | | -from vuegen import report_generator |
40 | | -from vuegen.utils import print_completion_message |
41 | 41 |
|
42 | 42 | app_path = Path(__file__).absolute().resolve() |
43 | 43 | print("app_path:", app_path) |
|
64 | 64 | # ) # ! requires kernel env with same Python env, but does not really seem to help |
65 | 65 | os.environ["PYTHONPATH"] = sys._MEIPASS |
66 | 66 | # ([[sys.path[0], sys._MEIPASS]) # does not work when built on GitHub Actions |
| 67 | + logo_path = os.path.join(sys._MEIPASS, "vuegen_logo.png") |
67 | 68 | elif app_path.parent.name == "gui": |
68 | 69 | # should be always the case for GUI run from command line |
69 | 70 | path_to_dat = ( |
70 | | - app_path.parent |
71 | | - / ".." |
| 71 | + app_path.parent.parent |
72 | 72 | / "docs" |
73 | 73 | / "example_data" |
74 | 74 | / "Basic_example_vuegen_demo_notebook" |
75 | 75 | ).resolve() |
| 76 | + logo_path = ( |
| 77 | + app_path.parent.parent / "docs" / "images" / "vuegen_logo.png" |
| 78 | + ) # 1000x852 pixels |
76 | 79 | else: |
77 | 80 | path_to_dat = "docs/example_data/Basic_example_vuegen_demo_notebook" |
78 | 81 |
|
79 | 82 | print(f"{_PATH = }") |
80 | 83 | ########################################################################################## |
81 | 84 | # callbacks |
82 | | -# using main entry point of vuegen |
83 | | -# def create_run_vuegen(is_dir, config_path, report_type, run_streamlit): |
84 | | -# def inner(): |
85 | | -# args = ["vuegen"] |
86 | | -# print(f"{is_dir.get() = }") |
87 | | -# if is_dir.get(): |
88 | | -# args.append("--directory") |
89 | | -# else: |
90 | | -# args.append("--config") |
91 | | -# args.append(config_path.get()) |
92 | | -# args.append("--report_type") |
93 | | -# args.append(report_type.get()) |
94 | | -# print(f"{run_streamlit.get() = }") |
95 | | -# if run_streamlit.get(): |
96 | | -# args.append("--streamlit_autorun") |
97 | | -# print("args:", args) |
98 | | -# sys.argv = args |
99 | | -# main() # Call the main function from vuegen |
100 | | - |
101 | | -# return inner |
102 | 85 |
|
103 | 86 |
|
104 | 87 | def create_run_vuegen( |
@@ -198,9 +181,17 @@ def select_directory(): |
198 | 181 | app = customtkinter.CTk() |
199 | 182 | app.geometry("620x600") |
200 | 183 | app.title("VueGen GUI") |
201 | | - |
202 | 184 | row_count = 0 |
203 | 185 | ########################################################################################## |
| 186 | +# Logo |
| 187 | +_factor = 4 |
| 188 | +logo_image = customtkinter.CTkImage( |
| 189 | + Image.open(logo_path), size=(int(1000 / _factor), int(852 / _factor)) |
| 190 | +) |
| 191 | +logo_label = customtkinter.CTkLabel(app, image=logo_image, text="") |
| 192 | +logo_label.grid(row=0, column=0, columnspan=2, padx=10, pady=5) |
| 193 | +row_count += 1 |
| 194 | +########################################################################################## |
204 | 195 | # Config or directory input |
205 | 196 | ctk_label_config = customtkinter.CTkLabel( |
206 | 197 | app, |
|
0 commit comments