From d21a317b9307f37a3c40ef518fbb20c5f456a268 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 26 Nov 2002 04:06:23 +0000 Subject: [PATCH] use pygtk.require to determine database svn: r1205 --- gramps2/configure | 23 +- gramps2/configure.in | 25 +- gramps2/example/gramps/data.gramps | Bin 3716 -> 3720 bytes gramps2/src/AddMedia.py | 6 + gramps2/src/AddSpouse.py | 5 + gramps2/src/AddrEdit.py | 5 + gramps2/src/AttrEdit.py | 5 + gramps2/src/AutoComp.py | 5 + gramps2/src/Bookmarks.py | 5 + gramps2/src/ChooseParents.py | 5 + gramps2/src/DateEdit.py | 5 + gramps2/src/DbPrompter.py | 5 + gramps2/src/DisplayTrace.py | 5 + gramps2/src/EditPerson.py | 5 + gramps2/src/EditPlace.py | 5 + gramps2/src/EditSource.py | 5 + gramps2/src/EventEdit.py | 5 + gramps2/src/FamilyView.py | 5 + gramps2/src/Filter.py | 6 + gramps2/src/Find.py | 5 + gramps2/src/GenericFilter.py | 6 + gramps2/src/GrampsCfg.py | 5 + gramps2/src/ImageSelect.py | 5 + gramps2/src/ImgManip.py | 8 +- gramps2/src/ListModel.py | 5 + gramps2/src/LocEdit.py | 4 + gramps2/src/Makefile.am | 5 +- gramps2/src/Makefile.in | 5 +- gramps2/src/Marriage.py | 4 + gramps2/src/MediaView.py | 4 + gramps2/src/MergeData.py | 4 + gramps2/src/NameEdit.py | 4 + gramps2/src/NoteEdit.py | 4 + gramps2/src/PaperMenu.py | 4 + gramps2/src/PedView.py | 21 +- gramps2/src/PlaceView.py | 4 + gramps2/src/Plugins.py | 4 + gramps2/src/QuestionDialog.py | 5 + gramps2/src/QuickAdd.py | 4 + gramps2/src/RelImage.py | 4 + gramps2/src/Report.py | 4 + gramps2/src/SelectChild.py | 4 + gramps2/src/SourceView.py | 4 + gramps2/src/StartupDialog.py | 5 + gramps2/src/StyleEditor.py | 4 + gramps2/src/UrlEdit.py | 4 + gramps2/src/Utils.py | 4 + gramps2/src/VersionControl.py | 4 + gramps2/src/const.py | 2 +- gramps2/src/const.py.in | 2 +- gramps2/src/gramps.py | 23 +- gramps2/src/gramps_main.py | 5 + gramps2/src/grampslib_wrap.c | 688 +++++++++++++++++++++++++++++ gramps2/src/intl.py | 6 + gramps2/src/papersize.xml | 1 - 55 files changed, 961 insertions(+), 43 deletions(-) create mode 100644 gramps2/src/grampslib_wrap.c diff --git a/gramps2/configure b/gramps2/configure index b65571f6f..6d02471af 100755 --- a/gramps2/configure +++ b/gramps2/configure @@ -1874,8 +1874,6 @@ echo "${ECHO_T}no" >&6 fi -PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"` - if test "$PYTHON_VERSION" != "2.2" then # Extract the first word of "python2.2", so it can be a program name with args. @@ -3637,11 +3635,18 @@ fi GNOMEINC=`pkg-config --cflags gnome-vfs-module-2.0` GNOMELIB=`pkg-config --libs gnome-vfs-module-2.0` +pygtk_require="try: + import pygtk + pygtk.require('2.0') +except ImportError: + pass +" + echo "$as_me:$LINENO: checking Python bindings for gtk" >&5 echo $ECHO_N "checking Python bindings for gtk... $ECHO_C" >&6 - cat > conftest.py <&6 echo "$as_me:$LINENO: checking Python bindings for GNOME" >&5 echo $ECHO_N "checking Python bindings for GNOME... $ECHO_C" >&6 - cat > conftest.py <&6 echo "$as_me:$LINENO: checking Python bindings for gconf" >&5 echo $ECHO_N "checking Python bindings for gconf... $ECHO_C" >&6 - cat > conftest.py <&6 echo "$as_me:$LINENO: checking Python bindings for GNOME canvas" >&5 echo $ECHO_N "checking Python bindings for GNOME canvas... $ECHO_C" >&6 - cat > conftest.py <&6 echo "$as_me:$LINENO: checking Python bindin for glade" >&5 echo $ECHO_N "checking Python bindin for glade... $ECHO_C" >&6 - cat > conftest.py <>)dnl -PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"` -changequote([, ])dnl - if test "$PYTHON_VERSION" != "2.2" then AC_PATH_PROG(PYTHON22, python2.2) @@ -76,11 +72,18 @@ AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, "YES", "NO") GNOMEINC=`pkg-config --cflags gnome-vfs-module-2.0` GNOMELIB=`pkg-config --libs gnome-vfs-module-2.0` +pygtk_require="try: + import pygtk + pygtk.require('2.0') +except ImportError: + pass +" + dnl Check if python bindings for gtk are installed AC_MSG_CHECKING(Python bindings for gtk) -changequote(,) cat > conftest.py < conftest.py < conftest.py < conftest.py < conftest.py <ha={2RnaVZExE+68_#_!Sjd19T3~1UTg`MW-m$8rfJgz z@xGuq92Sg4$7&_gpyZ_f_cx?uTTV@xkr^KrTWn>KoFShX4rhj>di=|eEJcr0E=f8fvy+AQ3$UVs^8hsu8dU1_94}xT~ycZX72mR;2P<4M<_>o{&_&CuyZJ*PVpbkIRF%4aFm^t}$6kSs|P znnRbMBP5ZElrwtbd0saNf^IZ)-Lj&3U8_eklB6g1 z{63cu{5$6veFBtdkI_Q4C@YjG_BUZX?yrS;T#5$8bVBB7@wW5P8+L!HW-|~aXDEr` zts8b$>>ntTt=}K_tEXjw6ap$1Gm!LIB8n;c0xwqWpu!{(d2w>e7&-2j&+D?3z|T=3 zXfl~l0fSI4mZbX|0;Z3Y6?IN^CQ>OM38+3vLC3;@({-Y*>n(Mv9GX-$BNkvo6vIxhUtGV=6%W<eAr=|{w$f}1fL+8-Ag$|UJS8+W zhYX5JiwC_fdp^STA+`q;cb%Z?`g$Zc_40WyJhM4)Gak=pqyT>dztI=4b|RU{*C!)B zDV{)^(FJ=*7?t`|FE-$D5zogzvw-0W!X79Bizx~@`$oY~R}kq6LS4b2Rd3h_jD3AMQ?XFTcJi<%oZtNRHAZmjM<$-BSon5J8vo zJR|G~{ewTT^39abA$)@>d`B zJGIoa==SG@NMbaCCa*@f27$x6-W*Q5h0RC8T0_(Yj&?xCBKNj^{(Q%tF&7M};6UeHM8UbOvyJS34{{ zB&m ze$UIk!>A-qP=5s06XGO>Zpk>ABx7_37z$3RevJXugyl0jE}-(7!I2yz1dvKexFT4R zE1;7^#ONkT-<MUs7g?&;iak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Fy*+&JC{Wp~z@`V`278;?!8X2C&sEf0nT}-yT>er7jA{jzyr2by z%ql{cSAPNj@*<~V3c4#lQgqy}dRACVa9dz|+hM;Lj;n!lPDCNE-h!BnVL3m+(hpre zmpm-LeY?!J$RDug70_F`i%1XvfAena#!r8A&U;7b{B$L+O(6aX$Q@^l9HBEV*p#Q) z>Ke9YptBnInI}ZdXGb8iG~@FeeU_i28aV^k2Fn511xW_o_h3?+^;ZU z+=j%pijs@58HTe(DlN2_IBlMN0yDXd+ZJIb^3+L4d9t$k} zIAvXz&zp#k`)gY*9Wyd6mUg@RrJ&x(Zx@QOeCQQFiVn(X1_%oBqmbh%>!5#H5$A0u z&sWsdp+rk4QSX7xGcZBpB`7?brL_D|ZvRJj-MRr5CwNwn@mAQwCG24@;akCG`4eoV z&p^HtcvAd%CioaEA^9_|rPDXS50>Buy;(BZ24211fITXRG}iJX9iHR3Tj7RFxMA|qI)X0V+5-)7|D8OZWO&3|6U+3a7aDp0DT%~sgK5_Vt&d$UB;0M}o_^Q%aMZX5n?h>?X1p0LOffkj>+Xm2C0(6W3);^0+r}DVJT5-qy^}kQ> MKjV5f)$CvZ09iB)xc~qF diff --git a/gramps2/src/AddMedia.py b/gramps2/src/AddMedia.py index dd5a9c2e3..7e6b9133d 100644 --- a/gramps2/src/AddMedia.py +++ b/gramps2/src/AddMedia.py @@ -43,6 +43,12 @@ from intl import gettext as _ # #------------------------------------------------------------------------- from QuestionDialog import ErrorDialog + +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/AddSpouse.py b/gramps2/src/AddSpouse.py index ba141060c..5aaf41b6f 100644 --- a/gramps2/src/AddSpouse.py +++ b/gramps2/src/AddSpouse.py @@ -37,6 +37,11 @@ from intl import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gobject import gtk.glade diff --git a/gramps2/src/AddrEdit.py b/gramps2/src/AddrEdit.py index 2a50ca338..c2f7b86fb 100644 --- a/gramps2/src/AddrEdit.py +++ b/gramps2/src/AddrEdit.py @@ -27,6 +27,11 @@ mechanism for the user to edit address information. # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/AttrEdit.py b/gramps2/src/AttrEdit.py index ce4dfb4a8..87f3ee602 100644 --- a/gramps2/src/AttrEdit.py +++ b/gramps2/src/AttrEdit.py @@ -30,6 +30,11 @@ __version__ = "$Revision$" # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/AutoComp.py b/gramps2/src/AutoComp.py index 38e9e6e57..9188d369f 100644 --- a/gramps2/src/AutoComp.py +++ b/gramps2/src/AutoComp.py @@ -39,6 +39,11 @@ import string # GNOME modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk #------------------------------------------------------------------------- diff --git a/gramps2/src/Bookmarks.py b/gramps2/src/Bookmarks.py index 64da9c652..d31e5054a 100644 --- a/gramps2/src/Bookmarks.py +++ b/gramps2/src/Bookmarks.py @@ -28,6 +28,11 @@ __version__ = "$Revision$" # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk import gnome.ui diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index 756dcb560..c1bad335a 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -38,6 +38,11 @@ from intl import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gobject import gtk.glade diff --git a/gramps2/src/DateEdit.py b/gramps2/src/DateEdit.py index b87920a97..4618e6a2a 100644 --- a/gramps2/src/DateEdit.py +++ b/gramps2/src/DateEdit.py @@ -34,6 +34,11 @@ __version__ = "$Revision$" # GNOME modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk import gtk.gdk diff --git a/gramps2/src/DbPrompter.py b/gramps2/src/DbPrompter.py index 23582d6bd..08f8283b1 100644 --- a/gramps2/src/DbPrompter.py +++ b/gramps2/src/DbPrompter.py @@ -24,6 +24,11 @@ # GNOME modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk import gtk.glade diff --git a/gramps2/src/DisplayTrace.py b/gramps2/src/DisplayTrace.py index b9dd97e4d..75d09b114 100644 --- a/gramps2/src/DisplayTrace.py +++ b/gramps2/src/DisplayTrace.py @@ -32,6 +32,11 @@ import sys # GTK/GNOME modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index abcc74542..316b7f3a6 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -31,6 +31,11 @@ import pickle # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gobject import gtk import gnome.ui diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index 10f56124e..3fe816aaa 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -30,6 +30,11 @@ import pickle # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gobject import gtk import gtk.glade diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 404a4d77a..8ea4696c6 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -24,6 +24,11 @@ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/EventEdit.py b/gramps2/src/EventEdit.py index 405cb4c83..bd82f1256 100644 --- a/gramps2/src/EventEdit.py +++ b/gramps2/src/EventEdit.py @@ -25,6 +25,11 @@ from string import strip # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk import gtk.glade diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 4acad7665..fbb09412b 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -23,6 +23,11 @@ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gobject import gtk import gtk.glade diff --git a/gramps2/src/Filter.py b/gramps2/src/Filter.py index d22b1bc88..5258d557a 100644 --- a/gramps2/src/Filter.py +++ b/gramps2/src/Filter.py @@ -26,6 +26,12 @@ import re import os import sys + +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk from intl import gettext as _ diff --git a/gramps2/src/Find.py b/gramps2/src/Find.py index d57e814bd..7acefabbc 100644 --- a/gramps2/src/Find.py +++ b/gramps2/src/Find.py @@ -35,6 +35,11 @@ import string # Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk from gnome.ui import * diff --git a/gramps2/src/GenericFilter.py b/gramps2/src/GenericFilter.py index ed7d252d9..ff95fd654 100644 --- a/gramps2/src/GenericFilter.py +++ b/gramps2/src/GenericFilter.py @@ -39,6 +39,12 @@ except: #------------------------------------------------------------------------- import os from string import find,join,strip,replace + +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk #------------------------------------------------------------------------- diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index 8fdc7b51b..5a24f7a2d 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -35,6 +35,11 @@ import Plugins # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gobject import gconf import gtk diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index c33248d22..e3b6b4ae9 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -32,6 +32,11 @@ import urlparse # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gobject import gtk import gnome.ui diff --git a/gramps2/src/ImgManip.py b/gramps2/src/ImgManip.py index 31d852ff7..bc4937a32 100644 --- a/gramps2/src/ImgManip.py +++ b/gramps2/src/ImgManip.py @@ -27,6 +27,11 @@ import string # Check for the python imaging library # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + try: import PIL.Image import StringIO @@ -34,10 +39,7 @@ try: no_pil = 0 except: import popen2 -# import GDK -# import GTK import gtk -# import GdkImlib no_pil = 1 class ImgManip: diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index 00fca8bcc..0eaf7e1f1 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -18,6 +18,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + from gobject import TYPE_STRING, TYPE_PYOBJECT import gtk diff --git a/gramps2/src/LocEdit.py b/gramps2/src/LocEdit.py index 05780a204..f80f93641 100644 --- a/gramps2/src/LocEdit.py +++ b/gramps2/src/LocEdit.py @@ -23,6 +23,10 @@ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/Makefile.am b/gramps2/src/Makefile.am index 37fa9552d..0a9567933 100644 --- a/gramps2/src/Makefile.am +++ b/gramps2/src/Makefile.am @@ -7,6 +7,7 @@ CFLAGS = -fPIC -shared -O @GNOMEINC@ @CFLAGS@ @CPPFLAGS@ -I@includedir@ LDFLAGS = @GNOMELIB@ @LDFLAGS@ -L@libdir@ @LIBS@ CLEANFILES = ${INTLLIBS} MOSTLYCLEANFILES = +INTLLIBS= intl22.so # What are the PYTHON scripts for this package that need to be handled? # @@ -25,7 +26,6 @@ pkgdata_DATA = ${INTLLIBS} ${GLADEFILES} ${GRAPHICS} gramps.desktop grampslib.so EXTRA_DIST = grampslib.i - all: ${INTLLIBS} grampslib.so DIST_SOURCES = intl.c @@ -36,8 +36,7 @@ dist_pkgdata_DATA = ${pkgdata_DATA} intl22.so: intl.c $(CC) $(CFLAGS) $(LDFLAGS) @P22_INCLUDES@ -DVER22 -o $@ intl.c -grampslib.so: grampslib.i - $(SWIG) -python grampslib.i +grampslib.so: grampslib_wrap.c $(CC) $(CFLAGS) @P22_INCLUDES@ -o $@ grampslib_wrap.c $(LDFLAGS) # In principle the following rule slightly violates the automake/autoconf diff --git a/gramps2/src/Makefile.in b/gramps2/src/Makefile.in index 2fe0a32a0..75f2780eb 100644 --- a/gramps2/src/Makefile.in +++ b/gramps2/src/Makefile.in @@ -76,7 +76,7 @@ GPREF = @GPREF@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ +INTLLIBS = intl22.so JW = @JW@ LANGUAGES = @LANGUAGES@ LIBS = @LIBS@ @@ -455,8 +455,7 @@ all: ${INTLLIBS} grampslib.so intl22.so: intl.c $(CC) $(CFLAGS) $(LDFLAGS) @P22_INCLUDES@ -DVER22 -o $@ intl.c -grampslib.so: grampslib.i - $(SWIG) -python grampslib.i +grampslib.so: grampslib_wrap.c $(CC) $(CFLAGS) @P22_INCLUDES@ -o $@ grampslib_wrap.c $(LDFLAGS) # In principle the following rule slightly violates the automake/autoconf diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index 17b6ebe01..96885b135 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -25,6 +25,10 @@ import pickle # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gobject import gtk import gtk.glade diff --git a/gramps2/src/MediaView.py b/gramps2/src/MediaView.py index ff7296a17..c6252ef6e 100644 --- a/gramps2/src/MediaView.py +++ b/gramps2/src/MediaView.py @@ -30,6 +30,10 @@ import string # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gobject import gtk import gtk.gdk diff --git a/gramps2/src/MergeData.py b/gramps2/src/MergeData.py index 62389d8b1..0c0ef72da 100644 --- a/gramps2/src/MergeData.py +++ b/gramps2/src/MergeData.py @@ -30,6 +30,10 @@ import string # GNOME # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/NameEdit.py b/gramps2/src/NameEdit.py index 7cf73c804..e7acc3808 100644 --- a/gramps2/src/NameEdit.py +++ b/gramps2/src/NameEdit.py @@ -23,6 +23,10 @@ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/NoteEdit.py b/gramps2/src/NoteEdit.py index ed380352e..c68066875 100644 --- a/gramps2/src/NoteEdit.py +++ b/gramps2/src/NoteEdit.py @@ -23,6 +23,10 @@ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk import gnome.ui diff --git a/gramps2/src/PaperMenu.py b/gramps2/src/PaperMenu.py index d4c8b2261..b7d0d4b71 100644 --- a/gramps2/src/PaperMenu.py +++ b/gramps2/src/PaperMenu.py @@ -23,6 +23,10 @@ # GNOME modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk #------------------------------------------------------------------------- diff --git a/gramps2/src/PedView.py b/gramps2/src/PedView.py index 1909268b4..9a931cc4a 100644 --- a/gramps2/src/PedView.py +++ b/gramps2/src/PedView.py @@ -22,13 +22,27 @@ _PAD = 3 _CANVASPAD = 3 _PERSON = "p" +#------------------------------------------------------------------------- +# +# GTK/Gnome modules +# +#------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk import gtk.gdk import gnome.canvas import pango +#------------------------------------------------------------------------- +# +# Gramps Modules +# +#------------------------------------------------------------------------- import GrampsCfg - from intl import gettext as _ class DispBox: @@ -140,10 +154,10 @@ class PedigreeView: as the root person of the tree.""" for i in self.canvas_items: - i.destroy() + self.i.destroy() for i in self.boxes: i.cleanup() - + if person is not self.active_person: del self.presel_descendants[:] self.active_person = person @@ -195,7 +209,6 @@ class PedigreeView: xpts = self.build_x_coords(cw/xdiv,_CANVASPAD+h) ypts = self.build_y_coords((ch-h)/32.0, h) - self.canvas_items = [] for family in self.active_person.getFamilyList(): if len(family.getChildList()) > 0: button,arrow = self.make_arrow_button(gtk.ARROW_LEFT, diff --git a/gramps2/src/PlaceView.py b/gramps2/src/PlaceView.py index 852b596ab..fe382ac6f 100644 --- a/gramps2/src/PlaceView.py +++ b/gramps2/src/PlaceView.py @@ -27,6 +27,10 @@ Handles the place view for GRAMPS. # GTK modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gobject import gtk import gtk.gdk diff --git a/gramps2/src/Plugins.py b/gramps2/src/Plugins.py index 71d17bbc7..61721c990 100644 --- a/gramps2/src/Plugins.py +++ b/gramps2/src/Plugins.py @@ -32,6 +32,10 @@ filters, importer, exporters, and document generators. # GTK libraries # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gobject import gtk import gtk.glade diff --git a/gramps2/src/QuestionDialog.py b/gramps2/src/QuestionDialog.py index 163da9e73..f0db00470 100644 --- a/gramps2/src/QuestionDialog.py +++ b/gramps2/src/QuestionDialog.py @@ -18,6 +18,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk import gnome.ui from intl import gettext as _ diff --git a/gramps2/src/QuickAdd.py b/gramps2/src/QuickAdd.py index 685b39360..cab195419 100644 --- a/gramps2/src/QuickAdd.py +++ b/gramps2/src/QuickAdd.py @@ -18,6 +18,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade import Utils diff --git a/gramps2/src/RelImage.py b/gramps2/src/RelImage.py index 48d8bfc51..de665eed8 100644 --- a/gramps2/src/RelImage.py +++ b/gramps2/src/RelImage.py @@ -31,6 +31,10 @@ import string # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk from QuestionDialog import ErrorDialog diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index 2331b61ae..b711876d6 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -36,6 +36,10 @@ import string # GNOME/GTK modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk import gnome.ui diff --git a/gramps2/src/SelectChild.py b/gramps2/src/SelectChild.py index 03ba2f6c5..9a45436c3 100644 --- a/gramps2/src/SelectChild.py +++ b/gramps2/src/SelectChild.py @@ -37,6 +37,10 @@ import string # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/SourceView.py b/gramps2/src/SourceView.py index dfa6c695c..5d49fe7e9 100644 --- a/gramps2/src/SourceView.py +++ b/gramps2/src/SourceView.py @@ -29,6 +29,10 @@ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gobject import gtk import gtk.gdk diff --git a/gramps2/src/StartupDialog.py b/gramps2/src/StartupDialog.py index 211d33d29..bde13dda8 100644 --- a/gramps2/src/StartupDialog.py +++ b/gramps2/src/StartupDialog.py @@ -19,6 +19,11 @@ # import const + +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade import gnome import gconf diff --git a/gramps2/src/StyleEditor.py b/gramps2/src/StyleEditor.py index 7d23ba734..954ca6709 100644 --- a/gramps2/src/StyleEditor.py +++ b/gramps2/src/StyleEditor.py @@ -30,6 +30,10 @@ __version__ = "$Revision$" # GNOME/GTK modules # #------------------------------------------------------------------------ +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade import gtk diff --git a/gramps2/src/UrlEdit.py b/gramps2/src/UrlEdit.py index 0680e361d..f020c5b21 100644 --- a/gramps2/src/UrlEdit.py +++ b/gramps2/src/UrlEdit.py @@ -23,6 +23,10 @@ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/Utils.py b/gramps2/src/Utils.py index 3950dff17..b7e530be6 100644 --- a/gramps2/src/Utils.py +++ b/gramps2/src/Utils.py @@ -31,6 +31,10 @@ import os # GNOME/GTK # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk import grampslib diff --git a/gramps2/src/VersionControl.py b/gramps2/src/VersionControl.py index 5587b6c0e..83ac4a6ad 100644 --- a/gramps2/src/VersionControl.py +++ b/gramps2/src/VersionControl.py @@ -37,6 +37,10 @@ from re import compile # GTK/GNOME # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass import gtk.glade #------------------------------------------------------------------------- diff --git a/gramps2/src/const.py b/gramps2/src/const.py index ccf19f238..5fee1fc11 100644 --- a/gramps2/src/const.py +++ b/gramps2/src/const.py @@ -57,7 +57,7 @@ if os.environ.has_key('GRAMPSDIR'): else: rootDir = "." -papersize = "%s/papersize.xml" % rootDir +papersize = "file:%s/papersize.xml" % rootDir good_xpm = "%s/good.png" % rootDir bad_xpm = "%s/bad.png" % rootDir caution_xpm = "%s/caution.png" % rootDir diff --git a/gramps2/src/const.py.in b/gramps2/src/const.py.in index 8b5f2805d..40044f127 100644 --- a/gramps2/src/const.py.in +++ b/gramps2/src/const.py.in @@ -57,7 +57,7 @@ if os.environ.has_key('GRAMPSDIR'): else: rootDir = "." -papersize = "%s/papersize.xml" % rootDir +papersize = "file:%s/papersize.xml" % rootDir good_xpm = "%s/good.png" % rootDir bad_xpm = "%s/bad.png" % rootDir caution_xpm = "%s/caution.png" % rootDir diff --git a/gramps2/src/gramps.py b/gramps2/src/gramps.py index e63aff720..f7468aaca 100755 --- a/gramps2/src/gramps.py +++ b/gramps2/src/gramps.py @@ -1,5 +1,16 @@ #! /usr/bin/python -O +#------------------------------------------------------------------------- +# +# Cope with versioned pygtk installation. +# +#------------------------------------------------------------------------- +try: + import pygtk + pygtk.require('2.0') +except ImportError: + pass + #------------------------------------------------------------------------- # # Load internationalization setup @@ -7,6 +18,12 @@ #------------------------------------------------------------------------- import os import locale + +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk.glade import intl @@ -33,6 +50,11 @@ import sys # GNOME/GTK libraries # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gtk import gnome.ui @@ -60,4 +82,3 @@ except: DisplayTrace.DisplayTrace() gtk.mainloop() - diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 4df47d2f4..3b19e1721 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -39,6 +39,11 @@ from intl import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- +try: + import pygtk; pygtk.require('2.0') +except ImportError: # not set up for parallel install + pass + import gobject import gtk import gnome.ui diff --git a/gramps2/src/grampslib_wrap.c b/gramps2/src/grampslib_wrap.c new file mode 100644 index 000000000..7c2e24348 --- /dev/null +++ b/gramps2/src/grampslib_wrap.c @@ -0,0 +1,688 @@ +/* + * FILE : grampslib_wrap.c + * + * This file was automatically generated by : + * Simplified Wrapper and Interface Generator (SWIG) + * Version 1.1 (Patch 5) + * + * Portions Copyright (c) 1995-1998 + * The University of Utah and The Regents of the University of California. + * Permission is granted to distribute this file in any manner provided + * this notice remains intact. + * + * Do not make changes to this file--changes will be lost! + * + */ + + +#define SWIGCODE +/* Implementation : PYTHON */ + +#define SWIGPYTHON +#include +#include +/*********************************************************************** + * $Header$ + * swig_lib/python/python.cfg + * + * This file contains coded needed to add variable linking to the + * Python interpreter. C variables are added as a new kind of Python + * datatype. + * + * Also contains supporting code for building python under Windows + * and things like that. + * + * $Log$ + * Revision 1.1 2002/11/26 04:06:23 dallingham + * use pygtk.require to determine database + * + ************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif +#include "Python.h" +#ifdef __cplusplus +} +#endif + +/* Definitions for Windows/Unix exporting */ +#if defined(__WIN32__) +# if defined(_MSC_VER) +# define SWIGEXPORT(a,b) __declspec(dllexport) a b +# else +# if defined(__BORLANDC__) +# define SWIGEXPORT(a,b) a _export b +# else +# define SWIGEXPORT(a,b) a b +# endif +# endif +#else +# define SWIGEXPORT(a,b) a b +#endif + +#ifdef SWIG_GLOBAL +#ifdef __cplusplus +#define SWIGSTATIC extern "C" +#else +#define SWIGSTATIC +#endif +#endif + +#ifndef SWIGSTATIC +#define SWIGSTATIC static +#endif + +typedef struct { + char *name; + PyObject *(*get_attr)(void); + int (*set_attr)(PyObject *); +} swig_globalvar; + +typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar **vars; + int nvars; + int maxvars; +} swig_varlinkobject; + +/* ---------------------------------------------------------------------- + swig_varlink_repr() + + Function for python repr method + ---------------------------------------------------------------------- */ + +static PyObject * +swig_varlink_repr(swig_varlinkobject *v) +{ + v = v; + return PyString_FromString(""); +} + +/* --------------------------------------------------------------------- + swig_varlink_print() + + Print out all of the global variable names + --------------------------------------------------------------------- */ + +static int +swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) +{ + + int i = 0; + flags = flags; + fprintf(fp,"Global variables { "); + while (v->vars[i]) { + fprintf(fp,"%s", v->vars[i]->name); + i++; + if (v->vars[i]) fprintf(fp,", "); + } + fprintf(fp," }\n"); + return 0; +} + +/* -------------------------------------------------------------------- + swig_varlink_getattr + + This function gets the value of a variable and returns it as a + PyObject. In our case, we'll be looking at the datatype and + converting into a number or string + -------------------------------------------------------------------- */ + +static PyObject * +swig_varlink_getattr(swig_varlinkobject *v, char *n) +{ + int i = 0; + char temp[128]; + + while (v->vars[i]) { + if (strcmp(v->vars[i]->name,n) == 0) { + return (*v->vars[i]->get_attr)(); + } + i++; + } + sprintf(temp,"C global variable %s not found.", n); + PyErr_SetString(PyExc_NameError,temp); + return NULL; +} + +/* ------------------------------------------------------------------- + swig_varlink_setattr() + + This function sets the value of a variable. + ------------------------------------------------------------------- */ + +static int +swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) +{ + char temp[128]; + int i = 0; + while (v->vars[i]) { + if (strcmp(v->vars[i]->name,n) == 0) { + return (*v->vars[i]->set_attr)(p); + } + i++; + } + sprintf(temp,"C global variable %s not found.", n); + PyErr_SetString(PyExc_NameError,temp); + return 1; +} + +statichere PyTypeObject varlinktype = { +/* PyObject_HEAD_INIT(&PyType_Type) Note : This doesn't work on some machines */ + PyObject_HEAD_INIT(0) + 0, + "varlink", /* Type name */ + sizeof(swig_varlinkobject), /* Basic size */ + 0, /* Itemsize */ + 0, /* Deallocator */ + (printfunc) swig_varlink_print, /* Print */ + (getattrfunc) swig_varlink_getattr, /* get attr */ + (setattrfunc) swig_varlink_setattr, /* Set attr */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_mapping*/ + 0, /* tp_hash */ +}; + +/* Create a variable linking object for use later */ + +SWIGSTATIC PyObject * +SWIG_newvarlink(void) +{ + swig_varlinkobject *result = 0; + result = PyMem_NEW(swig_varlinkobject,1); + varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */ + result->ob_type = &varlinktype; + /* _Py_NewReference(result); Does not seem to be necessary */ + result->nvars = 0; + result->maxvars = 64; + result->vars = (swig_globalvar **) malloc(64*sizeof(swig_globalvar *)); + result->vars[0] = 0; + result->ob_refcnt = 0; + Py_XINCREF((PyObject *) result); + return ((PyObject*) result); +} + +SWIGSTATIC void +SWIG_addvarlink(PyObject *p, char *name, + PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) +{ + swig_varlinkobject *v; + v= (swig_varlinkobject *) p; + + if (v->nvars >= v->maxvars -1) { + v->maxvars = 2*v->maxvars; + v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *)); + if (v->vars == NULL) { + fprintf(stderr,"SWIG : Fatal error in initializing Python module.\n"); + exit(1); + } + } + v->vars[v->nvars] = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + v->vars[v->nvars]->name = (char *) malloc(strlen(name)+1); + strcpy(v->vars[v->nvars]->name,name); + v->vars[v->nvars]->get_attr = get_attr; + v->vars[v->nvars]->set_attr = set_attr; + v->nvars++; + v->vars[v->nvars] = 0; +} + + + +/***************************************************************************** + * $Header$ + * + * swigptr.swg + * + * This file contains supporting code for the SWIG run-time type checking + * mechanism. The following functions are available : + * + * SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)); + * + * Registers a new type-mapping with the type-checker. origtype is the + * original datatype and newtype is an equivalent type. cast is optional + * pointer to a function to cast pointer values between types (this + * is typically used to cast pointers from derived classes to base classes in C++) + * + * SWIG_MakePtr(char *buffer, void *ptr, char *typestring); + * + * Makes a pointer string from a pointer and typestring. The result is returned + * in buffer which is assumed to hold enough space for the result. + * + * char * SWIG_GetPtr(char *buffer, void **ptr, char *type) + * + * Gets a pointer value from a string. If there is a type-mismatch, returns + * a character string to the received type. On success, returns NULL. + * + * + * You can remap these functions by making a file called "swigptr.swg" in + * your the same directory as the interface file you are wrapping. + * + * These functions are normally declared static, but this file can be + * can be used in a multi-module environment by redefining the symbol + * SWIGSTATIC. + *****************************************************************************/ + +#include + +#ifdef SWIG_GLOBAL +#ifdef __cplusplus +#define SWIGSTATIC extern "C" +#else +#define SWIGSTATIC +#endif +#endif + +#ifndef SWIGSTATIC +#define SWIGSTATIC static +#endif + + +/* SWIG pointer structure */ + +typedef struct SwigPtrType { + char *name; /* Datatype name */ + int len; /* Length (used for optimization) */ + void *(*cast)(void *); /* Pointer casting function */ + struct SwigPtrType *next; /* Linked list pointer */ +} SwigPtrType; + +/* Pointer cache structure */ + +typedef struct { + int stat; /* Status (valid) bit */ + SwigPtrType *tp; /* Pointer to type structure */ + char name[256]; /* Given datatype name */ + char mapped[256]; /* Equivalent name */ +} SwigCacheType; + +/* Some variables */ + +static int SwigPtrMax = 64; /* Max entries that can be currently held */ + /* This value may be adjusted dynamically */ +static int SwigPtrN = 0; /* Current number of entries */ +static int SwigPtrSort = 0; /* Status flag indicating sort */ +static int SwigStart[256]; /* Starting positions of types */ + +/* Pointer table */ +static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences */ + +/* Cached values */ + +#define SWIG_CACHESIZE 8 +#define SWIG_CACHEMASK 0x7 +static SwigCacheType SwigCache[SWIG_CACHESIZE]; +static int SwigCacheIndex = 0; +static int SwigLastCache = 0; + +/* Sort comparison function */ +static int swigsort(const void *data1, const void *data2) { + SwigPtrType *d1 = (SwigPtrType *) data1; + SwigPtrType *d2 = (SwigPtrType *) data2; + return strcmp(d1->name,d2->name); +} + +/* Binary Search function */ +static int swigcmp(const void *key, const void *data) { + char *k = (char *) key; + SwigPtrType *d = (SwigPtrType *) data; + return strncmp(k,d->name,d->len); +} + +/* Register a new datatype with the type-checker */ + +SWIGSTATIC +void SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) { + + int i; + SwigPtrType *t = 0,*t1; + + /* Allocate the pointer table if necessary */ + + if (!SwigPtrTable) { + SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType)); + SwigPtrN = 0; + } + /* Grow the table */ + if (SwigPtrN >= SwigPtrMax) { + SwigPtrMax = 2*SwigPtrMax; + SwigPtrTable = (SwigPtrType *) realloc((char *) SwigPtrTable,SwigPtrMax*sizeof(SwigPtrType)); + } + for (i = 0; i < SwigPtrN; i++) + if (strcmp(SwigPtrTable[i].name,origtype) == 0) { + t = &SwigPtrTable[i]; + break; + } + if (!t) { + t = &SwigPtrTable[SwigPtrN]; + t->name = origtype; + t->len = strlen(t->name); + t->cast = 0; + t->next = 0; + SwigPtrN++; + } + + /* Check for existing entry */ + + while (t->next) { + if ((strcmp(t->name,newtype) == 0)) { + if (cast) t->cast = cast; + return; + } + t = t->next; + } + + /* Now place entry (in sorted order) */ + + t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType)); + t1->name = newtype; + t1->len = strlen(t1->name); + t1->cast = cast; + t1->next = 0; + t->next = t1; + SwigPtrSort = 0; +} + +/* Make a pointer value string */ + +SWIGSTATIC +void SWIG_MakePtr(char *_c, const void *_ptr, char *type) { + static char _hex[16] = + {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f'}; + unsigned long _p, _s; + char _result[20], *_r; /* Note : a 64-bit hex number = 16 digits */ + _r = _result; + _p = (unsigned long) _ptr; + if (_p > 0) { + while (_p > 0) { + _s = _p & 0xf; + *(_r++) = _hex[_s]; + _p = _p >> 4; + } + *_r = '_'; + while (_r >= _result) + *(_c++) = *(_r--); + } else { + strcpy (_c, "NULL"); + } + if (_ptr) + strcpy (_c, type); +} + +/* Define for backwards compatibility */ + +#define _swig_make_hex SWIG_MakePtr + +/* Function for getting a pointer value */ + +SWIGSTATIC +char *SWIG_GetPtr(char *_c, void **ptr, char *_t) +{ + unsigned long _p; + char temp_type[256]; + char *name; + int i, len; + SwigPtrType *sp,*tp; + SwigCacheType *cache; + int start, end; + _p = 0; + + /* Pointer values must start with leading underscore */ + if (*_c == '_') { + _c++; + /* Extract hex value from pointer */ + while (*_c) { + if ((*_c >= '0') && (*_c <= '9')) + _p = (_p << 4) + (*_c - '0'); + else if ((*_c >= 'a') && (*_c <= 'f')) + _p = (_p << 4) + ((*_c - 'a') + 10); + else + break; + _c++; + } + + if (_t) { + if (strcmp(_t,_c)) { + if (!SwigPtrSort) { + qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort); + for (i = 0; i < 256; i++) { + SwigStart[i] = SwigPtrN; + } + for (i = SwigPtrN-1; i >= 0; i--) { + SwigStart[(int) (SwigPtrTable[i].name[1])] = i; + } + for (i = 255; i >= 1; i--) { + if (SwigStart[i-1] > SwigStart[i]) + SwigStart[i-1] = SwigStart[i]; + } + SwigPtrSort = 1; + for (i = 0; i < SWIG_CACHESIZE; i++) + SwigCache[i].stat = 0; + } + + /* First check cache for matches. Uses last cache value as starting point */ + cache = &SwigCache[SwigLastCache]; + for (i = 0; i < SWIG_CACHESIZE; i++) { + if (cache->stat) { + if (strcmp(_t,cache->name) == 0) { + if (strcmp(_c,cache->mapped) == 0) { + cache->stat++; + *ptr = (void *) _p; + if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr); + return (char *) 0; + } + } + } + SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK; + if (!SwigLastCache) cache = SwigCache; + else cache++; + } + /* We have a type mismatch. Will have to look through our type + mapping table to figure out whether or not we can accept this datatype */ + + start = SwigStart[(int) _t[1]]; + end = SwigStart[(int) _t[1]+1]; + sp = &SwigPtrTable[start]; + while (start < end) { + if (swigcmp(_t,sp) == 0) break; + sp++; + start++; + } + if (start >= end) sp = 0; + /* Try to find a match for this */ + if (sp) { + while (swigcmp(_t,sp) == 0) { + name = sp->name; + len = sp->len; + tp = sp->next; + /* Try to find entry for our given datatype */ + while(tp) { + if (tp->len >= 255) { + return _c; + } + strcpy(temp_type,tp->name); + strncat(temp_type,_t+len,255-tp->len); + if (strcmp(_c,temp_type) == 0) { + + strcpy(SwigCache[SwigCacheIndex].mapped,_c); + strcpy(SwigCache[SwigCacheIndex].name,_t); + SwigCache[SwigCacheIndex].stat = 1; + SwigCache[SwigCacheIndex].tp = tp; + SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK; + + /* Get pointer value */ + *ptr = (void *) _p; + if (tp->cast) *ptr = (*(tp->cast))(*ptr); + return (char *) 0; + } + tp = tp->next; + } + sp++; + /* Hmmm. Didn't find it this time */ + } + } + /* Didn't find any sort of match for this data. + Get the pointer value and return the received type */ + *ptr = (void *) _p; + return _c; + } else { + /* Found a match on the first try. Return pointer value */ + *ptr = (void *) _p; + return (char *) 0; + } + } else { + /* No type specified. Good luck */ + *ptr = (void *) _p; + return (char *) 0; + } + } else { + if (strcmp (_c, "NULL") == 0) { + *ptr = (void *) 0; + return (char *) 0; + } + *ptr = (void *) 0; + return _c; + } +} + +/* Compatibility mode */ + +#define _swig_get_hex SWIG_GetPtr + +#define SWIG_init initgrampslib + +#define SWIG_name "grampslib" + +#include +extern const char *gnome_vfs_mime_get_icon(const char *); +extern const char *gnome_vfs_mime_type_from_name(const char *); +extern const char *gnome_vfs_mime_get_description(const char *); +extern const char *gnome_vfs_mime_get_value(const char *,const char *); + +const char* default_application_name(const char* type) { + GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type); + return a->name; +} + +const char* default_application_command(const char* type) { + GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type); + return a->command; +} + +static PyObject *_wrap_gnome_vfs_mime_get_icon(PyObject *self, PyObject *args) { + PyObject * _resultobj; + char * _result; + char * _arg0; + + self = self; + if(!PyArg_ParseTuple(args,"s:gnome_vfs_mime_get_icon",&_arg0)) + return NULL; + _result = (char *)gnome_vfs_mime_get_icon(_arg0); + _resultobj = Py_BuildValue("s", _result); + return _resultobj; +} + +static PyObject *_wrap_gnome_vfs_mime_type_from_name(PyObject *self, PyObject *args) { + PyObject * _resultobj; + char * _result; + char * _arg0; + + self = self; + if(!PyArg_ParseTuple(args,"s:gnome_vfs_mime_type_from_name",&_arg0)) + return NULL; + _result = (char *)gnome_vfs_mime_type_from_name(_arg0); + _resultobj = Py_BuildValue("s", _result); + return _resultobj; +} + +static PyObject *_wrap_gnome_vfs_mime_get_description(PyObject *self, PyObject *args) { + PyObject * _resultobj; + char * _result; + char * _arg0; + + self = self; + if(!PyArg_ParseTuple(args,"s:gnome_vfs_mime_get_description",&_arg0)) + return NULL; + _result = (char *)gnome_vfs_mime_get_description(_arg0); + _resultobj = Py_BuildValue("s", _result); + return _resultobj; +} + +static PyObject *_wrap_gnome_vfs_mime_get_value(PyObject *self, PyObject *args) { + PyObject * _resultobj; + char * _result; + char * _arg0; + char * _arg1; + + self = self; + if(!PyArg_ParseTuple(args,"ss:gnome_vfs_mime_get_value",&_arg0,&_arg1)) + return NULL; + _result = (char *)gnome_vfs_mime_get_value(_arg0,_arg1); + _resultobj = Py_BuildValue("s", _result); + return _resultobj; +} + +static PyObject *_wrap_default_application_name(PyObject *self, PyObject *args) { + PyObject * _resultobj; + char * _result; + char * _arg0; + + self = self; + if(!PyArg_ParseTuple(args,"s:default_application_name",&_arg0)) + return NULL; + _result = (char *)default_application_name(_arg0); + _resultobj = Py_BuildValue("s", _result); + return _resultobj; +} + +static PyObject *_wrap_default_application_command(PyObject *self, PyObject *args) { + PyObject * _resultobj; + char * _result; + char * _arg0; + + self = self; + if(!PyArg_ParseTuple(args,"s:default_application_command",&_arg0)) + return NULL; + _result = (char *)default_application_command(_arg0); + _resultobj = Py_BuildValue("s", _result); + return _resultobj; +} + +static PyMethodDef grampslibMethods[] = { + { "default_application_command", _wrap_default_application_command, 1 }, + { "default_application_name", _wrap_default_application_name, 1 }, + { "gnome_vfs_mime_get_value", _wrap_gnome_vfs_mime_get_value, 1 }, + { "gnome_vfs_mime_get_description", _wrap_gnome_vfs_mime_get_description, 1 }, + { "gnome_vfs_mime_type_from_name", _wrap_gnome_vfs_mime_type_from_name, 1 }, + { "gnome_vfs_mime_get_icon", _wrap_gnome_vfs_mime_get_icon, 1 }, + { NULL, NULL } +}; +static PyObject *SWIG_globals; +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT(void,initgrampslib)() { + PyObject *m, *d; + SWIG_globals = SWIG_newvarlink(); + m = Py_InitModule("grampslib", grampslibMethods); + d = PyModule_GetDict(m); +/* + * These are the pointer type-equivalency mappings. + * (Used by the SWIG pointer type-checker). + */ + SWIG_RegisterMapping("_signed_long","_long",0); + SWIG_RegisterMapping("_long","_unsigned_long",0); + SWIG_RegisterMapping("_long","_signed_long",0); + SWIG_RegisterMapping("_unsigned_long","_long",0); + SWIG_RegisterMapping("_signed_int","_int",0); + SWIG_RegisterMapping("_unsigned_short","_short",0); + SWIG_RegisterMapping("_signed_short","_short",0); + SWIG_RegisterMapping("_unsigned_int","_int",0); + SWIG_RegisterMapping("_short","_unsigned_short",0); + SWIG_RegisterMapping("_short","_signed_short",0); + SWIG_RegisterMapping("_int","_unsigned_int",0); + SWIG_RegisterMapping("_int","_signed_int",0); +} diff --git a/gramps2/src/intl.py b/gramps2/src/intl.py index 63c262d4b..308e2edc4 100644 --- a/gramps2/src/intl.py +++ b/gramps2/src/intl.py @@ -46,6 +46,9 @@ try: def bindtextdomain(s,x): return + + def bind_textdomain_codeset(s,x): + return except: import traceback traceback.print_exc() @@ -58,3 +61,6 @@ except: def bindtextdomain(s,x): return + + def bind_textdomain_codeset(s,x): + return diff --git a/gramps2/src/papersize.xml b/gramps2/src/papersize.xml index ca0b151b0..a3e3e645b 100644 --- a/gramps2/src/papersize.xml +++ b/gramps2/src/papersize.xml @@ -2,7 +2,6 @@ -