Skip to content

Commit

Permalink
fixing some compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatera committed Dec 1, 2024
1 parent 80590a3 commit e4dc66c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
7 changes: 5 additions & 2 deletions pymathics/asy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@

import pkg_resources
from mathics.builtin.files_io.importexport import Export as MathicsExport
from mathics.core.atoms import String
from mathics.core.evaluation import Evaluation
from mathics.core.expression import Expression, String, SymbolTrue
from mathics.core.expression import Expression
from mathics.core.symbols import Symbol, SymbolTrue
from mathics.core.systemsymbols import SymbolGet

from pymathics.asy.exportasy import ExportToJPG, ExportToPDF, ExportToPNG, ExportToSVG
from pymathics.asy.graphics import AsyGraphicsBox
Expand Down Expand Up @@ -49,7 +52,7 @@ def onload(definitions):
definitions.set_ownvalue("Settings`UseAsyForGraphics2D", SymbolTrue)
for root, dirs, files in os.walk(os.path.join(ROOT_DIR, "autoload")):
for path in [os.path.join(root, f) for f in files if f.endswith(".m")]:
Expression("Get", String(path)).evaluate(Evaluation(definitions))
Expression(SymbolGet, String(path)).evaluate(Evaluation(definitions))


# To be recognized as an external mathics module, the following variable
Expand Down
4 changes: 2 additions & 2 deletions pymathics/asy/exportasy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
from mathics.core.symbols import SymbolNull
from mathics.core.systemsymbols import SymbolFailed
from mathics_scanner import replace_wl_with_plain_text

from mathics.core.attributes import A_HOLD_REST

class _AsyExporter(Builtin):
attributes = ("HoldRest",)
attributes = A_HOLD_REST

messages = {
"boxerr": "Not able to interpret box `1`",
Expand Down
24 changes: 7 additions & 17 deletions pymathics/asy/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,23 @@
from itertools import chain
from math import atan2, ceil, cos, degrees, exp, floor, log10, pi, radians, sin, sqrt

from mathics.builtin.box.graphics import GraphicsBox
from mathics.builtin.drawing.graphics3d import Graphics3D, Graphics3DElements
from mathics.builtin.box.graphics import( GraphicsBox,)
from mathics.builtin.graphics import (
GRAPHICS_OPTIONS,
Graphics,
RGBColor,
)
from mathics.builtin.graphics import GRAPHICS_OPTIONS, Graphics, RGBColor
from mathics.builtin.options import options_to_rules
from mathics.core.atoms import (
Integer,
Rational,
Real,
String,
Symbol,
)
from mathics.core.convert.python import from_python
from mathics.core.atoms import Integer, Rational, Real, String
from mathics.core.builtin import Builtin, BuiltinElement
from mathics.core.convert.python import from_python
from mathics.core.expression import Expression
from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue, strip_context
from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue, strip_context
from mathics.format.asy import asy_create_pens

from mathics.core.attributes import A_HOLD_ALL, A_READ_PROTECTED

class AsyGraphicsBox(GraphicsBox):
context = "System`"
options = Graphics.options
_graphics = Graphics(expression=False)
attributes = ("HoldAll", "ReadProtected")
attributes = A_HOLD_ALL| A_READ_PROTECTED

messages = {
"asynotav": "Asymptote is not available in this system. Using the buggy backend.",
Expand Down

0 comments on commit e4dc66c

Please sign in to comment.