From dae2d9d761c2233f58d4300973253e6d45c300fe Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 27 Feb 2018 13:20:18 +0100 Subject: [PATCH 01/14] Add Dockerfile --- Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..4aa7b4557c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM ultimaker/cura-build-environment:3.2 + +# Environment vars for easy configuration +ENV CURA_BRANCH=master +ENV URANIUM_BRANCH=$CURA_BRANCH +ENV CURA_BENV_GIT_DIR=/srv/cura + +# Setup the repositories +RUN mkdir $CURA_BENV_GIT_DIR +WORKDIR $CURA_BENV_GIT_DIR +RUN git clone https://github.com/Ultimaker/Uranium +WORKDIR $CURA_BENV_GIT_DIR/Uranium +RUN git fetch origin +RUN git checkout $URANIUM_BRANCH +RUN git clone https://github.com/Ultimaker/cura +WORKDIR $CURA_BENV_GIT_DIR/Cura +RUN git fetch origin +RUN git checkout origin $CURA_BRANCH + +# Ensure Uranium is in the python path +RUN export PYTHOHPATH="${PYTHONPATH}:$CURA_BENV_GIT_DIR/Uranium" + +# Run Cura +CMD ["python3", "cura_app.py"] From 4dd01afffbc96363f18fc16773a5a37d42d1324f Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 27 Feb 2018 13:31:07 +0100 Subject: [PATCH 02/14] Cleanup Dockerfile --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4aa7b4557c..e71ae35b46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,20 +5,23 @@ ENV CURA_BRANCH=master ENV URANIUM_BRANCH=$CURA_BRANCH ENV CURA_BENV_GIT_DIR=/srv/cura -# Setup the repositories RUN mkdir $CURA_BENV_GIT_DIR + +# Setup Uranium WORKDIR $CURA_BENV_GIT_DIR RUN git clone https://github.com/Ultimaker/Uranium WORKDIR $CURA_BENV_GIT_DIR/Uranium RUN git fetch origin RUN git checkout $URANIUM_BRANCH +RUN export PYTHOHPATH="${PYTHONPATH}:$CURA_BENV_GIT_DIR/Uranium" + +# Setup Cura +WORKDIR $CURA_BENV_GIT_DIR RUN git clone https://github.com/Ultimaker/cura WORKDIR $CURA_BENV_GIT_DIR/Cura RUN git fetch origin RUN git checkout origin $CURA_BRANCH -# Ensure Uranium is in the python path -RUN export PYTHOHPATH="${PYTHONPATH}:$CURA_BENV_GIT_DIR/Uranium" - # Run Cura +WORKDIR $CURA_BENV_GIT_DIR/Cura CMD ["python3", "cura_app.py"] From 8144ca978b2b67d413c5acd36766da2e6d9f6cf5 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 27 Feb 2018 15:55:24 +0100 Subject: [PATCH 03/14] Add CuraEngine to Dockerfile --- Dockerfile | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e71ae35b46..3f21496e92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ FROM ultimaker/cura-build-environment:3.2 # Environment vars for easy configuration +ENV CURA_BENV_BUILD_TYPE=Release ENV CURA_BRANCH=master ENV URANIUM_BRANCH=$CURA_BRANCH +ENV CURA_ENGINE_BRANCH=$CURA_BRANCH ENV CURA_BENV_GIT_DIR=/srv/cura RUN mkdir $CURA_BENV_GIT_DIR @@ -17,11 +19,28 @@ RUN export PYTHOHPATH="${PYTHONPATH}:$CURA_BENV_GIT_DIR/Uranium" # Setup Cura WORKDIR $CURA_BENV_GIT_DIR -RUN git clone https://github.com/Ultimaker/cura +RUN git clone https://github.com/Ultimaker/Cura WORKDIR $CURA_BENV_GIT_DIR/Cura RUN git fetch origin RUN git checkout origin $CURA_BRANCH +# Setup CuraEngine +WORKDIR $CURA_BENV_GIT_DIR +RUN git clone https://github.com/Ultimaker/CuraEngine +WORKDIR $CURA_BENV_GIT_DIR/CuraEngine +RUN git fetch origin +RUN git checkout $URANIUM_BRANCH +RUN mkdir build +WORKDIR $CURA_BENV_GIT_DIR/CuraEngine/build +RUN cmake3 .. \ + -DCMAKE_BUILD_TYPE=$CURA_BENV_BUILD_TYPE \ + -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_COMPILER=g++ +RUN make + +# Make sure Cura can find CuraEngine +RUN ln -s /usr/local/bin/CuraEngine $CURA_BENV_GIT_DIR/Cura + # Run Cura WORKDIR $CURA_BENV_GIT_DIR/Cura CMD ["python3", "cura_app.py"] From e1a6ab098a5ebf79a0a21fdb16ad55f740335682 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 27 Feb 2018 16:21:07 +0100 Subject: [PATCH 04/14] Rename source paths env variable --- Dockerfile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3f21496e92..b2ecb5e843 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,33 +5,33 @@ ENV CURA_BENV_BUILD_TYPE=Release ENV CURA_BRANCH=master ENV URANIUM_BRANCH=$CURA_BRANCH ENV CURA_ENGINE_BRANCH=$CURA_BRANCH -ENV CURA_BENV_GIT_DIR=/srv/cura +ENV CURA_APP_DIR=/srv/cura -RUN mkdir $CURA_BENV_GIT_DIR +RUN mkdir $CURA_APP_DIR # Setup Uranium -WORKDIR $CURA_BENV_GIT_DIR +WORKDIR $CURA_APP_DIR RUN git clone https://github.com/Ultimaker/Uranium -WORKDIR $CURA_BENV_GIT_DIR/Uranium +WORKDIR $CURA_APP_DIR/Uranium RUN git fetch origin RUN git checkout $URANIUM_BRANCH -RUN export PYTHOHPATH="${PYTHONPATH}:$CURA_BENV_GIT_DIR/Uranium" +RUN export PYTHOHPATH="${PYTHONPATH}:$CURA_APP_DIR/Uranium" # Setup Cura -WORKDIR $CURA_BENV_GIT_DIR +WORKDIR $CURA_APP_DIR RUN git clone https://github.com/Ultimaker/Cura -WORKDIR $CURA_BENV_GIT_DIR/Cura +WORKDIR $CURA_APP_DIR/Cura RUN git fetch origin RUN git checkout origin $CURA_BRANCH # Setup CuraEngine -WORKDIR $CURA_BENV_GIT_DIR +WORKDIR $CURA_APP_DIR RUN git clone https://github.com/Ultimaker/CuraEngine -WORKDIR $CURA_BENV_GIT_DIR/CuraEngine +WORKDIR $CURA_APP_DIR/CuraEngine RUN git fetch origin RUN git checkout $URANIUM_BRANCH RUN mkdir build -WORKDIR $CURA_BENV_GIT_DIR/CuraEngine/build +WORKDIR $CURA_APP_DIR/CuraEngine/build RUN cmake3 .. \ -DCMAKE_BUILD_TYPE=$CURA_BENV_BUILD_TYPE \ -DCMAKE_C_COMPILER=gcc \ @@ -39,8 +39,8 @@ RUN cmake3 .. \ RUN make # Make sure Cura can find CuraEngine -RUN ln -s /usr/local/bin/CuraEngine $CURA_BENV_GIT_DIR/Cura +RUN ln -s /usr/local/bin/CuraEngine $CURA_APP_DIR/Cura # Run Cura -WORKDIR $CURA_BENV_GIT_DIR/Cura +WORKDIR $CURA_APP_DIR/Cura CMD ["python3", "cura_app.py"] From d3f7771e16e00b15efd08214eab146950bfdb6b6 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 27 Feb 2018 16:24:17 +0100 Subject: [PATCH 05/14] Simplify cura engine cmake --- Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b2ecb5e843..3f2a3a239e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,10 +32,7 @@ RUN git fetch origin RUN git checkout $URANIUM_BRANCH RUN mkdir build WORKDIR $CURA_APP_DIR/CuraEngine/build -RUN cmake3 .. \ - -DCMAKE_BUILD_TYPE=$CURA_BENV_BUILD_TYPE \ - -DCMAKE_C_COMPILER=gcc \ - -DCMAKE_CXX_COMPILER=g++ +RUN cmake3 .. RUN make # Make sure Cura can find CuraEngine From cee0887d1b146ab88fa22ac61f08bd5cacd66d68 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 27 Feb 2018 16:24:50 +0100 Subject: [PATCH 06/14] Fix typo in python path --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3f2a3a239e..1a0cbe0fff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN git clone https://github.com/Ultimaker/Uranium WORKDIR $CURA_APP_DIR/Uranium RUN git fetch origin RUN git checkout $URANIUM_BRANCH -RUN export PYTHOHPATH="${PYTHONPATH}:$CURA_APP_DIR/Uranium" +RUN export PYTHONPATH="${PYTHONPATH}:$CURA_APP_DIR/Uranium" # Setup Cura WORKDIR $CURA_APP_DIR From 1c2999551b036755e66d889c620e3a5a3d2ead86 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 28 Feb 2018 10:30:51 +0100 Subject: [PATCH 07/14] install materials, install cura engine, run headless --- Dockerfile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a0cbe0fff..30aacfdb56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,14 @@ -FROM ultimaker/cura-build-environment:3.2 +FROM ultimaker/cura-build-environment:1 # Environment vars for easy configuration ENV CURA_BENV_BUILD_TYPE=Release -ENV CURA_BRANCH=master +ENV CURA_BRANCH=3.2 ENV URANIUM_BRANCH=$CURA_BRANCH ENV CURA_ENGINE_BRANCH=$CURA_BRANCH +ENV MATERIALS_BRANCH=$CURA_BRANCH ENV CURA_APP_DIR=/srv/cura +# Ensure our sources dir exists RUN mkdir $CURA_APP_DIR # Setup Uranium @@ -15,7 +17,7 @@ RUN git clone https://github.com/Ultimaker/Uranium WORKDIR $CURA_APP_DIR/Uranium RUN git fetch origin RUN git checkout $URANIUM_BRANCH -RUN export PYTHONPATH="${PYTHONPATH}:$CURA_APP_DIR/Uranium" +RUN export PYTHONPATH=${PYTHONPATH}:$CURA_APP_DIR/Uranium # Setup Cura WORKDIR $CURA_APP_DIR @@ -24,6 +26,13 @@ WORKDIR $CURA_APP_DIR/Cura RUN git fetch origin RUN git checkout origin $CURA_BRANCH +# Setup materials +WORKDIR $CURA_APP_DIR/Cura/resources +RUN git clone https://github.com/Ultimaker/fdm_materials materials +WORKDIR $CURA_APP_DIR/Cura/resources/materials +RUN git fetch origin +RUN git checkout origin $MATERIALS_BRANCH + # Setup CuraEngine WORKDIR $CURA_APP_DIR RUN git clone https://github.com/Ultimaker/CuraEngine @@ -34,10 +43,13 @@ RUN mkdir build WORKDIR $CURA_APP_DIR/CuraEngine/build RUN cmake3 .. RUN make +RUN make install + +# TODO: setup libCharon # Make sure Cura can find CuraEngine RUN ln -s /usr/local/bin/CuraEngine $CURA_APP_DIR/Cura # Run Cura WORKDIR $CURA_APP_DIR/Cura -CMD ["python3", "cura_app.py"] +CMD ["python3", "cura_app.py", "--headless"] From 8b1bca6743581d9d31300bd36ff6e0b87d586e8a Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Thu, 1 Mar 2018 10:58:18 +0100 Subject: [PATCH 08/14] Add run in docker script --- Dockerfile | 26 ++++++++++++-------------- run_in_docker.sh | 3 +++ 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 run_in_docker.sh diff --git a/Dockerfile b/Dockerfile index 30aacfdb56..464aebff53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,32 +13,23 @@ RUN mkdir $CURA_APP_DIR # Setup Uranium WORKDIR $CURA_APP_DIR -RUN git clone https://github.com/Ultimaker/Uranium +RUN git clone -b $URANIUM_BRANCH --depth 1 https://github.com/Ultimaker/Uranium WORKDIR $CURA_APP_DIR/Uranium -RUN git fetch origin -RUN git checkout $URANIUM_BRANCH -RUN export PYTHONPATH=${PYTHONPATH}:$CURA_APP_DIR/Uranium # Setup Cura WORKDIR $CURA_APP_DIR -RUN git clone https://github.com/Ultimaker/Cura +RUN git clone -b $CURA_BRANCH --depth 1 https://github.com/Ultimaker/Cura WORKDIR $CURA_APP_DIR/Cura -RUN git fetch origin -RUN git checkout origin $CURA_BRANCH # Setup materials WORKDIR $CURA_APP_DIR/Cura/resources -RUN git clone https://github.com/Ultimaker/fdm_materials materials +RUN git clone -b $MATERIALS_BRANCH --depth 1 https://github.com/Ultimaker/fdm_materials materials WORKDIR $CURA_APP_DIR/Cura/resources/materials -RUN git fetch origin -RUN git checkout origin $MATERIALS_BRANCH # Setup CuraEngine WORKDIR $CURA_APP_DIR -RUN git clone https://github.com/Ultimaker/CuraEngine +RUN git clone -b $CURA_ENGINE_BRANCH --depth 1 https://github.com/Ultimaker/CuraEngine WORKDIR $CURA_APP_DIR/CuraEngine -RUN git fetch origin -RUN git checkout $URANIUM_BRANCH RUN mkdir build WORKDIR $CURA_APP_DIR/CuraEngine/build RUN cmake3 .. @@ -50,6 +41,13 @@ RUN make install # Make sure Cura can find CuraEngine RUN ln -s /usr/local/bin/CuraEngine $CURA_APP_DIR/Cura +# Tmp cleanup +RUN rm -Rf /var/cache + # Run Cura WORKDIR $CURA_APP_DIR/Cura -CMD ["python3", "cura_app.py", "--headless"] +ENV PYTHONPATH=${PYTHONPATH}:$CURA_APP_DIR/Uranium +ENV DISPLAY=:1.0 +ADD run_in_docker.sh . +RUN chmod +x ./run_in_docker.sh +CMD "./run_in_docker.sh" diff --git a/run_in_docker.sh b/run_in_docker.sh new file mode 100644 index 0000000000..1e939a2739 --- /dev/null +++ b/run_in_docker.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +Xvfb :1 -screen 0 1280x800x16 & +python3 cura_app.py --headless \ No newline at end of file From e8481f55055d0128d4875c315f2c554299994193 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Thu, 1 Mar 2018 11:00:49 +0100 Subject: [PATCH 09/14] Cleanup --- Dockerfile | 13 ++++--------- run_in_docker.sh | 1 + 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 464aebff53..d4338c1a4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,10 @@ FROM ultimaker/cura-build-environment:1 # Environment vars for easy configuration ENV CURA_BENV_BUILD_TYPE=Release -ENV CURA_BRANCH=3.2 -ENV URANIUM_BRANCH=$CURA_BRANCH -ENV CURA_ENGINE_BRANCH=$CURA_BRANCH -ENV MATERIALS_BRANCH=$CURA_BRANCH +ENV CURA_BRANCH=docker +ENV URANIUM_BRANCH=3.2 +ENV CURA_ENGINE_BRANCH=3.2 +ENV MATERIALS_BRANCH=3.2 ENV CURA_APP_DIR=/srv/cura # Ensure our sources dir exists @@ -41,13 +41,8 @@ RUN make install # Make sure Cura can find CuraEngine RUN ln -s /usr/local/bin/CuraEngine $CURA_APP_DIR/Cura -# Tmp cleanup -RUN rm -Rf /var/cache - # Run Cura WORKDIR $CURA_APP_DIR/Cura ENV PYTHONPATH=${PYTHONPATH}:$CURA_APP_DIR/Uranium -ENV DISPLAY=:1.0 -ADD run_in_docker.sh . RUN chmod +x ./run_in_docker.sh CMD "./run_in_docker.sh" diff --git a/run_in_docker.sh b/run_in_docker.sh index 1e939a2739..eb364fd887 100644 --- a/run_in_docker.sh +++ b/run_in_docker.sh @@ -1,3 +1,4 @@ #!/usr/bin/env bash Xvfb :1 -screen 0 1280x800x16 & +export DISPLAY=:1.0 python3 cura_app.py --headless \ No newline at end of file From 700254ffc910d1e3c52cba6eec93bc7cbf4bb9cf Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Thu, 1 Mar 2018 11:40:08 +0100 Subject: [PATCH 10/14] use master for testing --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d4338c1a4f..65c6851b31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,9 @@ FROM ultimaker/cura-build-environment:1 # Environment vars for easy configuration ENV CURA_BENV_BUILD_TYPE=Release ENV CURA_BRANCH=docker -ENV URANIUM_BRANCH=3.2 -ENV CURA_ENGINE_BRANCH=3.2 -ENV MATERIALS_BRANCH=3.2 +ENV URANIUM_BRANCH=master +ENV CURA_ENGINE_BRANCH=master +ENV MATERIALS_BRANCH=master ENV CURA_APP_DIR=/srv/cura # Ensure our sources dir exists From 2b0211a45f510c81e8a9b2d47ff8c39f4c313cec Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Thu, 1 Mar 2018 11:45:40 +0100 Subject: [PATCH 11/14] Move build steps for better caching strategy --- Dockerfile | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 65c6851b31..3e6adc0f4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,13 @@ FROM ultimaker/cura-build-environment:1 # Environment vars for easy configuration -ENV CURA_BENV_BUILD_TYPE=Release -ENV CURA_BRANCH=docker -ENV URANIUM_BRANCH=master -ENV CURA_ENGINE_BRANCH=master -ENV MATERIALS_BRANCH=master ENV CURA_APP_DIR=/srv/cura # Ensure our sources dir exists RUN mkdir $CURA_APP_DIR -# Setup Uranium -WORKDIR $CURA_APP_DIR -RUN git clone -b $URANIUM_BRANCH --depth 1 https://github.com/Ultimaker/Uranium -WORKDIR $CURA_APP_DIR/Uranium - -# Setup Cura -WORKDIR $CURA_APP_DIR -RUN git clone -b $CURA_BRANCH --depth 1 https://github.com/Ultimaker/Cura -WORKDIR $CURA_APP_DIR/Cura - -# Setup materials -WORKDIR $CURA_APP_DIR/Cura/resources -RUN git clone -b $MATERIALS_BRANCH --depth 1 https://github.com/Ultimaker/fdm_materials materials -WORKDIR $CURA_APP_DIR/Cura/resources/materials - # Setup CuraEngine +ENV CURA_ENGINE_BRANCH=master WORKDIR $CURA_APP_DIR RUN git clone -b $CURA_ENGINE_BRANCH --depth 1 https://github.com/Ultimaker/CuraEngine WORKDIR $CURA_APP_DIR/CuraEngine @@ -38,6 +19,24 @@ RUN make install # TODO: setup libCharon +# Setup Uranium +ENV URANIUM_BRANCH=master +WORKDIR $CURA_APP_DIR +RUN git clone -b $URANIUM_BRANCH --depth 1 https://github.com/Ultimaker/Uranium +WORKDIR $CURA_APP_DIR/Uranium + +# Setup materials +ENV MATERIALS_BRANCH=master +WORKDIR $CURA_APP_DIR/Cura/resources +RUN git clone -b $MATERIALS_BRANCH --depth 1 https://github.com/Ultimaker/fdm_materials materials +WORKDIR $CURA_APP_DIR/Cura/resources/materials + +# Setup Cura +ENV CURA_BRANCH=docker +WORKDIR $CURA_APP_DIR +RUN git clone -b $CURA_BRANCH --depth 1 https://github.com/Ultimaker/Cura +WORKDIR $CURA_APP_DIR/Cura + # Make sure Cura can find CuraEngine RUN ln -s /usr/local/bin/CuraEngine $CURA_APP_DIR/Cura From a8bf44003f0fd8d362efd41b44cf873cda40b921 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Thu, 1 Mar 2018 11:52:09 +0100 Subject: [PATCH 12/14] Some fixes in Dockerfile --- Dockerfile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3e6adc0f4c..b2b6243071 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,19 +23,16 @@ RUN make install ENV URANIUM_BRANCH=master WORKDIR $CURA_APP_DIR RUN git clone -b $URANIUM_BRANCH --depth 1 https://github.com/Ultimaker/Uranium -WORKDIR $CURA_APP_DIR/Uranium - -# Setup materials -ENV MATERIALS_BRANCH=master -WORKDIR $CURA_APP_DIR/Cura/resources -RUN git clone -b $MATERIALS_BRANCH --depth 1 https://github.com/Ultimaker/fdm_materials materials -WORKDIR $CURA_APP_DIR/Cura/resources/materials # Setup Cura ENV CURA_BRANCH=docker WORKDIR $CURA_APP_DIR RUN git clone -b $CURA_BRANCH --depth 1 https://github.com/Ultimaker/Cura -WORKDIR $CURA_APP_DIR/Cura + +# Setup materials +ENV MATERIALS_BRANCH=master +WORKDIR $CURA_APP_DIR/Cura/resources +RUN git clone -b $MATERIALS_BRANCH --depth 1 https://github.com/Ultimaker/fdm_materials materials # Make sure Cura can find CuraEngine RUN ln -s /usr/local/bin/CuraEngine $CURA_APP_DIR/Cura From cd01b096b52357c6384e555a141505cebb3c65cf Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Mon, 5 Mar 2018 14:33:13 +0100 Subject: [PATCH 13/14] Emit backend errors so we can process them differently than through a qml notification --- .dockerignore | 4 ++++ Dockerfile | 13 +++++++------ plugins/CuraEngineBackend/CuraEngineBackend.py | 9 +++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..d25d71bcc9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.git +.github +resources/materials +CuraEngine \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b2b6243071..68255c56b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,21 +24,22 @@ ENV URANIUM_BRANCH=master WORKDIR $CURA_APP_DIR RUN git clone -b $URANIUM_BRANCH --depth 1 https://github.com/Ultimaker/Uranium -# Setup Cura -ENV CURA_BRANCH=docker -WORKDIR $CURA_APP_DIR -RUN git clone -b $CURA_BRANCH --depth 1 https://github.com/Ultimaker/Cura - # Setup materials ENV MATERIALS_BRANCH=master -WORKDIR $CURA_APP_DIR/Cura/resources +WORKDIR $CURA_APP_DIR RUN git clone -b $MATERIALS_BRANCH --depth 1 https://github.com/Ultimaker/fdm_materials materials +# Setup Cura +WORKDIR $CURA_APP_DIR/Cura +ADD . . +RUN mv $CURA_APP_DIR/materials resources/materials + # Make sure Cura can find CuraEngine RUN ln -s /usr/local/bin/CuraEngine $CURA_APP_DIR/Cura # Run Cura WORKDIR $CURA_APP_DIR/Cura ENV PYTHONPATH=${PYTHONPATH}:$CURA_APP_DIR/Uranium +RUN chmod +x ./CuraEngine RUN chmod +x ./run_in_docker.sh CMD "./run_in_docker.sh" diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 3982a0ad06..ffeddf21cc 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -33,6 +33,9 @@ from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") class CuraEngineBackend(QObject, Backend): + + backendError = Signal() + ## Starts the back-end plug-in. # # This registers all the signal listeners and prepares for communication @@ -289,6 +292,7 @@ class CuraEngineBackend(QObject, Backend): if job.isCancelled() or job.getError() or job.getResult() == StartSliceJob.StartJobResult.Error: self.backendStateChange.emit(BackendState.Error) + self.backendError.emit(job) return if job.getResult() == StartSliceJob.StartJobResult.MaterialIncompatible: @@ -297,6 +301,7 @@ class CuraEngineBackend(QObject, Backend): "Unable to slice with the current material as it is incompatible with the selected machine or configuration."), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() self.backendStateChange.emit(BackendState.Error) + self.backendError.emit(job) else: self.backendStateChange.emit(BackendState.NotStarted) return @@ -325,6 +330,7 @@ class CuraEngineBackend(QObject, Backend): title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() self.backendStateChange.emit(BackendState.Error) + self.backendError.emit(job) else: self.backendStateChange.emit(BackendState.NotStarted) return @@ -347,6 +353,7 @@ class CuraEngineBackend(QObject, Backend): title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() self.backendStateChange.emit(BackendState.Error) + self.backendError.emit(job) return if job.getResult() == StartSliceJob.StartJobResult.BuildPlateError: @@ -355,6 +362,7 @@ class CuraEngineBackend(QObject, Backend): title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() self.backendStateChange.emit(BackendState.Error) + self.backendError.emit(job) else: self.backendStateChange.emit(BackendState.NotStarted) @@ -364,6 +372,7 @@ class CuraEngineBackend(QObject, Backend): title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() self.backendStateChange.emit(BackendState.Error) + self.backendError.emit(job) else: self.backendStateChange.emit(BackendState.NotStarted) self._invokeSlice() From 5a8f2040d3695a83000aa67ad1a6f038fcc95c02 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Mon, 5 Mar 2018 17:53:40 +0100 Subject: [PATCH 14/14] Add method to machine manager to get a machine stack by definition id --- cura/Settings/MachineManager.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index e357d778ca..d478321ffc 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -306,6 +306,14 @@ class MachineManager(QObject): self.__emitChangedSignals() + @staticmethod + def getMachine(definition_id: str) -> Optional["GlobalStack"]: + machines = ContainerRegistry.getInstance().findContainerStacks(type = "machine") + for machine in machines: + if machine.definition.getId() == definition_id: + return machine + return None + @pyqtSlot(str, str) def addMachine(self, name: str, definition_id: str) -> None: new_stack = CuraStackBuilder.createMachine(name, definition_id)