stabilizing, user experience

use class for glyph availability
use isinstance instead of type
better user experience when export directory does not exist
This commit is contained in:
jrkb 2025-05-29 15:27:24 +02:00
parent 777644e509
commit 335ab1face
4 changed files with 279 additions and 129 deletions

View file

@ -89,6 +89,26 @@ def printerr(*args, **kwargs):
def removeNonAlphabetic(s):
return "".join([i for i in s if i.isalpha()])
import pathlib
import os
def can_create_path(path_str : str):
path = pathlib.Path(path_str).absolute().resolve()
while True: # this looks dangerours, but it actually is not
if path.exists():
if os.access(path, os.W_OK):
return True
else:
return False
elif path == path.parent:
# should never be reached, because root exists
# but if it doesn't.. well then we can't
return False
path = path.parent
# # Evaluate a bezier curve for the parameter 0<=t<=1 along its length
# def evaluateBezierPoint(p1, h1, h2, p2, t):