Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 470e539

Browse files
Caleb R LittleCaleb R Little
authored andcommitted
Fixed issue where importing the Layer object in different ways could
trick the system into thinking that the Layer object wasn't the Layer object.
1 parent 686478d commit 470e539

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

layers/exporters/svg_objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def build(height, width, label, config, variant='text', t1text=None, t2text=None
260260
upper = G(tx=0, ty=2.1)
261261
internal.append(upper)
262262
if t1text is not None:
263-
bu = t2text is not None and t2text is not ""
263+
bu = t2text != None and t2text != ""
264264
theight = (height-5)
265265
if bu:
266266
theight = theight / 2

layers/exporters/to_svg.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from ..core import Layer
88
from ..exporters.svg_templates import SvgTemplates
99

10+
from layers.core import Layer as topLayer # alternative import for typechecking
11+
1012
class NoLayer(Exception):
1113
pass
1214

@@ -405,7 +407,7 @@ def to_svg(self, layer, filepath='example.svg'):
405407
:return: (meta) svg file at the targeted output location
406408
"""
407409
if layer is not None:
408-
if not isinstance(layer, Layer):
410+
if not isinstance(layer, Layer) and not isinstance(layer, topLayer):
409411
raise TypeError
410412

411413
if layer is None:

0 commit comments

Comments
 (0)