prefig 0.5.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {prefig-0.5.0 → prefig-0.5.1}/PKG-INFO +1 -1
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/annotations.py +8 -2
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/arrow.py +3 -3
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/axes.py +1 -1
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/clip.py +1 -1
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/diagram.py +14 -5
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/grid_axes.py +11 -6
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/legend.py +4 -4
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/repeat.py +3 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/shape.py +12 -1
- {prefig-0.5.0 → prefig-0.5.1}/pyproject.toml +1 -1
- {prefig-0.5.0 → prefig-0.5.1}/LICENSE +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/README.md +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/__init__.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/cli.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/CTM.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/__init__.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/area.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/calculus.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/circle.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/compat.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/coordinates.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/definition.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/diffeqs.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/graph.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/group.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/image.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/implicit.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/label.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/label_tools.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/line.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/math_utilities.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/network.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/parametric_curve.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/parse.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/path.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/point.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/polygon.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/read.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/rectangle.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/riemann_sum.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/slope_field.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/statistics.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/tags.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/tangent_line.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/user_namespace.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/utilities.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/core/vector.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/engine.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/diagcess/diagcess.html +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/diagcess/diagcess.js +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/examples/de-system.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/examples/derivatives.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/examples/diffeqs.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/examples/implicit.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/examples/projection.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/examples/riemann.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/examples/roots_of_unity.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/examples/tangent.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/fonts/Braille29.ttf +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/js/mj-sre-page.js +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/js/package.json +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/schema/pf_schema.rnc +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/schema/pf_schema.rng +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/resources/template/pf_publication.xml +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/scripts/__init__.py +0 -0
- {prefig-0.5.0 → prefig-0.5.1}/prefig/scripts/install_mj.py +0 -0
|
@@ -33,14 +33,20 @@ def annotate(element, diagram, parent = None):
|
|
|
33
33
|
parent = diagram.get_annotations_root()
|
|
34
34
|
|
|
35
35
|
if element.get('ref', None) is not None:
|
|
36
|
-
|
|
36
|
+
ref = element.get('ref')
|
|
37
|
+
if not ref.startswith('pf__'):
|
|
38
|
+
ref = 'pf__' + ref
|
|
39
|
+
element.set('id', ref)
|
|
37
40
|
element.attrib.pop('ref')
|
|
38
41
|
else:
|
|
39
42
|
log.info(f"An annotation has an empty attribute ref")
|
|
40
43
|
element.attrib.pop('annotate', None)
|
|
41
44
|
|
|
42
45
|
# let's check to see if this is a reference to an annotation branch
|
|
43
|
-
|
|
46
|
+
id = element.get('id')
|
|
47
|
+
if not id.startswith('pf__'):
|
|
48
|
+
id = 'pf__' + id
|
|
49
|
+
annotation = diagram.get_annotation_branch(id)
|
|
44
50
|
if annotation is not None:
|
|
45
51
|
annotate(annotation, diagram, parent)
|
|
46
52
|
return
|
|
@@ -22,7 +22,7 @@ def add_tactile_arrowhead_marker(diagram, path, mid=False):
|
|
|
22
22
|
# get the stroke width from the graphical component
|
|
23
23
|
stroke_width_str = path.get('stroke-width', '1')
|
|
24
24
|
stroke_width = int(stroke_width_str)
|
|
25
|
-
id = '
|
|
25
|
+
id = 'pf__arrow-head-'+stroke_width_str
|
|
26
26
|
|
|
27
27
|
# if we've seen this already, there's no need to create it again
|
|
28
28
|
if diagram.has_reusable(id):
|
|
@@ -180,12 +180,12 @@ def add_arrowhead_marker(diagram,
|
|
|
180
180
|
# end or in the middle of a path
|
|
181
181
|
id_data = f"_{arrow_width}_{arrow_angles[0]}_{arrow_angles[1]}"
|
|
182
182
|
if not mid:
|
|
183
|
-
id = '
|
|
183
|
+
id = 'pf__arrow-head-end-'+stroke_width_str+id_data+'-'+stroke_color
|
|
184
184
|
if arrow_width is None:
|
|
185
185
|
arrow_width = 4
|
|
186
186
|
dims = (1, arrow_width)
|
|
187
187
|
else:
|
|
188
|
-
id = '
|
|
188
|
+
id = 'pf__arrow-head-mid-'+stroke_width_str+id_data+'-'+stroke_color
|
|
189
189
|
if arrow_width is None:
|
|
190
190
|
arrow_width = 13/3
|
|
191
191
|
dims = (1, arrow_width) #11/3)
|
|
@@ -60,7 +60,7 @@ class Diagram:
|
|
|
60
60
|
self.root = ET.Element("svg", nsmap = nsmap)
|
|
61
61
|
|
|
62
62
|
self.id_suffix = ['']
|
|
63
|
-
self.add_id(self.root, diagram_element.get('id', '
|
|
63
|
+
self.add_id(self.root, diagram_element.get('id', 'pf__figure'))
|
|
64
64
|
|
|
65
65
|
# prepare the XML tree for annotations, if there are any
|
|
66
66
|
self.annotations_root = None
|
|
@@ -195,9 +195,12 @@ class Diagram:
|
|
|
195
195
|
suffix = ''.join(self.id_suffix)
|
|
196
196
|
if id is None:
|
|
197
197
|
self.ids[element.tag] = self.ids.get(element.tag, -1) + 1
|
|
198
|
-
|
|
198
|
+
result_id = element.tag+'-'+str(self.ids[element.tag])+suffix
|
|
199
199
|
else:
|
|
200
|
-
|
|
200
|
+
result_id = id + suffix
|
|
201
|
+
if result_id.startswith('pf__'):
|
|
202
|
+
return result_id
|
|
203
|
+
return 'pf__' + result_id
|
|
201
204
|
|
|
202
205
|
def append_id_suffix(self, element):
|
|
203
206
|
return self.find_id(element, element.get('id', None))
|
|
@@ -671,10 +674,16 @@ class Diagram:
|
|
|
671
674
|
|
|
672
675
|
def add_annotation_to_branch(self, annotation):
|
|
673
676
|
if len(self.annotation_branch_stack) == 0:
|
|
674
|
-
|
|
677
|
+
id = annotation.get('id')
|
|
678
|
+
if not id.startswith('pf__'):
|
|
679
|
+
id = 'pf__' + id
|
|
680
|
+
self.annotation_branches[id] = annotation
|
|
675
681
|
return
|
|
676
682
|
self.annotation_branch_stack[-1].append(annotation)
|
|
677
|
-
|
|
683
|
+
id = self.append_id_suffix(annotation)
|
|
684
|
+
if not id.startswith('pf__'):
|
|
685
|
+
id = 'pf__' + id
|
|
686
|
+
annotation.set('id', id)
|
|
678
687
|
|
|
679
688
|
def get_annotation_branch(self, id):
|
|
680
689
|
return self.annotation_branches.pop(id, None)
|
|
@@ -120,9 +120,14 @@ def grid(element, diagram, parent, outline_status):
|
|
|
120
120
|
|
|
121
121
|
thickness = element.get('thickness', '1')
|
|
122
122
|
stroke = element.get('stroke', r'#ccc')
|
|
123
|
+
id = element.get('id')
|
|
124
|
+
if id is None:
|
|
125
|
+
id = 'pf__grid'
|
|
126
|
+
if not id.startswith('pf__'):
|
|
127
|
+
id = 'pf__' + id
|
|
123
128
|
grid = ET.SubElement(parent, 'g',
|
|
124
129
|
attrib={
|
|
125
|
-
'id':
|
|
130
|
+
'id': id,
|
|
126
131
|
'stroke': stroke,
|
|
127
132
|
'stroke-width': thickness
|
|
128
133
|
}
|
|
@@ -268,27 +273,27 @@ def grid_axes(element, diagram, parent, outline_status):
|
|
|
268
273
|
group = ET.SubElement(parent, 'g',
|
|
269
274
|
attrib=
|
|
270
275
|
{
|
|
271
|
-
'id': '
|
|
276
|
+
'id': 'pf__grid-axes'
|
|
272
277
|
}
|
|
273
278
|
)
|
|
274
279
|
|
|
275
280
|
group_annotation = ET.Element('annotation')
|
|
276
|
-
group_annotation.set('ref', '
|
|
281
|
+
group_annotation.set('ref', 'pf__grid-axes')
|
|
277
282
|
group_annotation.set('text', 'The coordinate grid and axes')
|
|
278
283
|
diagram. add_default_annotation(group_annotation)
|
|
279
284
|
|
|
280
285
|
grid(element, diagram, group, outline_status)
|
|
281
286
|
|
|
282
287
|
annotation = ET.Element('annotation')
|
|
283
|
-
annotation.set('ref', '
|
|
288
|
+
annotation.set('ref', 'pf__grid')
|
|
284
289
|
annotation.set('text', 'The coordinate grid')
|
|
285
290
|
group_annotation.append(annotation)
|
|
286
291
|
|
|
287
|
-
element.set('id', '
|
|
292
|
+
element.set('id', 'pf__axes')
|
|
288
293
|
axes.axes(element, diagram, group, outline_status)
|
|
289
294
|
|
|
290
295
|
annotation = ET.Element('annotation')
|
|
291
|
-
annotation.set('ref', '
|
|
296
|
+
annotation.set('ref', 'pf__axes')
|
|
292
297
|
annotation.set('text', 'The coordinate axes')
|
|
293
298
|
group_annotation.append(annotation)
|
|
294
299
|
|
|
@@ -64,7 +64,7 @@ class Legend:
|
|
|
64
64
|
# first we'll create the label
|
|
65
65
|
label_el = copy.deepcopy(li)
|
|
66
66
|
label_el.tag = 'label'
|
|
67
|
-
label_el.set('id', f"
|
|
67
|
+
label_el.set('id', f"pf__legend-label-{num}")
|
|
68
68
|
label_el.set('alignment', 'se')
|
|
69
69
|
label_el.set('anchor', element.get('anchor', anchor_str))
|
|
70
70
|
label_el.set('abs-offset', '(0,0)')
|
|
@@ -87,7 +87,7 @@ class Legend:
|
|
|
87
87
|
key = copy.deepcopy(key)
|
|
88
88
|
key.set('p', anchor_str)
|
|
89
89
|
key.set('size', '4')
|
|
90
|
-
key.set('id', f"
|
|
90
|
+
key.set('id', f"pf__legend-point-{num}")
|
|
91
91
|
key_width = max(key_width, point_width)
|
|
92
92
|
else:
|
|
93
93
|
fill = key.get('fill')
|
|
@@ -219,11 +219,11 @@ class Legend:
|
|
|
219
219
|
id = group.get('id', 'none')
|
|
220
220
|
if id == 'background-group':
|
|
221
221
|
for rectangle in group:
|
|
222
|
-
if rectangle.get('id', 'none').startswith('
|
|
222
|
+
if rectangle.get('id', 'none').startswith('pf__legend-label'):
|
|
223
223
|
group.remove(rectangle)
|
|
224
224
|
if id == 'braille-group':
|
|
225
225
|
for label in group:
|
|
226
|
-
if label.get('id','none').startswith('
|
|
226
|
+
if label.get('id','none').startswith('pf__legend-label'):
|
|
227
227
|
label_groups.append(label)
|
|
228
228
|
group.remove(label)
|
|
229
229
|
|
|
@@ -55,12 +55,15 @@ def repeat(element, diagram, parent, outline_status):
|
|
|
55
55
|
element_cp = copy.deepcopy(element)
|
|
56
56
|
outline = element.get('outline')
|
|
57
57
|
id = element.get('id')
|
|
58
|
+
if not id.startswith('pf__'):
|
|
59
|
+
id = 'pf__' + id
|
|
58
60
|
element.clear()
|
|
59
61
|
element.tag = 'group'
|
|
60
62
|
if outline is not None:
|
|
61
63
|
element.set('outline', outline)
|
|
62
64
|
if id is not None:
|
|
63
65
|
element.set('id', id)
|
|
66
|
+
element_cp.set('id', id)
|
|
64
67
|
|
|
65
68
|
for num, k in enumerate(iterator):
|
|
66
69
|
if isinstance(k, np.ndarray):
|
|
@@ -36,7 +36,10 @@ def define(element, diagram, parent, outline_status):
|
|
|
36
36
|
log.error(f"In <define-shapes>, {child.tag} does not define a shape")
|
|
37
37
|
continue
|
|
38
38
|
if child.get('at', None) is not None:
|
|
39
|
-
|
|
39
|
+
id = child.get('at')
|
|
40
|
+
if not id.startswith('pf__'):
|
|
41
|
+
id = 'pf__' + id
|
|
42
|
+
child.set('id', id)
|
|
40
43
|
dummy_parent = ET.Element('group')
|
|
41
44
|
# this is kind of a hack, but we only need to construct the shape
|
|
42
45
|
# so we stash the format temporarily in case we're building a
|
|
@@ -69,6 +72,12 @@ def shape(element, diagram, parent, outline_status):
|
|
|
69
72
|
return
|
|
70
73
|
|
|
71
74
|
shape_refs = [r.strip() for r in reference.split(',')]
|
|
75
|
+
shape_edit = []
|
|
76
|
+
for shape_ref in shape_refs:
|
|
77
|
+
if not shape_ref.startswith('pf__'):
|
|
78
|
+
shape_ref = 'pf__' + shape_ref
|
|
79
|
+
shape_edit.append(shape_ref)
|
|
80
|
+
shape_refs = shape_edit
|
|
72
81
|
shapes = []
|
|
73
82
|
for ref in shape_refs:
|
|
74
83
|
shapes.append(diagram.recall_shape(ref))
|
|
@@ -82,6 +91,8 @@ def shape(element, diagram, parent, outline_status):
|
|
|
82
91
|
operation = 'union'
|
|
83
92
|
else:
|
|
84
93
|
path = ET.SubElement(parent, 'use')
|
|
94
|
+
if not reference.startswith('pf__'):
|
|
95
|
+
reference = 'pf__' + reference
|
|
85
96
|
path.set('href', r'#' + reference)
|
|
86
97
|
|
|
87
98
|
if operation is not None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|