Skip to content

Commit b9a66ff

Browse files
committed
✨ define basic example as default, ship it with bundle
Always have something to run.
1 parent c55208a commit b9a66ff

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

.github/workflows/cdci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
uses: pypa/gh-action-pypi-publish@release/v1
125125

126126
build-executable:
127-
name: Build executable - vuegen_gui_${{ matrix.os.label }}
127+
name: Build-exe-vuegen_gui_${{ matrix.os.label }}
128128
runs-on: ${{ matrix.os.runner }}
129129
needs:
130130
- test
@@ -152,7 +152,7 @@ jobs:
152152
- name: Build executable
153153
run: |
154154
cd gui
155-
pyinstaller -n vuegen_gui -D --collect-all pyvis --collect-all streamlit --collect-all st_aggrid --collect-all customtkinter app.py
155+
pyinstaller -n vuegen_gui -D --collect-all pyvis --collect-all streamlit --collect-all st_aggrid --collect-all customtkinter --add-data ../docs/example_data/Basic_example_vuegen_demo_notebook:example_data/Basic_example_vuegen_demo_notebook app.py
156156
- name: Upload executable
157157
uses: actions/upload-artifact@v4
158158
with:

gui/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ as the streamlit server and the GUI itself.
2929
# from this README folder
3030
pyinstaller \
3131
-n vuegen_gui \
32-
--no-confirm \
32+
--noconfirm \
3333
--onedir \
3434
--collect-all pyvis \
3535
--collect-all streamlit \
3636
--collect-all st_aggrid \
3737
--collect-all customtkinter \
38+
--add-data ../docs/example_data/Basic_example_vuegen_demo_notebook:example_data/Basic_example_vuegen_demo_notebook \
3839
app.py
3940
```

gui/app.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import sys
2323
import tkinter as tk
24+
from pathlib import Path
2425

2526
import customtkinter
2627

@@ -30,6 +31,26 @@
3031
customtkinter.set_appearance_mode("system")
3132
customtkinter.set_default_color_theme("dark-blue")
3233

34+
app_path = Path(__file__).absolute()
35+
print("app_path:", app_path)
36+
37+
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
38+
# PyInstaller bundeled case
39+
path_to_dat = (
40+
app_path.parent / "example_data/Basic_example_vuegen_demo_notebook"
41+
).resolve()
42+
elif app_path.parent.name == "gui":
43+
# should be always the case for GUI run from command line
44+
path_to_dat = (
45+
app_path.parent
46+
/ ".."
47+
/ "docs"
48+
/ "example_data"
49+
/ "Basic_example_vuegen_demo_notebook"
50+
).resolve()
51+
else:
52+
path_to_dat = "docs/example_data/Basic_example_vuegen_demo_notebook"
53+
3354

3455
##########################################################################################
3556
# callbacks
@@ -96,7 +117,7 @@ def radio_button_callback():
96117
)
97118
ctk_radio_config_1.grid(row=1, column=1, padx=20, pady=2)
98119

99-
config_path = tk.StringVar()
120+
config_path = tk.StringVar(value=str(path_to_dat))
100121
config_path_entry = customtkinter.CTkEntry(
101122
app,
102123
width=400,

0 commit comments

Comments
 (0)