Skip to content

Commit 576a36e

Browse files
committed
✨ copy example data to vuegen_gui dir in home directory, lib for png export of altair fig
- address windows pandoc issue: "pandoc: openBinaryFile: does not exist (No such file or directory)" - add library vl-convert-python needed for altair fig exported as static png
1 parent 91f6878 commit 576a36e

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

.github/workflows/cdci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ jobs:
157157
- name: Build executable
158158
run: |
159159
cd gui
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
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 --collect-all vl_convert --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
161161
# --windowed only for mac, see:
162162
# https://pyinstaller.org/en/stable/usage.html#building-macos-app-bundles
163163
# 'Under macOS, PyInstaller always builds a UNIX executable in dist.'
164164
# --onefile --windowed for Windows?
165-
# --collect-all vl_convert --collect-all yaml --collect-all strenum --collect-all jinja2 --collect-all fastjsonschema --collect-all jsonschema --collect-all jsonschema_specifications
165+
# --collect-all yaml --collect-all strenum --collect-all jinja2 --collect-all fastjsonschema --collect-all jsonschema --collect-all jsonschema_specifications
166166
# replace by spec file once done...
167167
- name: Upload executable
168168
uses: actions/upload-artifact@v4

gui/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ bundle:
3636
--collect-all referencing \
3737
--collect-all rpds \
3838
--collect-all tenacity \
39+
--collect-all vl_convert \
3940
--add-data ../docs/example_data/Basic_example_vuegen_demo_notebook:example_data/Basic_example_vuegen_demo_notebook \
4041
--add-data ../docs/images/vuegen_logo.png:. \
4142
app.py
4243

4344

4445
# jupyter kernel specific:
45-
# --collect-all vl_convert \
4646
# --collect-all yaml \
4747
# --collect-all strenum \
4848
# --collect-all jinja2 \

gui/app.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"""
2121

2222
import os
23+
import shutil
2324
import sys
2425
import tkinter as tk
2526
import traceback
@@ -59,7 +60,7 @@
5960
# Path to example data dependend on how the GUI is run
6061
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
6162
# PyInstaller bundeled case
62-
path_to_dat = (
63+
path_to_data_in_bundle = (
6364
app_path.parent / "example_data/Basic_example_vuegen_demo_notebook"
6465
).resolve()
6566
quarto_bin_path = os.path.join(sys._MEIPASS, "quarto_cli", "bin")
@@ -74,10 +75,24 @@
7475
# ) # ! requires kernel env with same Python env, but does not really seem to help
7576
os.environ["PYTHONPATH"] = sys._MEIPASS
7677
# ([[sys.path[0], sys._MEIPASS]) # does not work when built on GitHub Actions
78+
path_to_example_data = (
79+
output_dir.parent / "example_data" / "Basic_example_vuegen_demo_notebook"
80+
).resolve()
81+
# copy example data to vuegen_gen folder in home directory
82+
if not path_to_example_data.exists():
83+
shutil.copytree(
84+
path_to_data_in_bundle,
85+
path_to_example_data,
86+
# dirs_exist_ok=True,
87+
)
88+
messagebox.showinfo(
89+
"Info",
90+
f"Example data copied to {path_to_example_data}",
91+
)
7792
logo_path = os.path.join(sys._MEIPASS, "vuegen_logo.png")
7893
elif app_path.parent.name == "gui":
7994
# should be always the case for GUI run from command line
80-
path_to_dat = (
95+
path_to_example_data = (
8196
app_path.parent.parent
8297
/ "docs"
8398
/ "example_data"
@@ -87,7 +102,7 @@
87102
app_path.parent.parent / "docs" / "images" / "vuegen_logo.png"
88103
) # 1000x852 pixels
89104
else:
90-
path_to_dat = "docs/example_data/Basic_example_vuegen_demo_notebook"
105+
path_to_example_data = "docs/example_data/Basic_example_vuegen_demo_notebook"
91106

92107
print(f"{_PATH = }")
93108
##########################################################################################
@@ -237,7 +252,7 @@ def select_directory():
237252
)
238253
ctk_radio_config_1.grid(row=row_count, column=1, padx=20, pady=2)
239254

240-
config_path = tk.StringVar(value=str(path_to_dat))
255+
config_path = tk.StringVar(value=str(path_to_example_data))
241256
config_path_entry = customtkinter.CTkEntry(
242257
app,
243258
width=400,

0 commit comments

Comments
 (0)