Skip to content

Commit ab7ff46

Browse files
authored
"Add" overwrites presets (inkstitch#3896)
* style * param presets: to not overwrite on add when name exists
1 parent eb0e1b0 commit ab7ff46

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

lib/extensions/lettering_svg_font_to_layers.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828

2929
from ..svg import PIXELS_PER_MM
3030

31-
import unicodedata
32-
3331

3432
class LetteringSvgFontToLayers(InkstitchExtension):
3533
"""
@@ -162,7 +160,7 @@ def set_guide_lines(self, font, scale_by) -> float:
162160

163161
return baseline
164162

165-
def convert_glyph_to_layer(self, glyph, emsize, baseline, scale_by, hide_layer):
163+
def convert_glyph_to_layer(self, glyph, emsize, baseline, scale_by, hide_layer): # noqa C901
166164
"""
167165
Converts a single glyph into a new SVG layer, applying scaling and coordinate transformation.
168166
"""
@@ -198,7 +196,7 @@ def convert_glyph_to_layer(self, glyph, emsize, baseline, scale_by, hide_layer):
198196

199197
unicode_char = glyph.get("unicode")
200198
if unicode_char is None:
201-
199+
202200
glyph_name = glyph.get("glyph-name").split('.')
203201
if unicode_char is None:
204202
if len(glyph_name) == 2:

lib/gui/presets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def add_preset(self, event, overwrite=False):
137137

138138
if not overwrite and preset_name in self._load_presets():
139139
info_dialog(self, _('Preset "%s" already exists. Please use another name or press "Overwrite"') % preset_name, caption=_('Preset'))
140+
return
140141

141142
self.store_preset(preset_name, self.parent.get_preset_data())
142143

lib/lettering/font_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ def horiz_adv_x(self):
4040
hax = float(hax)
4141

4242
glyph_name = glyph.get('glyph-name', None)
43-
43+
4444
if glyph_name is not None:
4545
glyph_name = glyph_name.split('.')
4646
if len(glyph_name) == 2:
47-
if ord(unicode_char[0]) >= 57344 :
47+
if ord(unicode_char[0]) >= 57344:
4848
unicode_char = glyph_name[0]
4949
typographic_feature = glyph_name[1]
5050
unicode_char += f'.{typographic_feature}'

0 commit comments

Comments
 (0)