Skip to content

Commit 65465b9

Browse files
committed
🎨 add logo to app and clean-up app.py
- for debugging do not build windowed app for now
1 parent 8222d2b commit 65465b9

File tree

3 files changed

+26
-31
lines changed

3 files changed

+26
-31
lines changed

.github/workflows/cdci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,11 @@ jobs:
157157
- name: Build executable
158158
run: |
159159
cd gui
160-
pyinstaller -n vuegen_gui -F -w --collect-all pyvis --collect-all streamlit --collect-all st_aggrid --collect-all customtkinter --collect-all quarto_cli --collect-all plotly --collect-all _plotly_utils --collect-all traitlets --collect-all referencing --collect-all rpds --collect-all tenacity --collect-all pyvis --collect-all pandas --collect-all numpy --collect-all matplotlib --collect-all openpyxl --collect-all xlrd --collect-all nbformat --collect-all nbclient --collect-all altair --collect-all itables --collect-all kaleido --collect-all pyarrow --collect-all dataframe_image --collect-all narwhals --collect-all PIL --add-data ../docs/example_data/Basic_example_vuegen_demo_notebook:example_data/Basic_example_vuegen_demo_notebook app.py
161-
# -w -D
160+
pyinstaller -n vuegen_gui --collect-all pyvis --collect-all streamlit --collect-all st_aggrid --collect-all customtkinter --collect-all quarto_cli --collect-all plotly --collect-all _plotly_utils --collect-all traitlets --collect-all referencing --collect-all rpds --collect-all tenacity --collect-all pyvis --collect-all pandas --collect-all numpy --collect-all matplotlib --collect-all openpyxl --collect-all xlrd --collect-all nbformat --collect-all nbclient --collect-all altair --collect-all itables --collect-all kaleido --collect-all pyarrow --collect-all dataframe_image --collect-all narwhals --collect-all PIL --add-data ../docs/example_data/Basic_example_vuegen_demo_notebook:example_data/Basic_example_vuegen_demo_notebook --add-data ../docs/images/vuegen_logo.png:. app.py
161+
# --windowed only for mac, see:
162+
# https://pyinstaller.org/en/stable/usage.html#building-macos-app-bundles
163+
# 'Under macOS, PyInstaller always builds a UNIX executable in dist.'
164+
# --onefile --windowed for Windows?
162165
# --collect-all vl_convert --collect-all yaml --collect-all strenum --collect-all jinja2 --collect-all fastjsonschema --collect-all jsonschema --collect-all jsonschema_specifications
163166
# replace by spec file once done...
164167
- name: Upload executable

gui/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ bundle:
3737
--collect-all rpds \
3838
--collect-all tenacity \
3939
--add-data ../docs/example_data/Basic_example_vuegen_demo_notebook:example_data/Basic_example_vuegen_demo_notebook \
40+
--add-data ../docs/images/vuegen_logo.png:. \
4041
app.py
4142

4243

gui/app.py

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@
2222
import os
2323
import sys
2424
import tkinter as tk
25+
import traceback
2526
from pathlib import Path
2627
from pprint import pprint
28+
from tkinter import filedialog, messagebox
2729

2830
import customtkinter
31+
from PIL import Image
32+
33+
from vuegen import report_generator
2934

3035
# from vuegen.__main__ import main
3136
from vuegen.report import ReportType
32-
from vuegen.utils import get_logger
37+
from vuegen.utils import get_logger, print_completion_message
3338

3439
customtkinter.set_appearance_mode("system")
3540
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
4141

4242
app_path = Path(__file__).absolute().resolve()
4343
print("app_path:", app_path)
@@ -64,41 +64,24 @@
6464
# ) # ! requires kernel env with same Python env, but does not really seem to help
6565
os.environ["PYTHONPATH"] = sys._MEIPASS
6666
# ([[sys.path[0], sys._MEIPASS]) # does not work when built on GitHub Actions
67+
logo_path = os.path.join(sys._MEIPASS, "vuegen_logo.png")
6768
elif app_path.parent.name == "gui":
6869
# should be always the case for GUI run from command line
6970
path_to_dat = (
70-
app_path.parent
71-
/ ".."
71+
app_path.parent.parent
7272
/ "docs"
7373
/ "example_data"
7474
/ "Basic_example_vuegen_demo_notebook"
7575
).resolve()
76+
logo_path = (
77+
app_path.parent.parent / "docs" / "images" / "vuegen_logo.png"
78+
) # 1000x852 pixels
7679
else:
7780
path_to_dat = "docs/example_data/Basic_example_vuegen_demo_notebook"
7881

7982
print(f"{_PATH = }")
8083
##########################################################################################
8184
# 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
10285

10386

10487
def create_run_vuegen(
@@ -198,9 +181,17 @@ def select_directory():
198181
app = customtkinter.CTk()
199182
app.geometry("620x600")
200183
app.title("VueGen GUI")
201-
202184
row_count = 0
203185
##########################################################################################
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+
##########################################################################################
204195
# Config or directory input
205196
ctk_label_config = customtkinter.CTkLabel(
206197
app,

0 commit comments

Comments
 (0)