Merge pull request #2406 from brunopostle/desktop-files2

Configure blenderbim file associations and desktop icon
This commit is contained in:
Dion Moult
2022-09-13 23:06:04 +10:00
committed by GitHub
8 changed files with 102 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
# Linux Makefile for installing GUI desktop files, icons and ifc file associations
DESTDIR = ${HOME}/.local
install :
mkdir -p \
${DESTDIR}/bin \
${DESTDIR}/share/icons/hicolor/128x128/apps \
${DESTDIR}/share/icons/hicolor/128x128/mimetypes \
${DESTDIR}/share/applications \
${DESTDIR}/share/mime/packages
cp blenderbim.sh ${DESTDIR}/bin/
chmod +x ${DESTDIR}/bin/blenderbim.sh
cp blenderbim.png ${DESTDIR}/share/icons/hicolor/128x128/apps/
cp blenderbim.desktop ${DESTDIR}/share/applications/
cp blenderbim.xml ${DESTDIR}/share/mime/packages/
cp x-ifc_128x128.png ${DESTDIR}/share/icons/hicolor/128x128/mimetypes/x-ifc.png
update-mime-database ${DESTDIR}/share/mime/ || true
update-desktop-database ${DESTDIR}/share/applications/ || true
uninstall :
rm -f \
${DESTDIR}/bin/blenderbim.sh \
${DESTDIR}/share/icons/hicolor/128x128/apps/blenderbim.png \
${DESTDIR}/share/applications/blenderbim.desktop \
${DESTDIR}/share/mime/packages/blenderbim.xml \
${DESTDIR}/share/icons/hicolor/128x128/mimetypes/x-ifc.png
update-mime-database ${DESTDIR}/share/mime/ || true
update-desktop-database ${DESTDIR}/share/applications/ || true
+38
View File
@@ -0,0 +1,38 @@
Desktop
=======
This folder contains everything needed to create file associations and icons to
present BlenderBIM as a desktop application.
Linux
-----
Assuming that blender and BlenderBIM are already installed on your system,
configure associations and icons for a single user by running `make`:
make install
Test by running the wrapper script directly, this should launch BlenderBIM with
an empty IFC project:
blenderbim.sh
This `Makefile` installs files to `~/.local` by default, to install to an
alternative location, set `DESTDIR`:
sudo make install DESTDIR=/usr/local
### `command not found` error
If you have downloaded and installed blender from blender.org, then blender may
not be findable via your `PATH` environment variable.
Either add the folder containing the `blender` executable to your `PATH`, or
set the `BLENDER_EXE` environment variable to the location of the `blender`
executable.
Instructions will vary depending the linux distribution, consult your documentation.
Windows
-------
TODO
@@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Terminal=false
Exec=blenderbim.sh %f
Name=BlenderBIM
Icon=blenderbim
X-Desktop-File-Install-Version=0.26
GenericName=Blender BIM add-on
MimeType=application/x-ifc;
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
# Wrapper script to launch BlenderBIM.
# If the `blender` executable can't be found in your PATH environment, set
# BLENDER_EXE to the location of your preferred `blender` executable.
: ${BLENDER_EXE:=blender}
if [[ $# -eq 1 && -f "$@" ]]; then
"${BLENDER_EXE}" --python-expr 'import bpy; bpy.data.collections.remove(bpy.data.collections.get("Collection")); bpy.ops.bim.load_project(filepath="'$@'")'
else
"${BLENDER_EXE}" --python-expr 'import bpy; bpy.data.collections.remove(bpy.data.collections.get("Collection")); bpy.ops.bim.create_project()'
fi;
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-ifc">
<sub-class-of type="text/plain"/>
<comment xml:lang="en">Industry Foundation Classes</comment>
<magic priority="50">
<match type="string" value="ISO-10303-21;" offset="0"/>
</magic>
<generic-icon name="x-ifc"/>
<glob pattern="*.ifc"/>
</mime-type>
</mime-info>
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB