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  <>

	* Remove the plugin.
parent 9fa2059e
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 <>
* Remove the plugin.
2002-10-11 Jon K Hellan <>
* python.c (value_from_python): s/gnum_int/int/
gnumeric_pythondir = $(gnumeric_datadir)/python
-DPLUGIN_ID=\"Gnumeric_python\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/src -I$(top_builddir)/src \
gnumeric_plugin_pythondir = $(gnumeric_plugindir)/python
xmldir = $(gnumeric_plugin_pythondir)
gnumeric_plugin_python_LTLIBRARIES =
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 =
xml_in_files =
xml_DATA = $(
EXTRA_DIST = $(Pythonscripts_DATA) $(xml_in_files)
# 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'
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 = \
"@SYNTAX=PY_MID(text,start,num_chars)\n" \
"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
@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/"
if os.path.isfile(home_gnumericrc):
execfile(home_gnumericrc, globals())
<?xml version="1.0"?>
<plugin id="Gnumeric_python">
<_name>Python Plugin</_name>
<_description>This plugin provides Python language support in Gnumeric</_description>
<loader type="Gnumeric_Builtin:module">
<attribute name="module_file" value=""/>
<service type="general"></service>
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