Skip to content

Commit ed4123a

Browse files
committed
harden several linux configs; splash tries
1 parent a6db8ba commit ed4123a

9 files changed

Lines changed: 163 additions & 12 deletions

File tree

Packaging/AppImage/makeAppImage

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/bin/bash
2+
3+
# Script to make a universal appimage for PyImageFuser
4+
# version 0.1, 2022-05-22, hvdw
5+
6+
# Requirements:
7+
# appimagetool: Download from https://github.com/AppImage/AppImageKit/releases
8+
# Necessary python3 modules
9+
10+
# Specify the correct path (from the root path)
11+
EA="enfuse_ais"
12+
13+
if [ "$1" = "" ]
14+
then
15+
printf "\n\nYou have to provide the version\n\n"
16+
exit
17+
fi
18+
19+
VER="$1"
20+
WORKDIR=$(pwd)
21+
printf "\n\nWorkdir = $WORKDIR\n\n"
22+
23+
printf "\n\nGo back to root folder of souce code\n"
24+
cd ../..
25+
pwd
26+
27+
printf "\nRemove possible previous build and dist folders and recreate binary\n\n"
28+
rm -rf dist build *.spec
29+
pyinstaller PyImageFuser.py
30+
31+
#printf "\nNow copy enfuse & align_image_stack\n"
32+
#cp -r $EA dist/enfuse_ais
33+
34+
#printf "\nCopy resources\n"
35+
#cp -r images docs dist
36+
37+
printf "\n\nMove back to our AppImage folder\n\n"
38+
cd $WORKDIR
39+
#
40+
printf "Remove, create and step into our AppDir\n\n"
41+
#
42+
AppDir="PyImageFuser-x86_64"
43+
rm -rf ${AppDir}
44+
mkdir -p ${AppDir}
45+
cd ${AppDir}
46+
47+
#
48+
printf "copy the our PyImageFsuer pyinstaller binary into this AppDir folder\n\n"
49+
#
50+
cp -r ../../../dist/PyImageFuser/* .
51+
52+
#
53+
printf "Create folders and copy program icon and desktop file\n\n"
54+
#
55+
mkdir -p usr/bin
56+
mkdir -p usr/share/pyimagefuser
57+
mkdir -p usr/share/applications
58+
mkdir -p usr/share/metainfo
59+
60+
61+
cp ../../../images/logo.png usr/share/pyimagefuser
62+
cp ../../../images/logo.png .
63+
#mv jExifToolGUI.jar usr/share/pyimagefuser
64+
cp ../pyimagefuser.desktop usr/share/applications
65+
cp ../pyimagefuser.desktop .
66+
cp ../pyimagefuser.appdata.xml usr/share/metainfo
67+
68+
69+
printf "\n\nNow copy enfuse_ais, docs and images into our AppImage\n\n"
70+
cp -r ../../../images .
71+
cp -r ../../../docs .
72+
cp -r ../../../enfuse_ais/* .
73+
74+
#
75+
printf "Create the AppRun script\n\n"
76+
#
77+
#cd usr/bin
78+
cat > ./AppRun <<\EOF
79+
#!/bin/sh
80+
HERE=$(dirname $(readlink -f "${0}"))
81+
export PATH="$APPDIR:$APPDIR/usr/bin:${HERE}/usr/local/bin:${HERE}/usr/bin:$PATH"
82+
"${HERE}"/PyImageFuser ${1+"$@"} &
83+
EOF
84+
85+
chmod a+x ./AppRun
86+
87+
#
88+
# We're done in the AppDir
89+
cd ..
90+
#rm ${AppDir}/${latest_exif}
91+
92+
#
93+
# Create the AppImage
94+
#
95+
wget -c https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
96+
chmod +x appimagetool-x86_64.AppImage
97+
ARCH=x86_64 ./appimagetool-x86_64.AppImage -n ${AppDir}
98+
99+
#
100+
# Rename the created app image
101+
#
102+
mv PyImageFuser-x86_64.AppImage PyImageFuser-${VER}-x86_64.AppImage
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>pyimagefuser</id>
4+
<metadata_license>CC-BY-SA-3.0</metadata_license>
5+
<project_license>GPL-3.0</project_license>
6+
<name>PyImageFuser</name>
7+
<summary>Graphic User Interface for exposure bracketing using enfuse and align_image_stack</summary>
8+
<description>
9+
<p>PyImageFuser is a python3/tkinter/pysimplegui Windows/Linux/MacOS graphical frontend for enfuse and align_image_stack</p>
10+
</description>
11+
<launchable type="desktop-id">pyimagefuser.desktop</launchable>
12+
<url type="homepage">https://hvdwolf.github.io/PyImageFuser/</url>
13+
<screenshots>
14+
<screenshot type="default">
15+
<image>https://hvdwolf.github.io/PyImageFuser/screenshots/PIF-main-xfce4.jpg</image>
16+
</screenshot>
17+
</screenshots>
18+
<provides>
19+
<id>pyimagefuser.desktop</id>
20+
</provides>
21+
</component>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Desktop Entry]
2+
Name=PyImageFuser
3+
Comment=PyImageFuser is a graphical exposure bracketing app using enfuse and align_image_stack
4+
Exec=./PyImageFuser
5+
Icon=/usr/share/pyimagefuser/logo
6+
Terminal=false
7+
Type=Application
8+
Categories=Graphics;Utility;
9+
StartupNotify=true

PyImageFuser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def main():
110110
print("settingsfile: ",settingsFile)
111111
print("tmpdir", os.path.realpath(tempfile.gettempdir()))
112112
print("current path ", os.path.realpath('.'))
113-
#print(getattr(sys, '_MEIPASS', 'NotRunningInPyInstaller'))
113+
print('pyinstaller _MEIPASS ', getattr(sys, '_MEIPASS', 'NotRunningInPyInstaller'))
114+
if os.getenv('HERE') != None:
115+
print('HERE ', os.getenv('HERE'))
114116

115117
# Display the GUI to the user
116118
window = ui_layout.create_and_show_gui(tmpfolder,start_folder)

artwork/splash.png

359 Bytes
Loading

artwork/splash.xcf

162 Bytes
Binary file not shown.

image_functions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,11 @@ def create_ais_command(all_values, folder, tmpfolder, type):
419419
ais_string = cmd_string
420420
elif platform.system() == 'Darwin':
421421
cmd_string = os.path.join(os.path.realpath('.'), 'enfuse_ais', 'MacOS', 'align_image_stack')
422-
else:
423-
cmd_string = os.path.join(os.path.realpath('.'), 'enfuse_ais', 'usr', 'bin', 'align_image_stack')
424-
422+
else: # 'Linux'
423+
# If it is an appimage we use our builtin align_image_stack via internal usr/bin
424+
# If it is a deb, we will install it in the path
425+
# If the user runs it from python, (s)he needs to install align_image_stack him-/herself
426+
cmd_string = 'align_image_stack'
425427
if (type == 'preview'):
426428
cmd_string += ' -a ' + os.path.join(tmpfolder, 'preview_ais_001') + ' '
427429
# cmd_list.append('--gpu')
@@ -523,13 +525,11 @@ def create_enfuse_command(all_values, folder, tmpfolder, type, newImageFileName)
523525
# cmd_string = 'enfuse'
524526
#else:
525527
cmd_string = os.path.join(os.path.realpath('.'), 'enfuse_ais', 'MacOS', 'enfuse')
526-
else:
527-
#cmd_string = file_functions.resource_path(os.path.join('enfuse_ais', 'usr', 'bin', 'enfuse'))
528-
check_pyinstaller =getattr (sys, '_MEIPASS', 'NotRunningInPyInstaller')
529-
if check_pyinstaller == 'NotRunningInPyInstaller': # we run from the script and assume enfuse is in the PATH
530-
cmd_string = 'enfuse'
531-
else:
532-
cmd_string = os.path.join(os.path.realpath('.'), 'enfuse_ais', 'usr', 'bin', 'enfuse')
528+
else: # 'Linux'
529+
# If it is an appimage we use our builtin enfuse via internal usr/bin
530+
# If it is a deb, we will install it in the path
531+
# If the user runs it from python, (s)he needs to install enfuse him-/herself
532+
cmd_string = 'enfuse'
533533
if type == 'preview_ais':
534534
cmd_string += ' -v --compression=90 ' + os.path.join(tmpfolder, 'preview_ais_001*') + ' -o ' + os.path.join(tmpfolder, 'preview.jpg ')
535535
cmd_list.append('-v')

images/logo.xcf

99.8 KB
Binary file not shown.

ui_actions.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# it will be useful, but WITHOUT ANY WARRANTY; without even the implied
1212
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
1313
# the GNU General Public Licence for more details.
14+
import platform
1415

1516
import PySimpleGUI as sg
1617
import io, os, sys
@@ -19,6 +20,7 @@
1920

2021
import histogram
2122
import image_functions
23+
import file_functions
2224

2325

2426
def display_org_previewthumb(imgfile, type):
@@ -33,7 +35,22 @@ def display_org_previewthumb(imgfile, type):
3335
'''
3436
try:
3537
#print("\n\nimgfile ", imgfile)
36-
image = Image.open(imgfile)
38+
39+
if platform.system() == 'Linux':
40+
testpyinstaller = getattr(sys, '_MEIPASS', 'NotRunningInPyInstaller')
41+
prefix = os.path.realpath('.')
42+
#print("ui_actions HERE ", os.getenv('HERE'))
43+
#print('pyinstaller _MEIPASS pyinstonrnot ', pyinstornot)
44+
if testpyinstaller != 'NotRunningInPyInstaller':
45+
prefix = testpyinstaller;
46+
if type == 'preview':
47+
#image = Image.open(os.path.join(os.getenv('HERE'), 'images', 'preview.png'))
48+
image = Image.open(file_functions.resource_path(os.path.join(prefix, 'images', 'preview.png')))
49+
else:
50+
image = Image.open(file_functions.resource_path(os.path.join(prefix, 'images', 'thumb.png')))
51+
else:
52+
image = Image.open(imgfile)
53+
3754
if type == 'preview':
3855
sg.user_settings_filename(path=Path.home())
3956
longestSide = int(sg.user_settings_get_entry('last_size_chosen', '480'))

0 commit comments

Comments
 (0)