Skip to content

Commit

Permalink
fix #171; add placeholder icon
Browse files Browse the repository at this point in the history
  • Loading branch information
n8marti committed Oct 21, 2024
1 parent 7aa7b63 commit ba6c6a8
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 17 deletions.
4 changes: 2 additions & 2 deletions ou_dedetai.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ a = Analysis(
pathex=[],
#binaries=[('/usr/bin/tclsh8.6', '.')],
binaries=[],
datas=[('ou_dedetai/img/*-128-icon.png', 'img')],
hiddenimports=[],
datas=[('ou_dedetai/img/*icon.png', 'img')],
hiddenimports=['ou_dedetai'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
Expand Down
4 changes: 2 additions & 2 deletions ou_dedetai/gui_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self, *args, **kwargs):

# Set panel icon.
app_dir = Path(__file__).parent
self.icon = app_dir / 'img' / 'logos4-128-icon.png'
self.icon = app_dir / 'img' / 'icon.png'
self.pi = PhotoImage(file=f'{self.icon}')
self.iconphoto(False, self.pi)

Expand Down Expand Up @@ -913,7 +913,7 @@ def stop_indeterminate_progress(self, evt=None):

def control_panel_app():
utils.set_debug()
classname = "LogosLinuxControlPanel"
classname = config.name_binary
root = Root(className=classname)
ControlWindow(root, class_=classname)
root.mainloop()
Binary file added ou_dedetai/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions ou_dedetai/img/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 24 additions & 11 deletions ou_dedetai/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ def create_launcher_shortcuts():
flproducti = get_flproducti_name(flproduct)
src_dir = Path(__file__).parent
logos_icon_src = src_dir / 'img' / f"{flproducti}-128-icon.png"
app_icon_src = src_dir / 'img' / 'icon.png'

if installdir is None:
reason = "because the installation folder is not defined."
Expand All @@ -807,23 +808,31 @@ def create_launcher_shortcuts():
return
app_dir = Path(installdir) / 'data'
logos_icon_path = app_dir / logos_icon_src.name
app_icon_path = app_dir / app_icon_src.name

if system.get_runmode() == 'binary':
lli_executable = f"{installdir}/{config.name_binary}"
else:
script = Path(sys.argv[0]).expanduser().resolve()
repo_dir = None
for p in script.parents:
for c in p.iterdir():
if c.name == '.git':
repo_dir = p
break
# Find python in virtual environment.
py_bin = next(script.parent.glob('*/bin/python'))
py_bin = next(repo_dir.glob('*/bin/python'))
if not py_bin.is_file():
msg.logos_warning("Could not locate python binary in virtual environment.") # noqa: E501
return
lli_executable = f"{py_bin} {script}"
lli_executable = f"env DIALOG=tk {py_bin} {script}"

if not logos_icon_path.is_file():
app_dir.mkdir(exist_ok=True)
shutil.copy(logos_icon_src, logos_icon_path)
else:
logging.info(f"Icon found at {logos_icon_path}.")
for (src, path) in [(app_icon_src, app_icon_path), (logos_icon_src, logos_icon_path)]: # noqa: E501
if not path.is_file():
app_dir.mkdir(exist_ok=True)
shutil.copy(src, path)
else:
logging.info(f"Icon found at {path}.")

# Set launcher file names and content.
desktop_files = [
Expand All @@ -836,19 +845,23 @@ def create_launcher_shortcuts():
Icon={logos_icon_path}
Terminal=false
Type=Application
StartupWMClass={flproduct.lower()}.exe
Categories=Education;
Keywords={flproduct};Logos;Bible;Control;
"""
),
(
f"{flproduct}Bible-ControlPanel.desktop",
f"{config.name_binary}.desktop",
f"""[Desktop Entry]
Name={flproduct}Bible Control Panel
Comment=Perform various tasks for {flproduct} app
Name={config.name_app}
Comment=Manages FaithLife Bible Software
Exec={lli_executable}
Icon={logos_icon_path}
Icon={app_icon_path}
Terminal=false
Type=Application
StartupWMClass={config.name_binary}
Categories=Education;
Keywords={flproduct};Logos;Bible;Control;
"""
),
]
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ start_dir="$PWD"
script_dir="$(dirname "$0")"
repo_root="$(dirname "$script_dir")"
cd "$repo_root"
if ! which pyinstaller >/dev/null 2>&1; then
if ! which pyinstaller >/dev/null 2>&1 || ! which oudedetai >/dev/null; then
# Install build deps.
python3 -m pip install .[build]
fi
Expand Down
4 changes: 3 additions & 1 deletion scripts/run_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"""
import re
import sys
import ou_dedetai.main
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parents[1]))
import ou_dedetai.main # noqa: E402
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(ou_dedetai.main.main())

0 comments on commit ba6c6a8

Please sign in to comment.