General cleaup

svn: r940
This commit is contained in:
Don Allingham 2002-04-21 14:53:28 +00:00
parent 0c55cfd67d
commit be7b3b54cb
17 changed files with 126 additions and 91 deletions

Binary file not shown.

View File

@ -35,9 +35,9 @@ import gtk
import Utils import Utils
import const import const
import GrampsCfg import GrampsCfg
import intl
import VersionControl import VersionControl
_ = intl.gettext from intl import gettext
_ = gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -1561,19 +1561,3 @@ def reorder_child_list(person, list):
list.remove(person) list.remove(person)
list.insert(target,person) list.insert(target,person)
return list return list
if __name__ == "__main__":
import RelLib
import os
import intl
import locale
intl.textdomain("gramps")
intl.bindtextdomain("gramps","locale")
locale.setlocale(locale.LC_NUMERIC,"C")
d = RelLib.GrampsDB()
p = RelLib.Person()
EditPerson(p,d)
gtk.mainloop()

View File

@ -78,7 +78,7 @@ class EditPlace:
self.top_window = libglade.GladeXML(const.placesFile,"placeEditor") self.top_window = libglade.GladeXML(const.placesFile,"placeEditor")
plwidget = self.top_window.get_widget("photolist") plwidget = self.top_window.get_widget("photolist")
self.gallery = ImageSelect.Gallery(place, self.path, plwidget, db) self.glry = ImageSelect.Gallery(place, self.path, plwidget, db)
self.title = self.top_window.get_widget("place_title") self.title = self.top_window.get_widget("place_title")
self.city = self.top_window.get_widget("city") self.city = self.top_window.get_widget("city")
self.parish = self.top_window.get_widget("parish") self.parish = self.top_window.get_widget("parish")
@ -121,24 +121,24 @@ class EditPlace:
self.note.set_word_wrap(1) self.note.set_word_wrap(1)
self.top_window.signal_autoconnect({ self.top_window.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object, "destroy_passed_object" : Utils.destroy_passed_object,
"on_source_clicked" : self.on_source_clicked, "on_source_clicked" : self.on_source_clicked,
"on_photolist_select_icon" : self.gallery.on_photo_select_icon, "on_photolist_select_icon" : self.glry.on_photo_select_icon,
"on_photolist_button_press_event" : self.gallery.on_button_press_event, "on_photolist_button_press" : self.glry.on_button_press_event,
"on_switch_page" : self.on_switch_page, "on_switch_page" : self.on_switch_page,
"on_addphoto_clicked" : self.gallery.on_add_photo_clicked, "on_addphoto_clicked" : self.glry.on_add_photo_clicked,
"on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked, "on_deletephoto_clicked" : self.glry.on_delete_photo_clicked,
"on_edit_properties_clicked": self.gallery.popup_change_description, "on_edit_properties_clicked": self.glry.popup_change_description,
"on_add_url_clicked" : self.on_add_url_clicked, "on_add_url_clicked" : self.on_add_url_clicked,
"on_delete_url_clicked" : self.on_delete_url_clicked, "on_delete_url_clicked" : self.on_delete_url_clicked,
"on_update_url_clicked" : self.on_update_url_clicked, "on_update_url_clicked" : self.on_update_url_clicked,
"on_add_loc_clicked" : self.on_add_loc_clicked, "on_add_loc_clicked" : self.on_add_loc_clicked,
"on_delete_loc_clicked" : self.on_delete_loc_clicked, "on_delete_loc_clicked" : self.on_delete_loc_clicked,
"on_update_loc_clicked" : self.on_update_loc_clicked, "on_update_loc_clicked" : self.on_update_loc_clicked,
"on_web_list_select_row" : self.on_web_list_select_row, "on_web_list_select_row" : self.on_web_list_select_row,
"on_web_go_clicked": self.on_web_go_clicked, "on_web_go_clicked" : self.on_web_go_clicked,
"on_loc_list_select_row" : self.on_loc_list_select_row, "on_loc_list_select_row" : self.on_loc_list_select_row,
"on_apply_clicked" : self.on_place_apply_clicked "on_apply_clicked" : self.on_place_apply_clicked
}) })
self.top = self.top_window.get_widget("placeEditor") self.top = self.top_window.get_widget("placeEditor")
@ -254,7 +254,7 @@ class EditPlace:
def on_switch_page(self,obj,a,page): def on_switch_page(self,obj,a,page):
if page == 3 and self.not_loaded: if page == 3 and self.not_loaded:
self.not_loaded = 0 self.not_loaded = 0
self.gallery.load_images() self.glry.load_images()
elif page == 5 and self.ref_not_loaded: elif page == 5 and self.ref_not_loaded:
self.ref_not_loaded = 0 self.ref_not_loaded = 0
self.display_references() self.display_references()

View File

@ -151,42 +151,32 @@ class EditSource:
if sref.getBase() == self.source: if sref.getBase() == self.source:
f_attr_list.append((name,v.getType())) f_attr_list.append((name,v.getType()))
add = self.refinfo.insert_defaults slist = self.top_window.get_widget('slist')
if len(p_event_list) > 0: if len(p_event_list) > 0:
add(_("Individual Events"))
add("\n-----------------------------\n")
for p in p_event_list: for p in p_event_list:
add("%s: %s\n" % (p[0],const.display_pevent(p[1]))) slist.append([_("Individual Events"),p[0],
const.display_pevent(p[1])])
if len(p_attr_list) > 0: if len(p_attr_list) > 0:
add(_("Individual Attributes"))
add("\n-----------------------------\n")
for p in p_attr_list: for p in p_attr_list:
add("%s: %s\n" % (p[0],const.display_pattr(p[1]))) slist.append([_("Individual Attributes"),p[0],
const.display_pattr(p[1])])
if len(p_name_list) > 0: if len(p_name_list) > 0:
add(_("Individual Names"))
add("\n-----------------------------\n")
for p in p_name_list: for p in p_name_list:
add("%s: %s\n" % p) slist.append([_("Individual Names"),p[0],p[1]])
if len(f_event_list) > 0: if len(f_event_list) > 0:
add(_("Family Events"))
add("\n-----------------------------\n")
for p in f_event_list: for p in f_event_list:
add("%s: %s\n" % (p[0],const.display_fevent(p[1]))) slist.append([_("Family Events"),p[0],
const.display_fevent(p[1])])
if len(f_attr_list) > 0: if len(f_attr_list) > 0:
add(_("Family Attributes"))
add("\n-----------------------------\n")
for p in f_event_list: for p in f_event_list:
add("%s: %s\n" % (p[0],const.display_fattr(p[1]))) slist.append([_("Family Attributes"),p[0],
const.display_fattr(p[1])])
if len(m_list) > 0: if len(m_list) > 0:
add(_("Media Objects"))
add("\n-----------------------------\n")
for p in m_list: for p in m_list:
add("%s\n" % m) slist.append([_("Media Objects"),p,''])
if len(m_list) > 0: if len(p_list) > 0:
add(_("Places"))
add("\n-----------------------------\n")
for p in p_list: for p in p_list:
add("%s\n" % m) slist.append([_("Places"),p,''])
def on_source_apply_clicked(self,obj): def on_source_apply_clicked(self,obj):

View File

@ -37,7 +37,6 @@ except:
# Standard Python modules # Standard Python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import types
import os import os
from string import find,join,strip,replace from string import find,join,strip,replace
import gtk import gtk
@ -329,7 +328,6 @@ class HasRelationship(Rule):
cnt = cnt + len(f.getChildList()) cnt = cnt + len(f.getChildList())
if self.list[1] and f.getRelationship() == self.list[1]: if self.list[1] and f.getRelationship() == self.list[1]:
rel_type = 1 rel_type = 1
rval = 0
# if number of relations specified # if number of relations specified
if self.list[0]: if self.list[0]:
@ -537,12 +535,6 @@ class GenericFilter:
self.logical_op = 'and' self.logical_op = 'and'
self.invert = 0 self.invert = 0
def set_logical_or(self,val):
self.logical_op = 'or'
def get_logical_or(self):
return self.logical_op == 'or'
def set_logical_op(self,val): def set_logical_op(self,val):
if val in const.logical_functions: if val in const.logical_functions:
self.logical_op = val self.logical_op = val

View File

@ -630,7 +630,8 @@ class ReportDialog:
FILL|EXPAND,FILL|EXPAND,pad,pad) FILL|EXPAND,FILL|EXPAND,pad,pad)
table.attach(GtkLabel(_("User Template")),0,1,1,2, table.attach(GtkLabel(_("User Template")),0,1,1,2,
FILL,FILL,pad,pad) FILL,FILL,pad,pad)
self.html_fileentry = GnomeFileEntry(_("HTML Template"),_("Choose File")) self.html_fileentry = GnomeFileEntry(_("HTML Template"),
_("Choose File"))
self.html_fileentry.set_sensitive(0) self.html_fileentry.set_sensitive(0)
table.attach(self.html_fileentry,1,2,1,2, table.attach(self.html_fileentry,1,2,1,2,
FILL|EXPAND,FILL|EXPAND,pad,pad) FILL|EXPAND,FILL|EXPAND,pad,pad)

View File

@ -42,8 +42,6 @@ from RelLib import *
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
_MENUVAL = "a"
class SourceSelector: class SourceSelector:
def __init__(self,srclist,parent,update=None): def __init__(self,srclist,parent,update=None):
@ -206,7 +204,8 @@ class SourceEditor:
page = self.get_widget("spage").get_text() page = self.get_widget("spage").get_text()
date = self.get_widget("sdate").get_text() date = self.get_widget("sdate").get_text()
text = self.get_widget("stext").get_chars(0,-1) text = self.get_widget("stext").get_chars(0,-1)
conf = self.get_widget("conf").get_menu().get_active().get_data(_MENUVAL) conf = self.get_widget("conf").get_menu().get_active().get_data('a')
comments = self.get_widget("scomment").get_chars(0,-1) comments = self.get_widget("scomment").get_chars(0,-1)
self.source_ref.setPage(page) self.source_ref.setPage(page)

View File

@ -591,6 +591,7 @@ class TextDoc:
self.lmargin = 2.54 self.lmargin = 2.54
self.rmargin = 2.54 self.rmargin = 2.54
self.title = "" self.title = ""
self.owner = ''
self.font = FontStyle() self.font = FontStyle()
self.style_list = styles.get_styles() self.style_list = styles.get_styles()
@ -599,6 +600,9 @@ class TextDoc:
self.name = "" self.name = ""
self.photo_list = [] self.photo_list = []
def set_owner(self,owner):
self.owner = owner
def add_photo(self,name,align,w_cm,h_cm): def add_photo(self,name,align,w_cm,h_cm):
"""adds a photo of the specified width (in centimeters)""" """adds a photo of the specified width (in centimeters)"""
pass pass

Binary file not shown.

View File

@ -3,4 +3,5 @@
<template title="Pink Marble" file="pink_marble.tpkg"/> <template title="Pink Marble" file="pink_marble.tpkg"/>
<template title="Sky Border" file="sky_border.tpkg"/> <template title="Sky Border" file="sky_border.tpkg"/>
<template title="Marble" file="marble.tpkg"/> <template title="Marble" file="marble.tpkg"/>
<template title="Sepia" file="sepia.tpkg"/>
</templates> </templates>

View File

@ -21,10 +21,13 @@
import os import os
import string import string
import re import re
import time
import gnome.ui import gnome.ui
import Plugins import Plugins
import ImgManip import ImgManip
import TarFile import TarFile
import const
from TextDoc import * from TextDoc import *
@ -73,7 +76,9 @@ class HtmlDoc(TextDoc):
def __init__(self,styles,type,template,orientation,source=None): def __init__(self,styles,type,template,orientation,source=None):
TextDoc.__init__(self,styles,PaperStyle("",0,0),template,None) TextDoc.__init__(self,styles,PaperStyle("",0,0),template,None)
self.year = time.localtime(time.time())[0]
if source == None: if source == None:
self.copyright = 'Copyright &copy; %d' % (self.year)
self.map = None self.map = None
self.f = None self.f = None
self.filename = None self.filename = None
@ -85,6 +90,8 @@ class HtmlDoc(TextDoc):
self.build_style_declaration() self.build_style_declaration()
self.image_dir = "images" self.image_dir = "images"
else: else:
self.owner = source.owner
self.copyright = 'Copyright &copy; %d %s' % (self.year,self.owner)
self.map = source.map self.map = source.map
self.f = None self.f = None
self.filename = source.filename self.filename = source.filename
@ -97,7 +104,11 @@ class HtmlDoc(TextDoc):
self.table_styles = source.table_styles; self.table_styles = source.table_styles;
self.cell_styles = source.cell_styles; self.cell_styles = source.cell_styles;
self.image_dir = source.image_dir self.image_dir = source.image_dir
def set_owner(self,owner):
HtmlDoc.set_owner(self,owner)
self.copyright = 'Copyright &copy; %d %s' % (self.year,self.owner)
def set_image_dir(self,dirname): def set_image_dir(self,dirname):
self.image_dir = dirname self.image_dir = dirname
@ -180,6 +191,10 @@ class HtmlDoc(TextDoc):
self.bottom = _bottom self.bottom = _bottom
self.top = _top self.top = _top
def process_line(self,line):
l = string.replace(line,'$VERSION',const.version)
return string.replace(l,'$COPYRIGHT',self.copyright)
def open(self,filename): def open(self,filename):
if filename[-5:] == ".html" or filename[-4:0] == ".htm": if filename[-5:] == ".html" or filename[-4:0] == ".htm":
self.filename = filename self.filename = filename
@ -200,6 +215,7 @@ class HtmlDoc(TextDoc):
self.file_header = '%s<TITLE>%s</TITLE>%s\n' % (m[0],m[1],m[2]) self.file_header = '%s<TITLE>%s</TITLE>%s\n' % (m[0],m[1],m[2])
else: else:
self.file_header = top self.file_header = top
self.file_header = self.process_line(self.file_header)
def build_style_declaration(self): def build_style_declaration(self):
text = ['<style type="text/css">\n<!--'] text = ['<style type="text/css">\n<!--']
@ -270,7 +286,7 @@ class HtmlDoc(TextDoc):
def close(self): def close(self):
for line in self.bottom: for line in self.bottom:
self.f.write(line) self.f.write(self.process_line(line))
self.f.close() self.f.close()
def write_support_files(self): def write_support_files(self):

View File

@ -6390,18 +6390,60 @@ Unknown
<widget> <widget>
<class>GtkScrolledWindow</class> <class>GtkScrolledWindow</class>
<name>scrolledwindow32</name> <name>scrolledwindow35</name>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget> <widget>
<class>GtkText</class> <class>GtkCList</class>
<name>refinfo</name> <name>slist</name>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<editable>False</editable> <columns>3</columns>
<text></text> <column_widths>136,241,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label307</name>
<label>Cateogry</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label308</name>
<label>Description</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label309</name>
<label>Item</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget> </widget>
</widget> </widget>

View File

@ -1293,7 +1293,7 @@
</signal> </signal>
<signal> <signal>
<name>button_press_event</name> <name>button_press_event</name>
<handler>on_photolist_button_press_event</handler> <handler>on_photolist_button_press</handler>
<object>placeEditor</object> <object>placeEditor</object>
<last_modification_time>Thu, 31 May 2001 14:40:04 GMT</last_modification_time> <last_modification_time>Thu, 31 May 2001 14:40:04 GMT</last_modification_time>
</signal> </signal>

View File

@ -841,6 +841,12 @@ class WebReportDialog(ReportDialog):
p = ParagraphStyle() p = ParagraphStyle()
p.set(font=font,bborder=1) p.set(font=font,bborder=1)
self.default_style.add_style("NotesTitle",p) self.default_style.add_style("NotesTitle",p)
font = FontStyle()
font.set(face=FONT_SANS_SERIF,size=10)
p = ParagraphStyle()
p.set(font=font,align=PARA_ALIGN_CENTER)
self.default_style.add_style("Copyright",p)
font = FontStyle() font = FontStyle()
font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1) font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1)

View File

@ -38,12 +38,13 @@ import Date
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
su = string.upper
def build_sort_name(n): def build_sort_name(n):
"""Builds a name from a RelLib.Name instance that is suitable for """Builds a name from a RelLib.Name instance that is suitable for
use as a sort key in a GtkCList. The name is converted to upper case use as a sort key in a GtkCList. The name is converted to upper case
to provide for case-insenstive sorting""" to provide for case-insenstive sorting"""
return "%-25s%-30s%s" % \ return "%-25s%-30s%s" % (su(n.Surname),su(n.FirstName),su(n.Suffix))
(string.upper(n.Surname),string.upper(n.FirstName),string.upper(n.Suffix))
def build_sort_date(n): def build_sort_date(n):
"""Builds a date from a Date.Date instance that is suitable for """Builds a date from a Date.Date instance that is suitable for
@ -64,18 +65,17 @@ def build_sort_date(n):
def by_last_name(first, second): def by_last_name(first, second):
"""Sort routine for comparing two last names. If last names are equal, """Sort routine for comparing two last names. If last names are equal,
uses the given name and suffix""" uses the given name and suffix"""
u = string.upper
name1 = first.PrimaryName name1 = first.PrimaryName
name2 = second.PrimaryName name2 = second.PrimaryName
fsn = u(name1.Surname) fsn = su(name1.Surname)
ssn = u(name2.Surname) ssn = su(name2.Surname)
if fsn == ssn : if fsn == ssn :
ffn = u(name1.FirstName) ffn = su(name1.FirstName)
sfn = u(name2.FirstName) sfn = su(name2.FirstName)
if ffn == sfn : if ffn == sfn :
return cmp(u(name1.Suffix), u(name2.Suffix)) return cmp(su(name1.Suffix), su(name2.Suffix))
else : else :
return cmp(ffn, sfn) return cmp(ffn, sfn)
else : else :