summaryrefslogtreecommitdiff
path: root/lib/extensions/lettering.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/extensions/lettering.py')
-rw-r--r--lib/extensions/lettering.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/extensions/lettering.py b/lib/extensions/lettering.py
index 75a18b24..875dea03 100644
--- a/lib/extensions/lettering.py
+++ b/lib/extensions/lettering.py
@@ -13,8 +13,6 @@ import inkex
import wx
import wx.adv
-from .commands import CommandsExtension
-from .lettering_custom_font_dir import get_custom_font_dir
from ..elements import nodes_to_elements
from ..gui import PresetsPanel, SimulatorPreview, info_dialog
from ..i18n import _
@@ -22,7 +20,9 @@ from ..lettering import Font, FontError
from ..svg import get_correction_transform
from ..svg.tags import (INKSCAPE_LABEL, INKSTITCH_LETTERING, SVG_GROUP_TAG,
SVG_PATH_TAG)
-from ..utils import DotDict, cache, get_bundled_dir
+from ..utils import DotDict, cache, get_bundled_dir, get_resource_dir
+from .commands import CommandsExtension
+from .lettering_custom_font_dir import get_custom_font_dir
class LetteringFrame(wx.Frame):
@@ -41,6 +41,9 @@ class LetteringFrame(wx.Frame):
_("Ink/Stitch Lettering")
)
+ icon = wx.Icon(os.path.join(get_resource_dir("icons"), "inkstitch256x256.png"))
+ self.SetIcon(icon)
+
self.preview = SimulatorPreview(self, target_duration=1)
self.presets_panel = PresetsPanel(self)
@@ -139,10 +142,10 @@ class LetteringFrame(wx.Frame):
for font_dir in font_dirs:
font = Font(os.path.join(font_path, font_dir))
- if font.name == "" or font.id == "":
+ if font.marked_custom_font_name == "" or font.marked_custom_font_id == "":
continue
- self.fonts[font.name] = font
- self.fonts_by_id[font.id] = font
+ self.fonts[font.marked_custom_font_name] = font
+ self.fonts_by_id[font.marked_custom_font_id] = font
if len(self.fonts) == 0:
info_dialog(self, _("Unable to find any fonts! Please try reinstalling Ink/Stitch."))
@@ -151,6 +154,7 @@ class LetteringFrame(wx.Frame):
def set_font_list(self):
for font in self.fonts.values():
image = font.preview_image
+
if image is not None:
image = wx.Image(font.preview_image)
"""
@@ -166,16 +170,10 @@ class LetteringFrame(wx.Frame):
"""
# Windows requires all images to have the exact same size
image.Rescale(300, 20, quality=wx.IMAGE_QUALITY_HIGH)
- self.font_chooser.Append(font.name, wx.Bitmap(image))
+ self.font_chooser.Append(font.marked_custom_font_name, wx.Bitmap(image))
else:
self.font_chooser.Append(font.name)
- def get_font_names(self):
- font_names = [font.name for font in self.fonts.values()]
- font_names.sort()
-
- return font_names
-
def get_font_descriptions(self):
return {font.name: font.description for font in self.fonts.values()}
@@ -186,9 +184,11 @@ class LetteringFrame(wx.Frame):
'''A default font will be substituted.'''
info_dialog(self, _(message) % font_id)
try:
- self.font_chooser.SetValue(self.fonts_by_id[font_id].name)
+ font = self.fonts_by_id[font_id].marked_custom_font_name
except KeyError:
- self.font_chooser.SetValue(self.default_font.name)
+ font = self.default_font.name
+ self.font_chooser.SetValue(font)
+
self.on_font_changed()
@property
@@ -205,7 +205,7 @@ class LetteringFrame(wx.Frame):
def on_font_changed(self, event=None):
font = self.fonts.get(self.font_chooser.GetValue(), self.default_font)
- self.settings.font = font.id
+ self.settings.font = font.marked_custom_font_id
self.scale_spinner.SetRange(int(font.min_scale * 100), int(font.max_scale * 100))
font_variants = []