summaryrefslogtreecommitdiff
path: root/lib/gui/lettering.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-04-27 10:02:20 +0200
committerGitHub <noreply@github.com>2024-04-27 10:02:20 +0200
commited33b29c280843b48670d510a07e80a629bbcb9e (patch)
treee75f80365624c230778882969882d892e4bafb81 /lib/gui/lettering.py
parenta010866680ab005992a41c9ccb2b832d21d49234 (diff)
Font sampling extension (#2858)
Diffstat (limited to 'lib/gui/lettering.py')
-rw-r--r--lib/gui/lettering.py28
1 files changed, 3 insertions, 25 deletions
diff --git a/lib/gui/lettering.py b/lib/gui/lettering.py
index 0d006f9e..edbebb20 100644
--- a/lib/gui/lettering.py
+++ b/lib/gui/lettering.py
@@ -4,23 +4,20 @@
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
import json
-import os
from base64 import b64decode
-import appdirs
import inkex
import wx
import wx.adv
import wx.lib.agw.floatspin as fs
from ..elements import nodes_to_elements
-from ..extensions.lettering_custom_font_dir import get_custom_font_dir
from ..i18n import _
-from ..lettering import Font, FontError
+from ..lettering import FontError, get_font_list
from ..lettering.categories import FONT_CATEGORIES, FontCategory
from ..stitch_plan import stitch_groups_to_stitch_plan
from ..svg.tags import INKSCAPE_LABEL, INKSTITCH_LETTERING, SVG_PATH_TAG
-from ..utils import DotDict, cache, get_bundled_dir
+from ..utils import DotDict, cache
from ..utils.threading import ExitThread, check_stop_flag
from . import PresetsPanel, PreviewRenderer, info_dialog
@@ -153,26 +150,7 @@ class LetteringPanel(wx.Panel):
@property
@cache
def font_list(self):
- fonts = []
- font_paths = {
- get_bundled_dir("fonts"),
- os.path.expanduser("~/.inkstitch/fonts"),
- os.path.join(appdirs.user_config_dir('inkstitch'), 'fonts'),
- get_custom_font_dir()
- }
-
- for font_path in font_paths:
- try:
- font_dirs = os.listdir(font_path)
- except OSError:
- continue
-
- for font_dir in font_dirs:
- font = Font(os.path.join(font_path, font_dir))
- if font.marked_custom_font_name == "" or font.marked_custom_font_id == "":
- continue
- fonts.append(font)
- return fonts
+ return get_font_list()
def update_font_list(self):
self.fonts = {}