* src/gramps_main.py: pychecker cleanup

* src/PeopleView.py: pychecker cleanup
* src/PeopleStore.py: pychecker cleanup
* src/EditPerson.py: pychecker cleanup
* src/QuickAdd.py: remove file
* src/SelectChild.py: Remove ability to add new person, since a separate
function for this already exists.
* src/gramps.glade: remvoe add button from select child dialog
* src/Makefile.am: remove QuickAdd.py
* src/intl.py: remove
* src/intl.c: remove
* src/TextDoc.py: remove
* src/DrawDoc.py: remove


svn: r2293
This commit is contained in:
Don Allingham 2003-10-30 04:17:05 +00:00
parent d96abbe81e
commit b67e68f304
11 changed files with 22 additions and 1819 deletions

View File

@ -1,262 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
from math import cos,sin,pi
#------------------------------------------------------------------------
#
# gramps modules
#
#------------------------------------------------------------------------
import TextDoc
SOLID = 0
DASHED = 1
#------------------------------------------------------------------------
#
# GraphicsStyle
#
#------------------------------------------------------------------------
class GraphicsStyle:
def __init__(self,obj=None):
if obj:
self.height = obj.height
self.width = obj.width
self.para_name = obj.para_name
self.shadow = obj.shadow
self.color = obj.color
self.fill_color = obj.fill_color
self.lwidth = obj.lwidth
self.lstyle = obj.lstyle
else:
self.height = 0
self.width = 0
self.para_name = ""
self.shadow = 0
self.lwidth = 0.5
self.color = (0,0,0)
self.fill_color = (255,255,255)
self.lstyle = SOLID
def set_line_width(self,val):
self.lwidth = val
def get_line_width(self):
return self.lwidth
def get_line_style(self):
return self.lstyle
def set_line_style(self,val):
self.lstyle = val
def set_height(self,val):
self.height = val
def set_width(self,val):
self.width = val
def set_paragraph_style(self,val):
self.para_name = val
def set_shadow(self,val):
self.shadow = val
def set_color(self,val):
self.color = val
def set_fill_color(self,val):
self.fill_color = val
def get_height(self):
return self.height
def get_width(self):
return self.width
def get_paragraph_style(self):
return self.para_name
def get_shadow(self):
return self.shadow
def get_color(self):
return self.color
def get_fill_color(self):
return self.fill_color
#------------------------------------------------------------------------
#
# DrawDoc
#
#------------------------------------------------------------------------
class DrawDoc:
def __init__(self,styles,type,orientation=TextDoc.PAPER_PORTRAIT):
self.orientation = orientation
if orientation == TextDoc.PAPER_PORTRAIT:
self.width = type.get_width()
self.height = type.get_height()
else:
self.width = type.get_height()
self.height = type.get_width()
self.tmargin = 2.54
self.bmargin = 2.54
self.lmargin = 2.54
self.rmargin = 2.54
self.style_list = styles.get_styles()
self.draw_styles = {}
self.name = ""
self.print_req = 0
def print_requested (self):
self.print_req = 1
def get_usable_width(self):
return self.width - (self.rmargin + self.lmargin)
def get_usable_height(self):
return self.height - (self.tmargin + self.bmargin)
def get_right_margin(self):
return self.rmargin
def get_left_margin(self):
return self.lmargin
def get_top_margin(self):
return self.tmargin
def get_bottom_margin(self):
return self.bmargin
def creator(self,name):
self.name = name
def add_draw_style(self,name,style):
self.draw_styles[name] = GraphicsStyle(style)
def open(self,filename):
pass
def close(self):
pass
def print_report(self):
pass
def start_page(self,orientation=None):
pass
def end_page(self):
pass
def draw_arc(self,style,x1,y1,x2,y2,angle,extent):
pass
def draw_path(self,style,path):
pass
def draw_box(self,style,text,x,y):
pass
def write_at(self,style,text,x,y):
pass
def draw_bar(self,style,x1,y1,x2,y2):
pass
def draw_text(self,style,text,x1,y1):
pass
def center_text(self,style,text,x1,y1):
pass
def rotate_text(self,style,text,x,y,angle):
pass
def draw_line(self,style,x1,y1,x2,y2):
pass
def draw_wedge(self, style, centerx, centery, radius, start_angle,
end_angle, short_radius=0):
while end_angle < start_angle:
end_angle += 360
p = []
degreestoradians = pi/180.0
radiansdelta = degreestoradians/2
sangle = start_angle*degreestoradians
eangle = end_angle*degreestoradians
while eangle<sangle:
eangle = eangle+2*pi
angle = sangle
if short_radius == 0:
p.append((centerx,centery))
else:
origx = (centerx + cos(angle)*short_radius)
origy = (centery + sin(angle)*short_radius)
p.append((origx, origy))
while angle<eangle:
x = centerx + cos(angle)*radius
y = centery + sin(angle)*radius
p.append((x,y))
angle = angle+radiansdelta
x = centerx + cos(eangle)*radius
y = centery + sin(eangle)*radius
p.append((x,y))
if short_radius:
x = centerx + cos(eangle)*short_radius
y = centery + sin(eangle)*short_radius
p.append((x,y))
angle = eangle
while angle>=sangle:
x = centerx + cos(angle)*short_radius
y = centery + sin(angle)*short_radius
p.append((x,y))
angle = angle-radiansdelta
self.draw_path(style,p)
delta = (eangle - sangle)/2.0
rad = short_radius + (radius-short_radius)/2.0
return ( (centerx + cos(sangle+delta) * rad),
(centery + sin(sangle+delta) * rad))
def start_path(self,style,x,y):
pass
def line_to(self,x,y):
pass
def arc_to(self,x,y,angle,extent):
pass
def end_path(self):
pass

View File

@ -47,14 +47,14 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_
import const
import Utils
import GrampsCfg
import Date
import ImageSelect
import sort
import AutoComp
import ListModel
import RelLib
import Sources
from DateEdit import DateEdit
import DateEdit
from QuestionDialog import QuestionDialog, WarningDialog, ErrorDialog, SaveDialog
from gettext import gettext as _
@ -288,10 +288,12 @@ class EditPerson:
self.addr_list.connect('drag_data_received',self.ad_drag_data_received)
self.addr_list.connect('drag_begin', self.ad_drag_begin)
self.bdate_check = DateEdit(self.bdate,self.get_widget("birth_stat"))
self.bdate_check = DateEdit.DateEdit(self.bdate,
self.get_widget("birth_stat"))
self.bdate_check.set_calendar(self.birth.getDateObj().get_calendar())
self.ddate_check = DateEdit(self.ddate,self.get_widget("death_stat"))
self.ddate_check = DateEdit.DateEdit(self.ddate,
self.get_widget("death_stat"))
self.ddate_check.set_calendar(self.death.getDateObj().get_calendar())
self.top.signal_autoconnect({
@ -1475,8 +1477,8 @@ class EditPerson:
return None
def on_primary_name_source_clicked(self,obj):
import Sources
Sources.SourceSelector(self.pname.getSourceRefList(),self,self.update_primary_name)
Sources.SourceSelector(self.pname.getSourceRefList(),self,
self.update_primary_name)
def update_primary_name(self,list):
self.pname.setSourceRefList(list)
@ -1487,8 +1489,8 @@ class EditPerson:
NoteEdit.NoteEditor(self.pname,self.window)
def on_ldsbap_source_clicked(self,obj):
import Sources
Sources.SourceSelector(self.lds_baptism.getSourceRefList(),self,self.update_ldsbap_list)
Sources.SourceSelector(self.lds_baptism.getSourceRefList(),
self,self.update_ldsbap_list)
def update_ldsbap_list(self,list):
self.lds_baptism.setSourceRefList(list)
@ -1499,8 +1501,8 @@ class EditPerson:
NoteEdit.NoteEditor(self.lds_baptism,self.window)
def on_ldsendow_source_clicked(self,obj):
import Sources
Sources.SourceSelector(self.lds_endowment.getSourceRefList(),self,self.set_ldsendow_list)
Sources.SourceSelector(self.lds_endowment.getSourceRefList(),
self,self.set_ldsendow_list)
def set_ldsendow_list(self,list):
self.lds_endowment.setSourceRefList(list)
@ -1511,8 +1513,8 @@ class EditPerson:
NoteEdit.NoteEditor(self.lds_endowment,self.window)
def on_ldsseal_source_clicked(self,obj):
import Sources
Sources.SourceSelector(self.lds_sealing.getSourceRefList(),self,self.lds_seal_list)
Sources.SourceSelector(self.lds_sealing.getSourceRefList(),
self,self.lds_seal_list)
def lds_seal_list(self,list):
self.lds_sealing.setSourceRefList(list)

View File

@ -70,7 +70,6 @@ pkgpython_PYTHON = \
PlaceView.py\
Plugins.py\
QuestionDialog.py\
QuickAdd.py\
ReadXML.py\
Relationship.py\
RelImage.py\

View File

@ -27,6 +27,13 @@ from gobject import TYPE_STRING, TYPE_PYOBJECT, TYPE_INT
import gtk
import pango
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# constants
@ -234,7 +241,6 @@ class PeopleStore:
if not iter:
iter = self.tree_roots[name]
child = self.model.iter_children(iter)
node_list = self.tree_list[name]
if self.model.get_value(child,0) is None:
self.model.remove(child)

View File

@ -1,83 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk.glade
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import Utils
import AutoComp
import const
import RelLib
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# QuickAdd
#
#-------------------------------------------------------------------------
class QuickAdd:
def __init__(self,db,sex,callback,default_name = ("","")):
self.db = db
self.callback = callback
self.xml = gtk.glade.XML(const.gladeFile,"addperson","gramps")
self.xml.get_widget(sex).set_active(1)
self.xml.signal_autoconnect({
"on_addfather_close": self.close,
"destroy_passed_object" : Utils.destroy_passed_object
})
self.window = self.xml.get_widget("addperson")
title = self.xml.get_widget('title')
combo = self.xml.get_widget("surnameCombo")
self.surname = self.xml.get_widget("surname")
self.given = self.xml.get_widget("given")
Utils.set_titles(self.window,title, _('Add Person'))
self.c = AutoComp.AutoCombo(combo,self.db.getSurnames())
if default_name[1]:
self.surname.set_text(default_name[1])
def close(self,obj):
surname = self.surname.get_text()
given = self.given.get_text()
person = RelLib.Person()
name = person.getPrimaryName()
name.setSurname(surname)
name.setFirstName(given)
if self.xml.get_widget("male").get_active():
person.setGender(RelLib.Person.male)
else:
person.setGender(RelLib.Person.female)
self.db.addPerson(person)
Utils.modified()
Utils.destroy_passed_object(self.window)
self.callback(person)

View File

@ -68,7 +68,6 @@ class SelectChild:
self.xml.signal_autoconnect({
"on_save_child_clicked" : self.on_save_child_clicked,
"on_show_toggled" : self.on_show_toggled,
"on_add_person_clicked" : self.on_add_person_clicked,
"destroy_passed_object" : self.close
})
@ -236,34 +235,6 @@ class SelectChild:
def on_show_toggled(self,obj):
self.redraw_child_list(not obj.get_active())
def on_add_person_clicked(self,obj):
"""Called with the Add button is pressed. Calls the QuickAdd
class to create a new person."""
import QuickAdd
autoname = GrampsCfg.lastnamegen
if autoname == 0:
name = self.north_american(0)
elif autoname == 2:
name = self.latin_american(0)
elif autoname == 3:
name = self.icelandic(0)
else:
name = ""
QuickAdd.QuickAdd(self.db,"male",self.add_new_parent, name)
def add_new_parent(self,person):
"""Adds a new person to either the father list or the mother list,
depending on the gender of the person."""
id = person.getId()
dinfo = self.db.getPersonDisplay(id)
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
self.refmodel.add_and_select(rdata)
self.add_person(person)
self.refmodel.center_selected()
def north_american(self,val):
if self.person.getGender() == Person.male:
return self.person.getPrimaryName().getSurname()
@ -303,7 +274,7 @@ class SelectChild:
if f:
fname = f.getPrimaryName().getFirstName()
if fname:
fname = string.split(fname)[0]
fname = fname.split()[0]
if val == 0:
return ("","%ssson" % fname)
elif val == 1:

File diff suppressed because it is too large Load Diff

View File

@ -4975,23 +4975,6 @@
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkButton" id="button155">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Add...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="on_add_person_clicked" last_modification_time="Wed, 30 Oct 2002 15:31:58 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton1">
<property name="visible">True</property>

View File

@ -26,7 +26,6 @@
#
#-------------------------------------------------------------------------
import os
import getopt
#-------------------------------------------------------------------------
#
@ -73,7 +72,6 @@ import EditPerson
import Find
import VersionControl
import ReadXML
import ListModel
import GrampsXML
try:
@ -979,8 +977,6 @@ class Gramps:
autosave = "%s/autosave.gramps" % dirname
if os.path.isfile(autosave):
q = _("An autosave file exists for %s.\nShould this "
"be loaded instead of the last saved version?") % dirname
self.yname = autosave
self.nname = filename

View File

@ -1,168 +0,0 @@
/***********************************************************
Copyright (C) 1997 Martin von Löwis
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies.
This software comes with no warranty. Use at your own risk.
******************************************************************/
#include <stdio.h>
#include <errno.h>
#include <libintl.h>
#include <locale.h>
#include "Python.h"
static PyObject*
PyIntl_gettext(PyObject* self,PyObject *args)
{
char *in;
if (!PyArg_ParseTuple(args,"z",&in))
return 0;
if (*in == '\0')
return PyString_FromString("");
return PyString_FromString(gettext(in));
}
static PyObject*
PyIntl_dgettext(PyObject* self,PyObject *args)
{
char *domain,*in;
if(!PyArg_ParseTuple(args,"zz",&domain,&in))return 0;
return PyString_FromString(dgettext(domain,in));
}
static PyObject*
PyIntl_dcgettext(PyObject *self,PyObject *args)
{
char *domain,*msgid;
int category;
if(!PyArg_ParseTuple(args,"zzi",&domain,&msgid,&category))
return 0;
return PyString_FromString(dcgettext(domain,msgid,category));
}
static PyObject*
PyIntl_textdomain(PyObject* self,PyObject* args)
{
char *domain;
if(!PyArg_ParseTuple(args,"z",&domain))return 0;
return PyString_FromString(textdomain(domain));
}
static PyObject*
PyIntl_bindtextdomain(PyObject* self,PyObject*args)
{
char *domain,*dirname;
if(!PyArg_ParseTuple(args,"zz",&domain,&dirname))return 0;
return PyString_FromString(bindtextdomain(domain,dirname));
}
static PyObject*
PyIntl_bind_textdomain_codeset(PyObject* self,PyObject*args)
{
char *domain,*dirname;
if(!PyArg_ParseTuple(args,"zz",&domain,&dirname))return 0;
return PyString_FromString(bind_textdomain_codeset(domain,dirname));
}
static PyObject*
PyIntl_setlocale(PyObject* self,PyObject* args)
{
int category;
char *locale=0;
if(!PyArg_ParseTuple(args,"i|z",&category,&locale))return 0;
return Py_BuildValue("z",setlocale(category,locale));
}
static PyObject*
PyIntl_localeconv(PyObject* self,PyObject* args)
{
PyObject* result;
struct lconv *l;
if(!PyArg_NoArgs(args))return 0;
result = PyDict_New();
if(!result)return 0;
l=localeconv();
#define RESULT_STRING(s) \
PyDict_SetItemString(result,#s,PyString_FromString(l->s))
#define RESULT_INT(i) \
PyDict_SetItemString(result,#i,PyInt_FromLong(l->i))
#define RESULT_CHAR(c) {\
char tmp[2]; \
tmp[0]=l->c;tmp[1]='\0';\
PyDict_SetItemString(result,#c,PyString_FromString(tmp)); \
}
/* Numeric information */
RESULT_STRING(decimal_point);
RESULT_STRING(thousands_sep);
RESULT_STRING(grouping);
/* Monetary information */
RESULT_STRING(int_curr_symbol);
RESULT_STRING(currency_symbol);
RESULT_STRING(mon_decimal_point);
RESULT_STRING(mon_thousands_sep);
RESULT_STRING(mon_grouping);
RESULT_STRING(positive_sign);
RESULT_STRING(negative_sign);
RESULT_INT(int_frac_digits);
RESULT_INT(frac_digits);
RESULT_INT(p_cs_precedes);
RESULT_INT(p_sep_by_space);
RESULT_INT(n_cs_precedes);
RESULT_INT(n_sep_by_space);
RESULT_INT(p_sign_posn);
RESULT_INT(n_sign_posn);
return result;
}
static struct PyMethodDef PyIntl_Methods[] = {
{"gettext",(PyCFunction)PyIntl_gettext,1},
{"dgettext",(PyCFunction)PyIntl_dgettext,1},
{"dcgettext",(PyCFunction)PyIntl_dcgettext,1},
{"textdomain",(PyCFunction)PyIntl_textdomain,1},
{"bindtextdomain",(PyCFunction)PyIntl_bindtextdomain,1},
{"bind_textdomain_codeset",(PyCFunction)PyIntl_bind_textdomain_codeset,1},
{"setlocale",(PyCFunction)PyIntl_setlocale,1},
{"localeconv",(PyCFunction)PyIntl_localeconv,0},
{NULL, NULL}
};
void
#ifdef VER15
initintl15()
#elif VER20
initintl20()
#elif VER21
initintl21()
#elif VER22
initintl22()
#endif
{
PyObject *m,*d;
#ifdef VER15
m=Py_InitModule("intl15",PyIntl_Methods);
#elif VER20
m=Py_InitModule("intl20",PyIntl_Methods);
#elif VER21
m=Py_InitModule("intl21",PyIntl_Methods);
#elif VER22
m=Py_InitModule("intl22",PyIntl_Methods);
#endif
d = PyModule_GetDict(m);
PyDict_SetItemString(d,"LC_CTYPE",PyInt_FromLong(LC_CTYPE));
PyDict_SetItemString(d,"LC_NUMERIC",PyInt_FromLong(LC_NUMERIC));
PyDict_SetItemString(d,"LC_TIME",PyInt_FromLong(LC_TIME));
PyDict_SetItemString(d,"LC_COLLATE",PyInt_FromLong(LC_COLLATE));
PyDict_SetItemString(d,"LC_MONETARY",PyInt_FromLong(LC_MONETARY));
PyDict_SetItemString(d,"LC_MESSAGES",PyInt_FromLong(LC_MESSAGES));
PyDict_SetItemString(d,"LC_ALL",PyInt_FromLong(LC_ALL));
if(PyErr_Occurred())
Py_FatalError("Can't initialize module intl");
}

View File

@ -1,72 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2003 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Abstracts the i18n library, providing a non-translated fallback if
everything else fails.
"""
import sys
import gtk
ver = sys.version[0:3]
_trans = None
try:
if ver in ["2.2","2.3"]:
from intl22 import *
status = None
else:
import gettext as foo
status = 'Internationalization library could not be loaded'
print status
def gettext(s):
return foo.gettext(s)
def textdomain(s):
return foo.textdomain(s)
def bindtextdomain(s,x):
return foo.bindtextdomain(s,x)
def bind_textdomain_codeset(s,x):
return
except:
import gettext as foo
status = 'Internationalization library could not be loaded'
def textdomain(s):
return foo.textdomain(s)
def bindtextdomain(s,x):
gtk.glade.bindtextdomain(s,x)
return foo.bindtextdomain(s,x)
def null(s):
return s
def bind_textdomain_codeset(s,x):
global gettext
try:
gettext = foo.translation(s).ugettext
except:
gettext = null