merge upstream changes (#25)

* Add sigxcpu76's fix to force use of light GTK theme

When using Bambu Studio with a dark themed Linux desktop, many of the dialogs appear as white text on a white background (font's correctly invert, but dialogs remain white).

@sigxcpu76 provided a workaround for this in #12 which is to tell the app to use a light GTK theme.  This change incorporates that workaround into the AppImage making the app more usable until such time as proper dark theme support can be added to Bambu Studio.

* Update Containerfile to make it Docker compatible

- Replace COPY command with Docker compatible syntax
- Rename container tag to bambu-studio-builder so as to not confuse with a container that would actually run Bambu Studio
- Add Docker alternative build method (thx @SG-R)
- Update podman syntax to remove unnecessary sudo

* Add check_available_memory_and_disk to BuildLinux.sh

* Fixes #740

Removing check for local or Remote FX virtualized RDP session. The checks below this line already verify if proper OpenGL support is present.

Co-authored-by: deftdawg <deftdawg@gmail.com>
Co-authored-by: hifihedgehog <16614343+hifihedgehog@users.noreply.github.com>
This commit is contained in:
SoftFever 2022-12-13 12:41:41 +08:00 committed by GitHub
parent cad4caaf5b
commit ea5c88e36f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 7 deletions

View file

@ -7,6 +7,26 @@ export CMAKE_BUILD_PARALLEL_LEVEL=${NCORES}
FOUND_GTK2=$(dpkg -l libgtk* | grep gtk2)
FOUND_GTK3=$(dpkg -l libgtk* | grep gtk-3)
function check_available_memory_and_disk() {
FREE_MEM_GB=$(free -g -t | grep 'Mem:' | rev | cut -d" " -f1 | rev)
MIN_MEM_GB=10
FREE_DISK_KB=$(df -k . | tail -1 | awk '{print $4}')
MIN_DISK_KB=$((10 * 1024 * 1024))
if [ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]; then
echo -e "\nERROR: Bambu Studio Builder requires at least ${MIN_MEM_GB}G of 'available' mem (systen has only ${FREE_MEM_GB}G available)"
echo && free -h && echo
exit 2
fi
if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]]; then
echo -e "\nERROR: Bambu Studio Builder requires at least $(echo $MIN_DISK_KB |awk '{ printf "%.1fG\n", $1/1024/1024; }') (systen has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)"
echo && df -h . && echo
exit 1
fi
}
unset name
while getopts ":dsiuhgb" opt; do
case ${opt} in
@ -133,6 +153,8 @@ then
mkdir deps/build
fi
check_available_memory_and_disk
if [[ -n "$BUILD_DEPS" ]]
then
echo "[3/9] Configuring dependencies..."

View file

@ -1,16 +1,22 @@
# Build Bambu Slicer in a container
#
# Build an AppImage:
# rm -rf build; sudo podman build . -t bambu-studio && sudo podman run --rm localhost/bambu-studio /bin/bash -c 'tar -c $(find build | grep ubu64.AppImage | head -1)' | tar -xv
# Build an AppImage using rootless Podman (refer to https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md):
# rm -rf build; podman build . -t bambu-studio-builder && podman run --rm localhost/bambu-studio-builder /bin/bash -c 'tar -c $(find build | grep ubu64.AppImage | head -1)' | tar -xv
#
# Troubleshooting the build container:
# sudo podman run -it --name bambu-studio localhost/bambu-studio /bin/bash
# podman run -it --name bambu-studio-builder localhost/bambu-studio-builder /bin/bash
#
# Debugging the resulting AppImage:
# 1) Install `gdb`
# 2) In a terminal in the same directory as the AppImage, start it with following:
# echo -e "run\nbt\nquit" | gdb ./BambuStudio_ubu64.AppImage
# 3) Find related issue using backtrace output for clues and add backtrace to it on github
#
# Docker alternative AppImage build syntax (use this if you can't install podman):
# rm -rf build; docker build . --file Containerfile -t bambu-studio-builder; docker run --rm bambu-studio-builder /bin/bash -c 'tar -c $(find build | grep ubu64.AppImage | head -1)' | tar -xv
#
#
# TODO: bind mount BambuStudio to inside the container instead of COPY to enable faster rebuilds during dev work.
FROM docker.io/ubuntu:20.04
LABEL maintainer "DeftDawg <DeftDawg@gmail.com>"
@ -46,7 +52,7 @@ RUN apt-get update && apt-get install -y \
file \
sudo
COPY ../BambuStudio BambuStudio
COPY ./ BambuStudio
WORKDIR BambuStudio

View file

@ -250,9 +250,6 @@ int wmain(int argc, wchar_t **argv)
bool load_mesa =
// Forced from the command line.
force_mesa ||
// Running over a rempote desktop, and the RemoteFX is not enabled, therefore Windows will only provide SW OpenGL 1.1 context.
// In that case, use Mesa.
::GetSystemMetrics(SM_REMOTESESSION) ||
// Try to load the default OpenGL driver and test its context version.
! opengl_version_check.load_opengl_dll() || ! opengl_version_check.is_version_greater_or_equal_to(2, 0);
#endif /* SLIC3R_GUI */

View file

@ -43,6 +43,8 @@ export LD_LIBRARY_PATH="\$DIR/bin"
# 1) BambuStudio will segfault on systems where locale info is not as expected (i.e. Holo-ISO arch-based distro)
# 2) BambuStudio will segfault with a boost logging error if ~/.config/BambuStudio doesn't exist on first run
export LC_ALL=C
# FIXME: BambuStudio doesn't respect dark mode; use GTK_THEME workaround from sigxcpu76 │
export GTK_THEME=Adwaita:light
mkdir -p \${HOME}/.config/BambuStudio/ 2> /dev/null
exec "\$DIR/bin/@SLIC3R_APP_CMD@" "\$@"