Commit 1c363c0c authored by Jon K Hellan's avatar Jon K Hellan Committed by Jon Kåre Hellan

Remove the plugin.

2002-10-11  Jon K Hellan  <hellan@acm.org>

	* Remove the plugin.
parent 9fa2059e
BUGS
2000-01-14 Jon Kåre Hellan
I have encountered some problems while working on the Python plugin,
which I believe are really symptoms of bugs elsewhere.
1. If init_plugin returns error, plugin_load closes the plugin with
g_module_close. However, this results in an illegal memory access
(segfault) inside dlclose. This happened even with a modified
init_plugin which immediately returned error status, so it's got
nothing to do with what happens inside init_plugin.
There are lots of missing features, of course.
2002-10-11 Jon K Hellan <hellan@acm.org>
* Remove the plugin.
2002-10-11 Jon K Hellan <hellan@acm.org>
* python.c (value_from_python): s/gnum_int/int/
......
gnumeric_pythondir = $(gnumeric_datadir)/python
INCLUDES = \
-DPLUGIN_ID=\"Gnumeric_python\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/src -I$(top_builddir)/src \
$(PY_CFLAGS) \
$(GNUMERIC_CFLAGS)
gnumeric_plugin_pythondir = $(gnumeric_plugindir)/python
xmldir = $(gnumeric_plugin_pythondir)
gnumeric_plugin_python_LTLIBRARIES = python.la
python_la_LDFLAGS = -module -avoid-version $(PY_LIB_LOC)
python_la_LIBADD = -l$(PY_LIBS) $(PY_EXTRA_LIBS)
python_la_SOURCES = python.c
Pythonscriptsdir = $(gnumeric_pythondir)
Pythonscripts_DATA = gnumeric_startup.py gnumeric_defs.py
xml_in_files = plugin.xml.in
xml_DATA = $(xml_in_files:.xml.in=.xml)
@INTLTOOL_XML_RULE@
EXTRA_DIST = $(Pythonscripts_DATA) $(xml_in_files)
DISTCLEANFILES = $(xml_DATA)
# Definitions for the Python plugin for Gnumeric.
import types
class Boolean:
def __init__(self, value):
self.value = value
def __str__(self):
if self.__nonzero__():
return 'TRUE'
else:
return 'FALSE'
def __nonzero__(self):
return self.value != 0
TRUE = Boolean(1)
FALSE = Boolean(0)
class CellRef:
def __init__(self, column, row, col_relative=0,
row_relative=0, sheet=""):
if ((type (column) != types.IntType) or
(type (row) != types.IntType) or
(type (col_relative) != types.IntType) or
(type (row_relative) != types.IntType)):
#(type (sheet) != types.StringType)):
raise TypeError, "Wrong types for a CellRef"
self.column = column
self.row = row
self.col_relative = col_relative
self.row_relative = row_relative
self.sheet = sheet
class CellRange:
def __init__ (self, cell_a, cell_b):
if not ((cell_a.__class__ is CellRef) and
(cell_b.__class__ is CellRef)):
raise TypeError, "Wrong types for a CellRange"
self.range = (cell_a, cell_b)
import gnumeric
import gnumeric_defs
def gnumeric_mid(context,text,start_num,num_chars):
return text[start_num-1:start_num+num_chars-1];
help_mid = \
"@FUNCTION=PY_MID\n" \
"@SYNTAX=PY_MID(text,start,num_chars)\n" \
"@DESCRIPTION=" \
"Returns a specific number of characters from a text string, " \
"starting at START and spawning NUM_CHARS. Index is counted " \
"starting from one"
gnumeric.register_function("py_mid", "Python", "sff",
"text, start_num, num_chars",
help_mid, gnumeric_mid);
# This is a totally pointless function. But it illustrates how to invoke a
# gnumeric function from Python. Note that the argument list must be a
# sequence. Caveat: "(1)" is not a tuple. "(1,)" and "(1,2)" are.
def py_abs(context, f):
return gnumeric.apply(context, "abs", (f,))
help_py_abs = """@FUNCTION=PY_ABS
@SYNTAX=PY_ABS(num)
@DESCRIPTION=Return the absolute value of number."""
gnumeric.register_function("py_abs", "Python", "f", "num",
help_py_abs, py_abs);
# load user init-file if present
def run_user_init_file():
import os
home_gnumericrc = os.environ["HOME"] + "/.gnumeric/rc.py"
if os.path.isfile(home_gnumericrc):
execfile(home_gnumericrc, globals())
run_user_init_file()
<?xml version="1.0"?>
<plugin id="Gnumeric_python">
<information>
<_name>Python Plugin</_name>
<_description>This plugin provides Python language support in Gnumeric</_description>
</information>
<loader type="Gnumeric_Builtin:module">
<attribute name="module_file" value="python.la"/>
</loader>
<services>
<service type="general"></service>
</services>
</plugin>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment