pychecker fixes, minor bugs in image handing

svn: r540
This commit is contained in:
Don Allingham 2001-11-02 17:46:33 +00:00
parent d5acdb775e
commit d149bdb8e5
38 changed files with 390 additions and 390 deletions

View File

@ -30,18 +30,14 @@ import string
# internationalization
#
#-------------------------------------------------------------------------
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import GDK
import GTK
import libglade
#-------------------------------------------------------------------------

View File

@ -18,20 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------
@ -39,12 +30,12 @@ import libglade
# gramps modules
#
#-------------------------------------------------------------------------
import intl
import const
import utils
from RelLib import *
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#

View File

@ -18,20 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------
@ -39,13 +30,13 @@ import libglade
# gramps modules
#
#-------------------------------------------------------------------------
import intl
import const
import utils
from RelLib import *
import Sources
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#

View File

@ -18,28 +18,19 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------

View File

@ -34,11 +34,9 @@ import PaperMenu
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import gnome.config
import gtk
import libglade
from gnome.config import get_string, get_bool, get_int, set_string, sync, set_bool, set_int
#-------------------------------------------------------------------------
#
@ -51,9 +49,9 @@ from Date import *
import const
import utils
import ListColors
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
_date_format_list = [
_("Month Day, Year"),
@ -187,36 +185,36 @@ def loadConfig(call):
global status_bar
_callback = call
lastfile = gnome.config.get_string("/gramps/data/LastFile")
usetabs = gnome.config.get_bool("/gramps/config/UseTabs")
usevc = gnome.config.get_bool("/gramps/config/UseVersionControl")
vc_comment = gnome.config.get_bool("/gramps/config/UseComment")
uncompress = gnome.config.get_bool("/gramps/config/DontCompressXML")
id_visible = gnome.config.get_bool("/gramps/config/IdVisible")
id_edit = gnome.config.get_bool("/gramps/config/IdEdit")
index_visible = gnome.config.get_bool("/gramps/config/IndexVisible")
show_detail = gnome.config.get_bool("/gramps/config/ShowDetail")
status_bar = gnome.config.get_int("/gramps/config/StatusBar")
display_attr = gnome.config.get_bool("/gramps/config/DisplayAttr")
attr_name = gnome.config.get_string("/gramps/config/DisplayAttrName")
lastfile = get_string("/gramps/data/LastFile")
usetabs = get_bool("/gramps/config/UseTabs")
usevc = get_bool("/gramps/config/UseVersionControl")
vc_comment = get_bool("/gramps/config/UseComment")
uncompress = get_bool("/gramps/config/DontCompressXML")
id_visible = get_bool("/gramps/config/IdVisible")
id_edit = get_bool("/gramps/config/IdEdit")
index_visible = get_bool("/gramps/config/IndexVisible")
show_detail = get_bool("/gramps/config/ShowDetail")
status_bar = get_int("/gramps/config/StatusBar")
display_attr = get_bool("/gramps/config/DisplayAttr")
attr_name = get_string("/gramps/config/DisplayAttrName")
hide_altnames = gnome.config.get_bool("/gramps/config/DisplayAltNames")
autoload = gnome.config.get_bool("/gramps/config/autoLoad")
dateFormat = gnome.config.get_int("/gramps/config/dateFormat")
dateEntry = gnome.config.get_int("/gramps/config/dateEntry")
paper_preference = gnome.config.get_string("/gramps/config/paperPreference")
output_preference = gnome.config.get_string("/gramps/config/outputPreference")
_name_format = gnome.config.get_int("/gramps/config/nameFormat")
hide_altnames = get_bool("/gramps/config/DisplayAltNames")
autoload = get_bool("/gramps/config/autoLoad")
dateFormat = get_int("/gramps/config/dateFormat")
dateEntry = get_int("/gramps/config/dateEntry")
paper_preference = get_string("/gramps/config/paperPreference")
output_preference = get_string("/gramps/config/outputPreference")
_name_format = get_int("/gramps/config/nameFormat")
iprefix = gnome.config.get_string("/gramps/config/iprefix")
fprefix = gnome.config.get_string("/gramps/config/fprefix")
sprefix = gnome.config.get_string("/gramps/config/sprefix")
oprefix = gnome.config.get_string("/gramps/config/oprefix")
pprefix = gnome.config.get_string("/gramps/config/pprefix")
iprefix = get_string("/gramps/config/iprefix")
fprefix = get_string("/gramps/config/fprefix")
sprefix = get_string("/gramps/config/sprefix")
oprefix = get_string("/gramps/config/oprefix")
pprefix = get_string("/gramps/config/pprefix")
report_dir = gnome.config.get_string("/gramps/config/ReportDirectory")
web_dir = gnome.config.get_string("/gramps/config/WebsiteDirectory")
db_dir = gnome.config.get_string("/gramps/config/DbDirectory")
report_dir = get_string("/gramps/config/ReportDirectory")
web_dir = get_string("/gramps/config/WebsiteDirectory")
db_dir = get_string("/gramps/config/DbDirectory")
if report_dir == None:
report_dir = "./"
@ -233,16 +231,16 @@ def loadConfig(call):
else:
db_dir = os.path.normpath(db_dir) + os.sep
name = gnome.config.get_string("/gramps/researcher/name")
addr = gnome.config.get_string("/gramps/researcher/addr")
city = gnome.config.get_string("/gramps/researcher/city")
state = gnome.config.get_string("/gramps/researcher/state")
country = gnome.config.get_string("/gramps/researcher/country")
postal = gnome.config.get_string("/gramps/researcher/postal")
phone = gnome.config.get_string("/gramps/researcher/phone")
email = gnome.config.get_string("/gramps/researcher/email")
name = get_string("/gramps/researcher/name")
addr = get_string("/gramps/researcher/addr")
city = get_string("/gramps/researcher/city")
state = get_string("/gramps/researcher/state")
country = get_string("/gramps/researcher/country")
postal = get_string("/gramps/researcher/postal")
phone = get_string("/gramps/researcher/phone")
email = get_string("/gramps/researcher/email")
en = gnome.config.get_bool("/gramps/color/enableColors")
en = get_bool("/gramps/color/enableColors")
if en == None:
en = 0
@ -332,8 +330,8 @@ def loadConfig(call):
#
#-------------------------------------------------------------------------
def save_last_file(file):
gnome.config.set_string("/gramps/data/LastFile",file)
gnome.config.sync()
set_string("/gramps/data/LastFile",file)
sync()
#-------------------------------------------------------------------------
#
@ -362,15 +360,15 @@ def on_initDruid_finish(obj,b):
#
#-------------------------------------------------------------------------
def store_researcher(res):
gnome.config.set_string("/gramps/researcher/name",res.name)
gnome.config.set_string("/gramps/researcher/addr",res.addr)
gnome.config.set_string("/gramps/researcher/city",res.city)
gnome.config.set_string("/gramps/researcher/state",res.state)
gnome.config.set_string("/gramps/researcher/country",res.country)
gnome.config.set_string("/gramps/researcher/postal",res.postal)
gnome.config.set_string("/gramps/researcher/phone",res.phone)
gnome.config.set_string("/gramps/researcher/email",res.email)
gnome.config.sync()
set_string("/gramps/researcher/name",res.name)
set_string("/gramps/researcher/addr",res.addr)
set_string("/gramps/researcher/city",res.city)
set_string("/gramps/researcher/state",res.state)
set_string("/gramps/researcher/country",res.country)
set_string("/gramps/researcher/postal",res.postal)
set_string("/gramps/researcher/phone",res.phone)
set_string("/gramps/researcher/email",res.email)
sync()
#-------------------------------------------------------------------------
#
@ -470,29 +468,29 @@ def on_propertybox_apply(obj,page):
paper_preference = paper_obj.get_data(DATA)
output_preference = output_obj.get_data(DATA)
gnome.config.set_bool("/gramps/config/UseTabs",usetabs)
gnome.config.set_bool("/gramps/config/UseVersionControl",usevc)
gnome.config.set_bool("/gramps/config/UseComment",vc_comment)
gnome.config.set_bool("/gramps/config/DontCompressXML",uncompress)
gnome.config.set_bool("/gramps/config/IdVisible",id_visible)
gnome.config.set_bool("/gramps/config/IdEdit",id_edit)
gnome.config.set_bool("/gramps/config/IndexVisible",index_visible)
gnome.config.set_bool("/gramps/config/ShowDetail",show_detail)
gnome.config.set_int("/gramps/config/StatusBar",status_bar)
gnome.config.set_bool("/gramps/config/DisplayAttr",display_attr)
gnome.config.set_string("/gramps/config/DisplayAttrName",attr_name)
gnome.config.set_string("/gramps/config/paperPreference",paper_preference)
gnome.config.set_string("/gramps/config/outputPreference",output_preference)
gnome.config.set_bool("/gramps/config/autoLoad",autoload)
gnome.config.set_bool("/gramps/config/DisplayAltNames",hide_altnames)
gnome.config.set_string("/gramps/config/ReportDirectory",report_dir)
gnome.config.set_string("/gramps/config/WebsiteDirectory",web_dir)
gnome.config.set_string("/gramps/config/DbDirectory",db_dir)
gnome.config.set_string("/gramps/config/iprefix",iprefix)
gnome.config.set_string("/gramps/config/fprefix",fprefix)
gnome.config.set_string("/gramps/config/pprefix",pprefix)
gnome.config.set_string("/gramps/config/oprefix",oprefix)
gnome.config.set_string("/gramps/config/sprefix",sprefix)
set_bool("/gramps/config/UseTabs",usetabs)
set_bool("/gramps/config/UseVersionControl",usevc)
set_bool("/gramps/config/UseComment",vc_comment)
set_bool("/gramps/config/DontCompressXML",uncompress)
set_bool("/gramps/config/IdVisible",id_visible)
set_bool("/gramps/config/IdEdit",id_edit)
set_bool("/gramps/config/IndexVisible",index_visible)
set_bool("/gramps/config/ShowDetail",show_detail)
set_int("/gramps/config/StatusBar",status_bar)
set_bool("/gramps/config/DisplayAttr",display_attr)
set_string("/gramps/config/DisplayAttrName",attr_name)
set_string("/gramps/config/paperPreference",paper_preference)
set_string("/gramps/config/outputPreference",output_preference)
set_bool("/gramps/config/autoLoad",autoload)
set_bool("/gramps/config/DisplayAltNames",hide_altnames)
set_string("/gramps/config/ReportDirectory",report_dir)
set_string("/gramps/config/WebsiteDirectory",web_dir)
set_string("/gramps/config/DbDirectory",db_dir)
set_string("/gramps/config/iprefix",iprefix)
set_string("/gramps/config/fprefix",fprefix)
set_string("/gramps/config/pprefix",pprefix)
set_string("/gramps/config/oprefix",oprefix)
set_string("/gramps/config/sprefix",sprefix)
# search for the active date format selection
@ -500,13 +498,13 @@ def on_propertybox_apply(obj,page):
active = format_menu.get_active().get_data(INDEX)
set_format_code(active)
gnome.config.set_int("/gramps/config/dateFormat",active)
set_int("/gramps/config/dateFormat",active)
format_menu = prefsTop.get_widget("date_entry_format").get_menu()
entry_active = format_menu.get_active().get_data(INDEX)
Date.entryCode = entry_active
gnome.config.set_int("/gramps/config/dateEntry",entry_active)
set_int("/gramps/config/dateEntry",entry_active)
# get the name format
@ -515,7 +513,7 @@ def on_propertybox_apply(obj,page):
name_tuple = _name_format_list[active_name]
nameof = name_tuple[1]
gnome.config.set_int("/gramps/config/nameFormat",active_name)
set_int("/gramps/config/nameFormat",active_name)
name = prefsTop.get_widget("resname").get_text()
addr = prefsTop.get_widget("resaddr").get_text()
@ -527,7 +525,7 @@ def on_propertybox_apply(obj,page):
email = prefsTop.get_widget("resemail").get_text()
ListColors.set_enable(prefsTop.get_widget("enableColors").get_active())
gnome.config.set_bool("/gramps/color/enableColors",ListColors.get_enable())
set_bool("/gramps/color/enableColors",ListColors.get_enable())
ListColors.oddfg = prefsTop.get_widget(ODDFGCOLOR).get_i16()
ListColors.oddbg = prefsTop.get_widget(ODDBGCOLOR).get_i16()
@ -553,7 +551,7 @@ def on_propertybox_apply(obj,page):
# update the config file
gnome.config.sync()
sync()
_callback()
#-------------------------------------------------------------------------
@ -562,9 +560,9 @@ def on_propertybox_apply(obj,page):
#
#-------------------------------------------------------------------------
def save_config_color(name,color):
gnome.config.set_int("/gramps/color/" + name + ".r",color[0])
gnome.config.set_int("/gramps/color/" + name + ".g",color[1])
gnome.config.set_int("/gramps/color/" + name + ".b",color[2])
set_int("/gramps/color/" + name + ".r",color[0])
set_int("/gramps/color/" + name + ".g",color[1])
set_int("/gramps/color/" + name + ".b",color[2])
#-------------------------------------------------------------------------
#
@ -668,13 +666,13 @@ def display_preferences_box(db):
display_altnames.set_active(hide_altnames)
paper_obj = prefsTop.get_widget("paper_size")
menu = GtkMenu()
menu = gtk.GtkMenu()
choice = 0
for index in range(0,len(PaperMenu.paper_sizes)):
name = PaperMenu.paper_sizes[index].get_name()
if name == paper_preference:
choice = index
item = GtkMenuItem(name)
item = gtk.GtkMenuItem(name)
item.set_data(OBJECT,pbox)
item.set_data(DATA,name)
item.connect("activate", on_format_toggled)
@ -684,7 +682,7 @@ def display_preferences_box(db):
paper_obj.set_menu(menu)
output_obj = prefsTop.get_widget("output_format")
menu = GtkMenu()
menu = gtk.GtkMenu()
choice = 0
choice = 0
@ -692,7 +690,7 @@ def display_preferences_box(db):
for name in const.output_formats:
if name == output_preference:
choice = index
item = GtkMenuItem(name)
item = gtk.GtkMenuItem(name)
item.set_data(OBJECT,pbox)
item.set_data(DATA,name)
item.connect("activate", on_format_toggled)
@ -703,9 +701,9 @@ def display_preferences_box(db):
output_obj.set_menu(menu)
date_option = prefsTop.get_widget("date_format")
date_menu = GtkMenu()
date_menu = gtk.GtkMenu()
for index in range(0,len(_date_format_list)):
item = GtkMenuItem(_date_format_list[index])
item = gtk.GtkMenuItem(_date_format_list[index])
item.set_data(INDEX,index)
item.set_data(OBJECT,pbox)
item.connect("activate", on_format_toggled)
@ -715,9 +713,9 @@ def display_preferences_box(db):
date_option.set_menu(date_menu)
date_entry = prefsTop.get_widget("date_entry_format")
date_menu = GtkMenu()
date_menu = gtk.GtkMenu()
for index in range(0,len(_date_entry_list)):
item = GtkMenuItem(_date_entry_list[index])
item = gtk.GtkMenuItem(_date_entry_list[index])
item.set_data(INDEX,index)
item.set_data(OBJECT,pbox)
item.connect("activate", on_format_toggled)
@ -727,10 +725,10 @@ def display_preferences_box(db):
date_entry.set_menu(date_menu)
name_option = prefsTop.get_widget("name_format")
name_menu = GtkMenu()
name_menu = gtk.GtkMenu()
for index in range(0,len(_name_format_list)):
name_tuple = _name_format_list[index]
item = GtkMenuItem(name_tuple[0])
item = gtk.GtkMenuItem(name_tuple[0])
item.set_data(INDEX,index)
item.set_data(OBJECT,pbox)
item.connect("activate", on_format_toggled)
@ -788,9 +786,9 @@ def display_preferences_box(db):
#
#-------------------------------------------------------------------------
def get_config_color(name,defval):
r = gnome.config.get_int("/gramps/color/" + name + ".r")
g = gnome.config.get_int("/gramps/color/" + name + ".g")
b = gnome.config.get_int("/gramps/color/" + name + ".b")
r = get_int("/gramps/color/" + name + ".r")
g = get_int("/gramps/color/" + name + ".g")
b = get_int("/gramps/color/" + name + ".b")
if r == None:
return defval
else:

View File

@ -23,9 +23,9 @@
from re import IGNORECASE, compile
import string
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#

View File

@ -30,8 +30,7 @@ import string
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
from gnome.ui import GnomeErrorDialog, GnomeWarningDialog, GnomeQuestionDialog
import libglade
import GdkImlib
@ -40,7 +39,6 @@ import GdkImlib
# gramps modules
#
#-------------------------------------------------------------------------
import intl
import const
import utils
import Config
@ -48,7 +46,8 @@ from RelLib import *
import ImageSelect
import sort
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
@ -414,14 +413,15 @@ class EditPerson:
utils.destroy_passed_object(obj)
def on_delete_event(self,obj,b):
"""If the data has changed, give the user a chance to cancel the close window"""
"""If the data has changed, give the user a chance to cancel
the close window"""
if self.did_data_change():
q = _("Are you sure you want to abandon your changes?")
GnomeQuestionDialog(q,self.cancel_callback)
return TRUE
return 1
else:
utils.destroy_passed_object(obj)
return FALSE
return 0
def cancel_callback(self,a):
"""If the user answered yes to abandoning changes, close the window"""

View File

@ -18,22 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
import Config
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------
@ -41,14 +30,15 @@ import libglade
# gramps modules
#
#-------------------------------------------------------------------------
import intl
import const
import utils
import Config
from RelLib import *
import Sources
import ImageSelect
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#

View File

@ -19,20 +19,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import os
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------
@ -40,14 +31,14 @@ import libglade
# gramps modules
#
#-------------------------------------------------------------------------
import intl
import const
import utils
import Config
from RelLib import *
import ImageSelect
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#

View File

@ -18,23 +18,21 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
from string import strip
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
import Sources
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import Sources
import const
import utils
from RelLib import *
@ -119,7 +117,7 @@ class EventEditor:
ename = self.name_field.get_text()
edate = self.date_field.get_text()
ecause = self.cause_field.get_text()
eplace = string.strip(self.place_field.get_text())
eplace = strip(self.place_field.get_text())
eplace_obj = utils.get_place_from_list(self.place_combo)
enote = self.note_field.get_chars(0,-1)
edesc = self.descr_field.get_text()

View File

@ -21,26 +21,22 @@
from RelLib import *
import string
import os
import sys
import utils
#-------------------------------------------------------------------------
#
# Try to abstract SAX1 from SAX2
# Find a parser. xml.sax should be available, but it is possible that
# someone has removed it in favor of the PyXML distribution, which
# defined a _xmlplux.sax
#
#-------------------------------------------------------------------------
if sys.version[0] != '1':
try:
from _xmlplus.sax import handler
from _xmlplus.sax import make_parser
except:
from xml.sax import handler
from xml.sax import make_parser
else:
try:
from xml.sax import handler
from xml.sax import make_parser
except:
from _xmlplus.sax import handler
from _xmlplus.sax import make_parser
#-------------------------------------------------------------------------
#
# Unicode to latin conversion
@ -467,8 +463,8 @@ class GrampsParser(handler.ContentHandler):
self.object.setMimeType(u2l(attrs['mime']))
self.object.setDescription(u2l(attrs['description']))
src = u2l(attrs["src"])
if src[0] != os.sep:
self.object.setPath("%s%s%s" % (self.base,os.sep,src))
if src[0] != '/':
self.object.setPath("%s/%s" % (self.base,src))
self.object.setLocal(1)
else:
self.object.setPath(src)
@ -477,7 +473,7 @@ class GrampsParser(handler.ContentHandler):
def stop_object(self,tag):
self.object = None
def stop_objref(self,tage):
def stop_objref(self,tag):
self.objref = None
#---------------------------------------------------------------------
@ -497,8 +493,8 @@ class GrampsParser(handler.ContentHandler):
self.pref.setPrivacy(int(attrs[key]))
elif key == "src":
src = u2l(attrs["src"])
if src[0] != os.sep:
self.photo.setPath("%s%s%s" % (self.base,os.sep,src))
if src[0] != '/':
self.photo.setPath("%s/%s" % (self.base,src))
self.photo.setLocal(1)
else:
self.photo.setPath(src)

View File

@ -21,11 +21,11 @@
import os
import string
import re
import intl
import utils
import gnome.ui
_ = intl.gettext
from intl import gettext
_ = gettext
from TextDoc import *

View File

@ -41,14 +41,14 @@ import libglade
# gramps modules
#
#-------------------------------------------------------------------------
import intl
import const
import utils
import Config
from RelLib import *
import RelImage
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
@ -249,8 +249,9 @@ class Gallery(ImageSelect):
photo = Photo()
photo.setPath(name)
photo.setMimeType(mime)
description = os.path.basename(name)
photo.setDescription(description)
basename = os.path.basename(name)
(root,ext) = os.path.splitext(basename)
photo.setDescription(root)
self.savephoto(photo)
elif protocol != "":
import urllib
@ -423,7 +424,11 @@ class Gallery(ImageSelect):
photo = self.dataobj.getPhotoList()[self.selectedIcon]
LocalMediaProperties(photo,self.path)
#-------------------------------------------------------------------------
#
# LocalMediaProperties
#
#-------------------------------------------------------------------------
class LocalMediaProperties:
def __init__(self,photo,path):
@ -507,6 +512,11 @@ class LocalMediaProperties:
import AttrEdit
AttrEdit.AttributeEditor(self,None,"Media Object",[])
#-------------------------------------------------------------------------
#
# GlobalMediaProperties
#
#-------------------------------------------------------------------------
class GlobalMediaProperties:
def __init__(self,db,object,update):
@ -518,14 +528,15 @@ class GlobalMediaProperties:
self.path = self.db.getSavePath()
self.change_dialog = libglade.GladeXML(const.imageselFile,"change_global")
descr_window = self.change_dialog.get_widget("description")
self.descr_window = self.change_dialog.get_widget("description")
self.notes = self.change_dialog.get_widget("notes")
pixmap = self.change_dialog.get_widget("pixmap")
self.attr_type = self.change_dialog.get_widget("attr_type")
self.attr_value = self.change_dialog.get_widget("attr_value")
self.attr_details = self.change_dialog.get_widget("attr_details")
self.attr_list = self.change_dialog.get_widget("attr_list")
descr_window.set_text(self.object.getDescription())
self.descr_window.set_text(self.object.getDescription())
mtype = self.object.getMimeType()
pixmap.load_file(utils.thumb_path(self.path,self.object))
@ -535,7 +546,7 @@ class GlobalMediaProperties:
self.update_info()
self.change_dialog.get_widget("type").set_text(utils.get_mime_description(mtype))
self.change_dialog.get_widget("notes").insert_defaults(object.getNote())
self.notes.insert_defaults(object.getNote())
self.change_dialog.signal_autoconnect({
"on_cancel_clicked" : utils.destroy_passed_object,
"on_ok_clicked" : self.on_ok_clicked,
@ -594,15 +605,17 @@ class GlobalMediaProperties:
self.display_refs()
def on_apply_clicked(self, obj):
text = self.change_dialog.get_widget("notes").get_chars(0,-1)
desc = self.change_dialog.get_widget("description").get_text()
text = self.notes.get_chars(0,-1)
desc = self.descr_window.get_text()
note = self.object.getNote()
if text != note or desc != self.object.getDescription():
self.object.setNote(text)
self.object.setDescription(desc)
utils.modified()
if self.lists_changed:
self.object.setAttributeList(self.alist)
utils.modified()
self.update()
def on_ok_clicked(self, obj):
self.on_apply_clicked(obj)

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
from gtk import *
from gtk import GdkColor
_enable = 0
oddbg = (0xffff,0xffff,0xffff)

View File

@ -18,21 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------

View File

@ -23,13 +23,8 @@
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
import intl
_ = intl.gettext
#-------------------------------------------------------------------------
#
@ -42,6 +37,8 @@ import Config
import utils
from RelLib import *
import ImageSelect
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
@ -154,7 +151,6 @@ class Marriage:
def get_widget(self,name):
return self.top.get_widget(name)
def did_data_change(self):
changed = 0
relation = self.type_field.entry.get_text()

View File

@ -21,17 +21,16 @@
import GTK
import GDK
import gnome.ui
import gtk
import string
import ImageSelect
from RelLib import *
import intl
import utils
import const
import os
_ = intl.gettext
from intl import gettext
_ = gettext
class MediaView:
def __init__(self,db,glade,update):
@ -71,14 +70,15 @@ class MediaView:
self.mdetails.set_text("")
def load_media(self):
self.media_list.freeze()
self.media_list.clear()
if len(self.media_list.selection) == 0:
current_row = 0
else:
current_row = self.media_list.selection[0]
self.media_list.freeze()
self.media_list.clear()
index = 0
objects = self.db.getObjectMap().values()
@ -107,6 +107,10 @@ class MediaView:
self.mdetails.set_text("")
self.preview.load_imlib(const.empty_image)
if current_row < self.media_list.rows:
self.media_list.moveto(current_row)
else:
self.media_list.moveto(0)
self.media_list.thaw()
def create_add_dialog(self,obj):

View File

@ -26,11 +26,13 @@ import const
_ = intl.gettext
import string
import gtk
import gnome.ui
import libglade
#-------------------------------------------------------------------------
#
# Merge People
#
#-------------------------------------------------------------------------
class MergePeople:
def __init__(self,db,person1,person2,update):
@ -854,22 +856,3 @@ class MergePlaces:
utils.modified()
utils.destroy_passed_object(obj)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def new_after_edit(epo):
pass
if __name__ == "__main__":
import sys
import ReadXML
database = RelLib.RelDataBase()
ReadXML.loadData(database,sys.argv[1])
person1 = database.getPersonMap().values()[0]
person2 = database.getPersonMap().values()[1]
MergePeople(database,person1,person2)
gtk.mainloop()

View File

@ -18,20 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------

View File

@ -18,20 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------

View File

@ -21,9 +21,9 @@
import TextDoc
import gtk
import Config
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
paper_sizes = [
TextDoc.PaperStyle("Letter",27.94,21.59),

View File

@ -27,9 +27,9 @@ import GDK
import gtk
import Config
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#

View File

@ -21,15 +21,14 @@
import GTK
import GDK
import gnome.ui
import gtk
import string
from RelLib import *
import EditPlace
import utils
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
class PlaceView:
def __init__(self,db,glade,update):

View File

@ -23,12 +23,11 @@
#
#
#-------------------------------------------------------------------------
from gtk import *
import gtk
import libglade
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
@ -37,7 +36,7 @@ _ = intl.gettext
#-------------------------------------------------------------------------
import os
import sys
import re
from re import compile
#-------------------------------------------------------------------------
#
@ -71,7 +70,7 @@ IMAGE = "i"
TASK = "f"
TITLE = "t"
pymod = re.compile(r"^(.*)\.py$")
pymod = compile(r"^(.*)\.py$")
#-------------------------------------------------------------------------
#
@ -108,7 +107,7 @@ class ReportPlugins:
self.dialog.get_widget("description").set_text(doc)
i,m = create_pixmap_from_xpm_d(GtkWindow(),None,xpm)
i,m = gtk.create_pixmap_from_xpm_d(gtk.GtkWindow(),None,xpm)
img.set(i,m)
self.dialog.get_widget("report_title").set_text(title)
@ -157,7 +156,7 @@ class ToolPlugins:
def build_tree(tree,list,task):
item_hash = {}
for report in list:
item = GtkTreeItem(report[2])
item = gtk.GtkTreeItem(report[2])
item.connect("select",task)
item.set_data(TASK,report[0])
item.set_data(TITLE,report[2])
@ -172,10 +171,10 @@ def build_tree(tree,list,task):
key_list = item_hash.keys()
key_list.sort()
for key in key_list:
top_item = GtkTreeItem(key)
top_item = gtk.GtkTreeItem(key)
top_item.show()
tree.append(top_item)
subtree = GtkTree()
subtree = gtk.GtkTree()
subtree.show()
top_item.set_subtree(subtree)
subtree.show()
@ -297,7 +296,7 @@ def register_tool(task, name, category=None, description=None, xpm=None):
#
#-------------------------------------------------------------------------
def build_menu(top_menu,list,callback):
report_menu = GtkMenu()
report_menu = gtk.GtkMenu()
report_menu.show()
hash = {}
@ -310,16 +309,16 @@ def build_menu(top_menu,list,callback):
catlist = hash.keys()
catlist.sort()
for key in catlist:
entry = GtkMenuItem(key)
entry = gtk.GtkMenuItem(key)
entry.show()
report_menu.append(entry)
submenu = GtkMenu()
submenu = gtk.GtkMenu()
submenu.show()
entry.set_submenu(submenu)
list = hash[key]
list.sort()
for name in list:
subentry = GtkMenuItem(name[0])
subentry = gtk.GtkMenuItem(name[0])
subentry.show()
subentry.connect("activate",callback,name[1])
submenu.append(subentry)
@ -332,20 +331,20 @@ def build_tools_menu(top_menu,callback):
build_menu(top_menu,_tools,callback)
def build_export_menu(top_menu,callback):
myMenu = GtkMenu()
myMenu = gtk.GtkMenu()
for report in _exports:
item = GtkMenuItem(report[1])
item = gtk.GtkMenuItem(report[1])
item.connect("activate", callback ,report[0])
item.show()
myMenu.append(item)
top_menu.set_submenu(myMenu)
def build_import_menu(top_menu,callback):
myMenu = GtkMenu()
myMenu = gtk.GtkMenu()
for report in _imports:
item = GtkMenuItem(report[1])
item = gtk.GtkMenuItem(report[1])
item.connect("activate", callback ,report[0])
item.show()
myMenu.append(item)

View File

@ -18,23 +18,36 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
from RelLib import *
from GrampsParser import *
#-------------------------------------------------------------------------
#
#
# Standard Python Modules
#
#-------------------------------------------------------------------------
import string
import time
import os
from gnome.ui import *
import intl
_ = intl.gettext
#-------------------------------------------------------------------------
#
# Gnome/GTK
#
#-------------------------------------------------------------------------
from gnome.ui import GnomeErrorDialog
#-------------------------------------------------------------------------
#
# Gramps Modules
#
#-------------------------------------------------------------------------
from RelLib import *
from GrampsParser import GrampsParser, GrampsImportParser
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
# Try to detect the presence of gzip
#
#-------------------------------------------------------------------------
try:
import gzip
gzip_ok = 1
@ -232,6 +245,7 @@ def loadRevision(database, file, filename, revision, callback=None):
if __name__ == "__main__":
import profile
import sys
import time
database = RelDataBase()
t1 = time.time()

View File

@ -20,18 +20,34 @@
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
# Standard python modules
#
#-------------------------------------------------------------------------
import os
import const
import intl
import string
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gnome.ui import GnomeErrorDialog, GnomeWarningDialog
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
import const
import utils
from gnome.ui import *
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
# Check for the python imaging library
#
#-------------------------------------------------------------------------
try:
import PIL.Image
no_pil = 0

View File

@ -1059,21 +1059,15 @@ class Event(DataObj):
"""returns 1 if the spdcified event is the same as the instance"""
if other == None:
return 0
if self.name != other.name:
return 0
if self.place != other.place:
return 0
if compare_dates(self.getDateObj(),other.getDateObj()):
return 0
if self.description != other.description:
return 0
if self.cause != other.cause:
return 0
if self.private != other.private:
if (self.name != other.name or
self.place != other.place or
self.description != other.description or
self.cause != other.cause or
self.private != other.private or
compare_dates(self.getDateObj(),other.getDateObj()) or
len(self.getSourceRefList()) != len(other.getSourceRefList())):
return 0
if len(self.getSourceRefList()) != len(other.getSourceRefList()):
return 0
index = 0
olist = other.getSourceRefList()
for a in self.getSourceRefList():

View File

@ -18,29 +18,19 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
import os
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------

View File

@ -18,18 +18,30 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import GTK
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import GDK
import gnome.ui
import gtk
import string
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
from RelLib import *
import intl
import EditSource
import utils
_ = intl.gettext
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from intl import gettext
_ = gettext
class SourceView:
def __init__(self,db,source_list,update):

View File

@ -23,8 +23,7 @@
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import gtk
import libglade
#-------------------------------------------------------------------------
@ -184,10 +183,10 @@ class SourceEditor:
sel_child = None
list = []
for src in values:
l = GtkLabel("%s [%s]" % (src.getTitle(),src.getId()))
l = gtk.GtkLabel("%s [%s]" % (src.getTitle(),src.getId()))
l.show()
l.set_alignment(0,0.5)
c = GtkListItem()
c = gtk.GtkListItem()
c.add(l)
c.set_data("s",src)
c.show()

View File

@ -18,21 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import libglade
#-------------------------------------------------------------------------

View File

@ -18,26 +18,54 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# standard python modules
#
#-------------------------------------------------------------------------
import popen2
import re
import os
import string
import shutil
import intl
import libglade
import const
import utils
_ = intl.gettext
from re import compile
#-------------------------------------------------------------------------
#
# GTK/GNOME
#
#-------------------------------------------------------------------------
import libglade
#-------------------------------------------------------------------------
#
# standard python modules
#
#-------------------------------------------------------------------------
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
# Attempt to load the gzip library (should be standard, but Slackware
# appears to have problems)
#
#-------------------------------------------------------------------------
try:
import gzip
_gzip_ok = 1
except:
_gzip_ok = 0
_revision_re = re.compile("revision\s+([\d\.]+)")
_date_re = re.compile("date:\s+([^;]+);\s+author:\s([^;]+);")
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_revision_re = compile("revision\s+([\d\.]+)")
_date_re = compile("date:\s+([^;]+);\s+author:\s([^;]+);")
_sep = '-' * 10
_end = "=" * 10

View File

@ -18,11 +18,27 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import os
import intl
import GdkImlib
_ = intl.gettext
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
# GNOME/GTK
#
#-------------------------------------------------------------------------
from GdkImlib import create_image_from_xpm
#-------------------------------------------------------------------------
#
@ -53,24 +69,24 @@ if os.environ.has_key('GRAMPSDIR'):
else:
rootDir = "."
icon = rootDir + os.sep + "gramps.xpm"
logo = rootDir + os.sep + "logo.png"
gladeFile = rootDir + os.sep + "gramps.glade"
placesFile = rootDir + os.sep + "places.glade"
imageselFile = rootDir + os.sep + "imagesel.glade"
marriageFile = rootDir + os.sep + "marriage.glade"
editPersonFile = rootDir + os.sep + "EditPerson.glade"
bookFile = rootDir + os.sep + "bookmarks.glade"
pluginsFile = rootDir + os.sep + "plugins.glade"
editnoteFile = rootDir + os.sep + "editnote.glade"
configFile = rootDir + os.sep + "config.glade"
stylesFile = rootDir + os.sep + "styles.glade"
dialogFile = rootDir + os.sep + "dialog.glade"
mergeFile = rootDir + os.sep + "mergedata.glade"
pluginsDir = rootDir + os.sep + "plugins"
filtersDir = rootDir + os.sep + "filters"
dataDir = rootDir + os.sep + "data"
gtkrcFile = rootDir + os.sep + "gtkrc"
icon = "%s/gramps.xpm" % rootDir
logo = "%s/logo.png" % rootDir
gladeFile = "%s/gramps.glade" % rootDir
placesFile = "%s/places.glade" % rootDir
imageselFile = "%s/imagesel.glade" % rootDir
marriageFile = "%s/marriage.glade" % rootDir
editPersonFile = "%s/EditPerson.glade" % rootDir
bookFile = "%s/bookmarks.glade" % rootDir
pluginsFile = "%s/plugins.glade" % rootDir
editnoteFile = "%s/editnote.glade" % rootDir
configFile = "%s/config.glade" % rootDir
stylesFile = "%s/styles.glade" % rootDir
dialogFile = "%s/dialog.glade" % rootDir
mergeFile = "%s/mergedata.glade" % rootDir
pluginsDir = "%s/plugins" % rootDir
filtersDir = "%s/filters" % rootDir
dataDir = "%s/data" % rootDir
gtkrcFile = "%s/gtkrc" % rootDir
#-------------------------------------------------------------------------
#
@ -507,4 +523,4 @@ xpm_data = [
'" c None"',
'" "};']
empty_image = GdkImlib.create_image_from_xpm(xpm_data)
empty_image = create_image_from_xpm(xpm_data)

View File

@ -5,7 +5,6 @@ import intl
import os
intl.textdomain("gramps")
_ = intl.gettext
if os.environ.has_key("GRAMPSI18N"):
locale = os.environ["GRAMPSI18N"]

View File

@ -32,8 +32,8 @@ import os
# internationalization
#
#-------------------------------------------------------------------------
import intl
_ = intl.gettext
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#

View File

@ -108,6 +108,14 @@ class IndividualPage:
cell = TableCellStyle()
self.doc.add_cell_style("NormalCell",cell)
cell = TableCellStyle()
cell.set_padding(0.2)
self.doc.add_cell_style("ImageCell",cell)
cell = TableCellStyle()
cell.set_padding(0.2)
self.doc.add_cell_style("NoteCell",cell)
name = person.getPrimaryName().getRegularName()
self.doc.set_title(_("Summary of %s") % name)
@ -333,7 +341,7 @@ class IndividualPage:
self.doc.start_table("gallery","IndTable")
for obj in my_list:
self.doc.start_row()
self.doc.start_cell("NormalCell")
self.doc.start_cell("ImageCell")
self.doc.start_paragraph("Data")
src = obj.getReference().getPath()
base = os.path.basename(src)
@ -344,7 +352,7 @@ class IndividualPage:
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell("NormalCell")
self.doc.start_cell("NoteCell")
description = obj.getReference().getDescription()
if description != "":
self.doc.start_paragraph("PhotoDescription")

View File

@ -18,9 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
from RelLib import *
from Date import *
import string
from Date import compare_dates
#-------------------------------------------------------------------------
#

View File

@ -18,18 +18,45 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import string
import os
#-------------------------------------------------------------------------
#
# GNOME/GTK
#
#-------------------------------------------------------------------------
import gtk
import gnome.mime
import gnome.util
from gnome.ui import *
import string
import os
from gnome.ui import GnomeWarningDialog
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
import const
import RelImage
import intl
_ = intl.gettext
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
# modified flag
#
#-------------------------------------------------------------------------
_modifiedFlag = 0
LISTOBJ = "s"