[dia] Provide dia module documentation, make HTML write work on Linux
- From: Hans Breuer <hans src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [dia] Provide dia module documentation, make HTML write work on Linux
- Date: Sat, 28 Nov 2009 12:51:47 +0000 (UTC)
commit 76162f5e65e7bc7a373fbcef7f48f4d64b0c95e3
Author: Hans Breuer <hans breuer org>
Date: Sat Nov 28 13:51:17 2009 +0100
Provide dia module documentation, make HTML write work on Linux
A very brief introduction to Dia Python plu-in programming.
plug-ins/python/diamodule.c | 12 +++++++++++-
plug-ins/python/pydiadoc.py | 11 ++++++-----
2 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/python/diamodule.c b/plug-ins/python/diamodule.c
index 4719c81..0e13d6f 100644
--- a/plug-ins/python/diamodule.c
+++ b/plug-ins/python/diamodule.c
@@ -535,6 +535,16 @@ static PyMethodDef dia_methods[] = {
{ NULL, NULL }
};
+PyDoc_STRVAR(dia_module_doc,
+"The dia module allows to write Python plug-ins for Dia [http://live.gnome.org/Dia/Python]\n"
+"\n"
+"This modules is designed to run Python scripts embedded in Dia. To make your script accessible\n"
+"to Dia you have to put it into $HOME/.dia/python and let it call one of the register_*() functions.\n"
+"It is possible to write import filters [register_import()] and export filters [register_export()], "
+"as well as scripts to manipulate existing diagrams or create new ones [register_action()].\n"
+"\n"
+"For stand-alone Python bindings to Dia see http://mail.gnome.org/archives/dia-list/2007-March/msg00092.html");
+
DL_EXPORT(void) initdia(void);
DL_EXPORT(void)
@@ -569,7 +579,7 @@ initdia(void)
PyDiaPaperinfo_Type.ob_type = &PyType_Type;
#endif
- m = Py_InitModule("dia", dia_methods);
+ m = Py_InitModule3("dia", dia_methods, dia_module_doc);
d = PyModule_GetDict(m);
/*
diff --git a/plug-ins/python/pydiadoc.py b/plug-ins/python/pydiadoc.py
index c22e8a1..dd2b7e3 100644
--- a/plug-ins/python/pydiadoc.py
+++ b/plug-ins/python/pydiadoc.py
@@ -249,11 +249,12 @@ def autodoc_html_cb (data, flags) :
import os
try :
path = os.environ["TEMP"]
- os.chdir(path)
- pydoc.writedoc(dia)
- dia.message(0, path + os.path.sep + "dia.html saved.")
- except :
- pass
+ except KeyError :
+ # with os.tmpnam() we get a RuntimeWarning so fall back to
+ path = "/tmp/"
+ os.chdir(path)
+ pydoc.writedoc(dia)
+ dia.message(0, path + os.path.sep + "dia.html saved.")
dia.register_action ("HelpPydia2", "PyDia HTML Docs",
"/ToolboxMenu/Help/HelpExtensionStart",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]