Skip to content

Commit

Permalink
fix #1064
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomusy committed Mar 3, 2024
1 parent 6a2acca commit 06700d5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
8 changes: 4 additions & 4 deletions vedo/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ def button_func(obj, ename):
size=16,
bold=True,
)
bu.pos([0.04, 0.01], "bottom-left")
if bu:
bu.pos([0.04, 0.01], "bottom-left")


####################################################################################
Expand Down Expand Up @@ -1024,7 +1025,7 @@ def __init__(
delayed=False,
sliderpos=4,
**kwargs,
):
) -> None:
"""
Generate a `vedo.Plotter` for Volume isosurfacing using a slider.
Expand Down Expand Up @@ -1163,8 +1164,7 @@ def slider_isovalue(widget, event):
mesh = volume.isosurface(value).color(c).alpha(alpha)
bacts.update({value_name: mesh}) # store it

self.renderer.RemoveActor(prevact)
self.renderer.AddActor(mesh)
self.remove(prevact).add(mesh)
self.vol_actors[0] = mesh

################################################
Expand Down
14 changes: 10 additions & 4 deletions vedo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,16 @@ def exe_run(args):
from pygments import highlight
from pygments.lexers import Python3Lexer
from pygments.formatters import Terminal256Formatter

# from pygments.styles import STYLE_MAP
# print(STYLE_MAP.keys())
result = highlight(code, Python3Lexer(), Terminal256Formatter(style="zenburn"))
from pygments.styles import STYLE_MAP

# print("Terminal256Formatter STYLE_MAP", STYLE_MAP.keys())
if "zenburn" in STYLE_MAP.keys():
tform = Terminal256Formatter(style="zenburn")
elif "monokai" in STYLE_MAP.keys():
tform = Terminal256Formatter(style="monokai")
else:
tform = Terminal256Formatter()
result = highlight(code, Python3Lexer(), tform)
print(result, end="")

printc("(" + matching[0] + ")", c="y", bold=0, italic=1)
Expand Down
6 changes: 3 additions & 3 deletions vedo/file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import time
from tempfile import NamedTemporaryFile, TemporaryDirectory
from typing import Any, List, Union
from typing import Any, List, Tuple, Union

import numpy as np

Expand Down Expand Up @@ -591,7 +591,7 @@ def gunzip(filename: str) -> str:
return tmp_file.name

########################################################################
def file_info(file_path: str) -> tuple[str, str]:
def file_info(file_path: str) -> Tuple[str, str]:
"""Return the file size and creation time of input file"""
siz, created = "", ""
if os.path.isfile(file_path):
Expand Down Expand Up @@ -751,7 +751,7 @@ def loadDolfin(filename: str) -> Union[Mesh, "vedo.TetMesh", None]:


########################################################################
def loadPVD(filename: str) -> Union[list[Any], None]:
def loadPVD(filename: str) -> Union[List[Any], None]:
"""Read paraview files."""
import xml.etree.ElementTree as et

Expand Down
12 changes: 10 additions & 2 deletions vedo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import os
import time
from typing import Union, Tuple, MutableSequence, List, Dict
from typing import Union, Tuple, MutableSequence, List
import numpy as np

from vtkmodules.util.numpy_support import numpy_to_vtk, vtk_to_numpy
Expand Down Expand Up @@ -2200,7 +2200,15 @@ def vtkCameraToK3D(vtkcam) -> np.ndarray:
return np.array(kam).ravel()


def make_ticks(x0: float, x1: float, n=None, labels=None, digits=None, logscale=False, useformat="") -> Tuple[np.ndarray, List[str]]:
def make_ticks(
x0: float,
x1: float,
n=None,
labels=None,
digits=None,
logscale=False,
useformat="",
) -> Tuple[np.ndarray, List[str]]:
"""
Generate numeric labels for the `[x0, x1]` range.
Expand Down
2 changes: 1 addition & 1 deletion vedo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
_version = '2024.5.1+dev03'
_version = '2024.5.1+dev04'
4 changes: 2 additions & 2 deletions vedo/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ def spacing(self, s=None) -> Union["Volume", Iterable[float]]:
return self
return np.array(self.dataset.GetSpacing())

def origin(self, s=None) -> Union["Volume", np.ndarray[Any, Any]]:
def origin(self, s=None) -> Union["Volume", Iterable[float]]:
"""
Set/get the origin of the volumetric dataset.
Expand All @@ -827,7 +827,7 @@ def origin(self, s=None) -> Union["Volume", np.ndarray[Any, Any]]:
return self
return np.array(self.dataset.GetOrigin())

def pos(self, p=None) -> Union["Volume", np.ndarray]:
def pos(self, p=None) -> Union["Volume", Iterable[float]]:
"""Set/get the position of the volumetric dataset."""
if p is not None:
self.origin(p)
Expand Down

0 comments on commit 06700d5

Please sign in to comment.