prefig 0.4.1.dev20250807054726__py3-none-any.whl → 0.4.2.dev20250814182308__py3-none-any.whl

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/core/axes.py CHANGED
@@ -571,7 +571,7 @@ class Axes():
571
571
  xlabel.set('scale', '0.8')
572
572
  else:
573
573
  #math_element.text = r'\text{'+'{0:g}'.format(x)+'}'
574
- math_element.text = label_text(x, commas)
574
+ math_element.text = label_text(x, commas, diagram)
575
575
  if self.h_pi_format:
576
576
  math_element.text = get_pi_text(x)
577
577
 
@@ -680,7 +680,7 @@ class Axes():
680
680
  ylabel.set('scale', '0.8')
681
681
  else:
682
682
  #math_element.text = r'\text{'+'{0:g}'.format(y)+'}'
683
- math_element.text = label_text(y, commas)
683
+ math_element.text = label_text(y, commas, diagram)
684
684
  if self.v_pi_format:
685
685
  math_element.text = get_pi_text(y)
686
686
  # process as a math number
@@ -712,7 +712,7 @@ class Axes():
712
712
  user_coords=False)
713
713
  self.v_tick_group.append(line_el)
714
714
 
715
- def label_text(x, commas):
715
+ def label_text(x, commas, diagram):
716
716
  # we'll construct a text representation of x
717
717
  # maybe it's simple
718
718
  if x < 0:
@@ -741,13 +741,16 @@ def label_text(x, commas):
741
741
  return r'\text{' + prefix + text + r'}'
742
742
 
743
743
  period = text.find('.')
744
+ comma_include = '{,}'
745
+ if diagram.get_environment() == 'pyodide':
746
+ comma_include = ','
744
747
  if period < 0:
745
748
  suffix = ''
746
749
  else:
747
750
  suffix = text[period:]
748
751
  text = text[:period]
749
752
  while len(text) > 3:
750
- suffix = '{,}' + text[-3:] + suffix
753
+ suffix = comma_include + text[-3:] + suffix
751
754
  text = text[:-3]
752
755
  text = text + suffix
753
756
  return r'\text{' + prefix + text + r'}'
prefig/core/point.py CHANGED
@@ -1,5 +1,7 @@
1
1
  import lxml.etree as ET
2
2
  import logging
3
+ import numpy as np
4
+ import math
3
5
  from . import user_namespace as un
4
6
  from . import math_utilities as math_util
5
7
  from . import utilities as util
@@ -18,7 +20,15 @@ def point(element, diagram, parent, outline_status = None):
18
20
 
19
21
  # determine the location and size of the point from the XML element
20
22
  try:
21
- p = diagram.transform(un.valid_eval(element.get('p')))
23
+ p = un.valid_eval(element.get('p'))
24
+ if element.get('coordinates', 'cartesian') == 'polar':
25
+ radial = p[0]
26
+ angle = p[1]
27
+ if element.get('degrees', 'no') == 'yes':
28
+ angle = math.radians(angle)
29
+ p = radial * np.array([math.cos(angle), math.sin(angle)])
30
+ element.set('p', util.pt2long_str(p, spacer=','))
31
+ p = diagram.transform(p)
22
32
  except:
23
33
  log.error(f"Error in <point> defining p={element.get('p')}")
24
34
  return
@@ -685,6 +685,8 @@ Point = element point {
685
685
  attribute at {text}?,
686
686
  attribute style {text}?,
687
687
  attribute size {text}?,
688
+ attribute coordinates {"cartesian"|"polar"}?,
689
+ attribute degrees {"yes"|"no"}?,
688
690
  LabelAttributes,
689
691
  FillAttributes,
690
692
  CommonAttributes,
@@ -1886,6 +1886,22 @@
1886
1886
  <optional>
1887
1887
  <attribute name="size"/>
1888
1888
  </optional>
1889
+ <optional>
1890
+ <attribute name="coordinates">
1891
+ <choice>
1892
+ <value>cartesian</value>
1893
+ <value>polar</value>
1894
+ </choice>
1895
+ </attribute>
1896
+ </optional>
1897
+ <optional>
1898
+ <attribute name="degrees">
1899
+ <choice>
1900
+ <value>yes</value>
1901
+ <value>no</value>
1902
+ </choice>
1903
+ </attribute>
1904
+ </optional>
1889
1905
  <ref name="LabelAttributes"/>
1890
1906
  <ref name="FillAttributes"/>
1891
1907
  <ref name="CommonAttributes"/>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefig
3
- Version: 0.4.1.dev20250807054726
3
+ Version: 0.4.2.dev20250814182308
4
4
  Summary: An authoring system for mathematical diagrams
5
5
  Home-page: https://prefigure.org
6
6
  License: GPL-3.0-or-later
@@ -5,7 +5,7 @@ prefig/core/__init__.py,sha256=roT0a8-iBrp8WXTbPN5RzMWFiCXfpKrEXa2xE-F-yBo,728
5
5
  prefig/core/annotations.py,sha256=9wStnLhEHFmkIocufHLiBcUZ3NSce7ZESor5kjj-vzg,3998
6
6
  prefig/core/area.py,sha256=U-AxXvaZJWgVccpLlh-aaRfM_QtTa09NR2TqAd8Yk0o,3710
7
7
  prefig/core/arrow.py,sha256=h8lFm1rMdpiZRyQu5kvAiptBmMYr5aKCZuB5JypAGDM,11283
8
- prefig/core/axes.py,sha256=T-n0P-Sk2e1cD3upzHtJCrh4CH8Kus7GduEF_yMRzZ4,31694
8
+ prefig/core/axes.py,sha256=3J6eWNXRWTlbFVNfWkv_-Hyq4L7UP54EQ5u1r82Cfy0,31830
9
9
  prefig/core/calculus.py,sha256=Q4kSGTTTeQYEEVKgmYWpFP0JLHmCsBchB5OF9qSclQk,498
10
10
  prefig/core/circle.py,sha256=_v1eMVhl4nnD4WXCz-Boa_SAdQg_kKeU3NhP42z2Yzw,15668
11
11
  prefig/core/clip.py,sha256=X3TcFYPuZwjZ9SFBWMc1MYY__6XTJqLafPeOLFNOdIE,806
@@ -28,7 +28,7 @@ prefig/core/network.py,sha256=1izAX2AKvnj2knElrdLeojE_0Q0zO0aQM-EsEwor0Os,27217
28
28
  prefig/core/parametric_curve.py,sha256=ftxdg3gs0M0ME5iPJo3iEX7jT8PHQEMYpx8psr8Cm-w,3046
29
29
  prefig/core/parse.py,sha256=plLmR0KKrUjYx0PmHHo5HZonaaT3tW4qjiDOtzuhSkQ,4542
30
30
  prefig/core/path.py,sha256=8BbWAUzZqe1YD0gO4QtDENaINavAAC1mlU-y3UV-vu0,20312
31
- prefig/core/point.py,sha256=a97N1soBcmYn3StZ60HBmaBi3pB1abA7sL0LNJ2nxR0,8341
31
+ prefig/core/point.py,sha256=JhybSrEqxTWwXQVYQWw1_knBcWrttOuRUwKIlU8IshE,8730
32
32
  prefig/core/polygon.py,sha256=8NVdWSUVXuNE4GiPQ4MySSmLy8aCNwKUqCcfHukizME,11301
33
33
  prefig/core/read.py,sha256=Q1Nsluwysg3M5wtUmwIirfNo-Rw9-dFJPEeM4pDCpyo,1988
34
34
  prefig/core/rectangle.py,sha256=b_ki7yqA4-mke1_0khvKqSKBRToB667mZc-xZhhPIBA,3473
@@ -56,13 +56,13 @@ prefig/resources/examples/tangent.xml,sha256=FLZaNz0iFoTLX6gB4pfLZFtu_TWeCug4Dda
56
56
  prefig/resources/fonts/Braille29.ttf,sha256=T4hosDvaUGMVK0Wh0BmBgWeT7sQQmLXyA3gRUR-a0oE,55880
57
57
  prefig/resources/js/mj-sre-page.js,sha256=LHVeI4dCH13bTv56nz3SKNo3JGRXa6joPM3D3wpKV40,9251
58
58
  prefig/resources/js/package.json,sha256=hwKDg76_GzkhX72T7DRiF3FoMLokCv9PSLQvnW5Ovok,116
59
- prefig/resources/schema/pf_schema.rnc,sha256=WORhF-dRkNY8aeiNQvZIaPTE5QGCMzbrXqttXCjtOJY,20166
60
- prefig/resources/schema/pf_schema.rng,sha256=TmZQLgyK2wntXDXOiQXYcVQedlPuPh8IWrtttK0iCQY,54454
59
+ prefig/resources/schema/pf_schema.rnc,sha256=00ja-tlc6jgDrnjNJ0QkYM8D4MJbdeB7j-DKCJ_AMYU,20253
60
+ prefig/resources/schema/pf_schema.rng,sha256=NURxWLPuw_T5sRR_OSwupH02E83W0KoixsLCc12R-IE,54849
61
61
  prefig/resources/template/pf_publication.xml,sha256=eEv8HACv610Apw5DSVNy0reLfELYqHlNy9Oq0GH7C_c,200
62
62
  prefig/scripts/__init__.py,sha256=qJcPi1WRh9UAwu4zIFJbmxWalAMilMYqgi6LxRkF7bI,25
63
63
  prefig/scripts/install_mj.py,sha256=5A6-oc1xbIXka5mkFE70vlp9-Rh_QoxOxGMrQi9Hkio,1219
64
- prefig-0.4.1.dev20250807054726.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
65
- prefig-0.4.1.dev20250807054726.dist-info/METADATA,sha256=klqvWJaWcHW0CTMVv9Kpnt_SOOYg_QkzkqEZ8EsxU9s,8728
66
- prefig-0.4.1.dev20250807054726.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
67
- prefig-0.4.1.dev20250807054726.dist-info/entry_points.txt,sha256=OP4ZQT71q2b0Zfbie-oM2Z1HlxpkuX7qaxJnzwsBOVQ,42
68
- prefig-0.4.1.dev20250807054726.dist-info/RECORD,,
64
+ prefig-0.4.2.dev20250814182308.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
65
+ prefig-0.4.2.dev20250814182308.dist-info/METADATA,sha256=0k5ZTnegUEk7ziPRdvAm_az08DXCALdU9OG4HuUlI6s,8728
66
+ prefig-0.4.2.dev20250814182308.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
67
+ prefig-0.4.2.dev20250814182308.dist-info/entry_points.txt,sha256=OP4ZQT71q2b0Zfbie-oM2Z1HlxpkuX7qaxJnzwsBOVQ,42
68
+ prefig-0.4.2.dev20250814182308.dist-info/RECORD,,