From cb44ad7c1ac376156c3c54234aa04b5dbafa7d82 Mon Sep 17 00:00:00 2001 From: marcomusy Date: Thu, 1 Feb 2024 19:29:21 +0100 Subject: [PATCH] small fix to visual.py --- docs/changes.md | 1 + tests/pipeline.txt | 2 ++ tests/snippets/run_all.sh | 11 +++++++++++ tests/snippets/test_closewindow.py | 22 +++++++++++----------- tests/snippets/test_compare_fit1.py | 3 +++ vedo/visual.py | 4 ++-- 6 files changed, 30 insertions(+), 13 deletions(-) create mode 100755 tests/snippets/run_all.sh diff --git a/docs/changes.md b/docs/changes.md index 800f068e..da0a6ae0 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -141,3 +141,4 @@ meshquality.py streamlines1.py +madcad2 blocks tsts \ No newline at end of file diff --git a/tests/pipeline.txt b/tests/pipeline.txt index 4b5da414..129f8a7b 100644 --- a/tests/pipeline.txt +++ b/tests/pipeline.txt @@ -41,6 +41,7 @@ pytest tests cd $VEDODIR/tests/common && ./run_all.sh cd $VEDODIR/tests/issues && ./run_all.sh +cd $VEDODIR/tests/snippets && ./run_all.sh # EXAMPLES ########################################################################## cd $VEDODIR/examples && time ./run_all.sh 2>&1 | tee $VEDOLOGFILE && alert "scan done." @@ -63,6 +64,7 @@ cd $VEDODIR/examples/other/trimesh && ./run_all.sh # DOLFIN ##################################################################### # conda create -n fenics -c conda-forge fenics +# conda activate fenics # conda install conda-forge::mshr cd $VEDODIR conda activate fenics diff --git a/tests/snippets/run_all.sh b/tests/snippets/run_all.sh new file mode 100755 index 00000000..da82bbbb --- /dev/null +++ b/tests/snippets/run_all.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# source run_all.sh +# +echo Press Esc at anytime to skip example, F1 to interrupt + +for f in *.py + do + echo "----------------------------------------" + echo "Processing $f script.." + python "$f" + done diff --git a/tests/snippets/test_closewindow.py b/tests/snippets/test_closewindow.py index 4b1fc4ef..6d005dd2 100644 --- a/tests/snippets/test_closewindow.py +++ b/tests/snippets/test_closewindow.py @@ -17,7 +17,7 @@ printc('\nControl returned to terminal shell:', c='tomato', invert=1) # ask('window is now unresponsive (press Enter here)', c='tomato', invert=1) -plt1.close_window() +plt1.close() # window should now close, the Plotter instance becomes unusable # but mesh objects still exist in it: @@ -25,17 +25,17 @@ # plt1.show() # error here: window does not exist anymore. Cannot reopen. # ################################################################## -# # Can now create a brand new Plotter and show the old object in it -# plt2 = Plotter(title='Second Plotter instance', pos=(500,0)) -# plt2.show(plt1.objects[0].color('red')) +# Can now create a brand new Plotter and show the old object in it +plt2 = Plotter(title='Second Plotter instance', pos=(500,0)) +plt2.show(plt1.objects[0].color('red')) -# ################################################################## -# # Create a third new Plotter and then close the second -# plt3 = Plotter(title='Third Plotter instance') +################################################################## +# Create a third new Plotter and then close the second +plt3 = Plotter(title='Third Plotter instance') -# plt2.close_window() -# printc('plt2.close_window() called') +plt2.close() +printc('plt2.close() called') -# plt3.show(Hyperboloid()).close() +plt3.show(Hyperboloid()).close() -# printc('done.') +printc('done.') diff --git a/tests/snippets/test_compare_fit1.py b/tests/snippets/test_compare_fit1.py index f69a8403..9863c1dd 100644 --- a/tests/snippets/test_compare_fit1.py +++ b/tests/snippets/test_compare_fit1.py @@ -50,6 +50,9 @@ def fit_function(x, A, beta, B, mu, sigma): h.add_legend() h.show(zoom="tight") +if settings.dry_run_mode: + exit(0) + ############################################# matplotlib # Plot the histogram and the fitted function. import matplotlib.pyplot as plt diff --git a/vedo/visual.py b/vedo/visual.py index 093a5ac5..22acf07d 100644 --- a/vedo/visual.py +++ b/vedo/visual.py @@ -1892,7 +1892,7 @@ def labels2d( pr.ShadowOff() pr.UseTightBoundingBoxOn() pr.SetOrientation(angle) - pr.SetFontFamily(vtk.VTK_FONT_FILE) + pr.SetFontFamily(vtki.VTK_FONT_FILE) fl = utils.get_font_path(font) pr.SetFontFile(fl) pr.SetFontSize(int(20 * scale)) @@ -2249,7 +2249,7 @@ def caption( pra.SetLineWidth(lw) pr = capt.GetCaptionTextProperty() - pr.SetFontFamily(vtk.VTK_FONT_FILE) + pr.SetFontFamily(vtki.VTK_FONT_FILE) fl = utils.get_font_path(font) pr.SetFontFile(fl) pr.ShadowOff()