aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-04-05 11:29:54 -0400
committerbnewbold <bnewbold@robocracy.org>2016-04-05 11:29:56 -0400
commit819a184c816342abc258ec0f905707ed4b7b44af (patch)
tree646541401ee8e427df066a28a53b7c4f296f9013 /src
parent37d2c0d3749461ef86b0886f27128a88ddcc2f86 (diff)
downloadPyX.jl-819a184c816342abc258ec0f905707ed4b7b44af.tar.gz
PyX.jl-819a184c816342abc258ec0f905707ed4b7b44af.zip
BROKEN: start integrating pyrecwrappyrecwrap
Several test (eg, all `style.linewidth(0.2)` calls) fail. The problem is that python classes can be called like a function ("style.linewidth(0.2)") or accessed like a module ("style.linewidth.THICK"), while Julia modules/functions can not.
Diffstat (limited to 'src')
-rw-r--r--src/PyX.jl14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/PyX.jl b/src/PyX.jl
index 41e6a9e..69342e2 100644
--- a/src/PyX.jl
+++ b/src/PyX.jl
@@ -2,12 +2,13 @@
module PyX
####### Required and over-written
+# LaTeXStrings is strongly recommended but not required
using PyCall
import PyCall: pycall
import Base: convert, ==, isequal, hash, writemime, getindex, setindex!, haskey, keys, show, mimewritable
-
-# LaTeXStrings is strongly recommended but not required
+####### Helpers
+include("pyrecwrap.jl")
####### Types
export PyxCanvas
@@ -58,7 +59,7 @@ export writeEPSfile, writePDFfile, writePSfile, writeGSfile, pipeGS
export pyx_fill, pyx_append, pyx_insert, pyx_text
# See also Python3 section at end
-####### Create virtual (pywrap) Julia modules for PyX python sub-modules
+####### Create virtual (pywrap) Julia modules for PyX python classes
canvas = pywrap(pyimport("pyx.canvas"))
path = pywrap(pyimport("pyx.path"))
deco = pywrap(pyimport("pyx.deco"))
@@ -88,12 +89,19 @@ graph_key = pywrap(graph.key)
graph_style = pywrap(graph.style)
graph_style_symbol = pywrap(graph_style.symbol)
graph_graphxyz = pywrap(graph.graphxyz)
+graph = pywrap(pyimport("pyx.graph"))
epsfile = pywrap(pyimport("pyx.epsfile"))
deformer = pywrap(pyimport("pyx.deformer"))
trafo = pywrap(pyimport("pyx.trafo"))
attr = pywrap(pyimport("pyx.attr"))
metapost_path = pywrap(pyimport("pyx.metapost.path"))
+####### Re-wrap Some Modules Recursively
+deco = pyrecwrap(pyimport("pyx.deco"))
+style = pyrecwrap(pyimport("pyx.style"))
+color = pyrecwrap(pyimport("pyx.color"))
+text = pyrecwrap(pyimport("pyx.text"))
+
####### Wrapper Functions
plot(g::PyObject, a...; k...) = g[:plot](a...; k...)
plot(g::PyxCanvas, a...; k...) = g[:plot](a...; k...)