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 const
import GrampsCfg
import intl
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.insert(target,person)
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")
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.city = self.top_window.get_widget("city")
self.parish = self.top_window.get_widget("parish")
@ -121,24 +121,24 @@ class EditPlace:
self.note.set_word_wrap(1)
self.top_window.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object,
"on_source_clicked" : self.on_source_clicked,
"on_photolist_select_icon" : self.gallery.on_photo_select_icon,
"on_photolist_button_press_event" : self.gallery.on_button_press_event,
"on_switch_page" : self.on_switch_page,
"on_addphoto_clicked" : self.gallery.on_add_photo_clicked,
"on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked,
"on_edit_properties_clicked": self.gallery.popup_change_description,
"on_add_url_clicked" : self.on_add_url_clicked,
"on_delete_url_clicked" : self.on_delete_url_clicked,
"on_update_url_clicked" : self.on_update_url_clicked,
"on_add_loc_clicked" : self.on_add_loc_clicked,
"on_delete_loc_clicked" : self.on_delete_loc_clicked,
"on_update_loc_clicked" : self.on_update_loc_clicked,
"on_web_list_select_row" : self.on_web_list_select_row,
"on_web_go_clicked": self.on_web_go_clicked,
"on_loc_list_select_row" : self.on_loc_list_select_row,
"on_apply_clicked" : self.on_place_apply_clicked
"destroy_passed_object" : Utils.destroy_passed_object,
"on_source_clicked" : self.on_source_clicked,
"on_photolist_select_icon" : self.glry.on_photo_select_icon,
"on_photolist_button_press" : self.glry.on_button_press_event,
"on_switch_page" : self.on_switch_page,
"on_addphoto_clicked" : self.glry.on_add_photo_clicked,
"on_deletephoto_clicked" : self.glry.on_delete_photo_clicked,
"on_edit_properties_clicked": self.glry.popup_change_description,
"on_add_url_clicked" : self.on_add_url_clicked,
"on_delete_url_clicked" : self.on_delete_url_clicked,
"on_update_url_clicked" : self.on_update_url_clicked,
"on_add_loc_clicked" : self.on_add_loc_clicked,
"on_delete_loc_clicked" : self.on_delete_loc_clicked,
"on_update_loc_clicked" : self.on_update_loc_clicked,
"on_web_list_select_row" : self.on_web_list_select_row,
"on_web_go_clicked" : self.on_web_go_clicked,
"on_loc_list_select_row" : self.on_loc_list_select_row,
"on_apply_clicked" : self.on_place_apply_clicked
})
self.top = self.top_window.get_widget("placeEditor")
@ -254,7 +254,7 @@ class EditPlace:
def on_switch_page(self,obj,a,page):
if page == 3 and self.not_loaded:
self.not_loaded = 0
self.gallery.load_images()
self.glry.load_images()
elif page == 5 and self.ref_not_loaded:
self.ref_not_loaded = 0
self.display_references()

View File

@ -151,42 +151,32 @@ class EditSource:
if sref.getBase() == self.source:
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:
add(_("Individual Events"))
add("\n-----------------------------\n")
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:
add(_("Individual Attributes"))
add("\n-----------------------------\n")
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:
add(_("Individual Names"))
add("\n-----------------------------\n")
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:
add(_("Family Events"))
add("\n-----------------------------\n")
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:
add(_("Family Attributes"))
add("\n-----------------------------\n")
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:
add(_("Media Objects"))
add("\n-----------------------------\n")
for p in m_list:
add("%s\n" % m)
if len(m_list) > 0:
add(_("Places"))
add("\n-----------------------------\n")
slist.append([_("Media Objects"),p,''])
if len(p_list) > 0:
for p in p_list:
add("%s\n" % m)
slist.append([_("Places"),p,''])
def on_source_apply_clicked(self,obj):

View File

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

View File

@ -630,7 +630,8 @@ class ReportDialog:
FILL|EXPAND,FILL|EXPAND,pad,pad)
table.attach(GtkLabel(_("User Template")),0,1,1,2,
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)
table.attach(self.html_fileentry,1,2,1,2,
FILL|EXPAND,FILL|EXPAND,pad,pad)

View File

@ -42,8 +42,6 @@ from RelLib import *
#
#-------------------------------------------------------------------------
_MENUVAL = "a"
class SourceSelector:
def __init__(self,srclist,parent,update=None):
@ -206,7 +204,8 @@ class SourceEditor:
page = self.get_widget("spage").get_text()
date = self.get_widget("sdate").get_text()
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)
self.source_ref.setPage(page)

View File

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

Binary file not shown.

View File

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

View File

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

View File

@ -6390,18 +6390,60 @@ Unknown
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow32</name>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<name>scrolledwindow35</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget>
<class>GtkText</class>
<name>refinfo</name>
<class>GtkCList</class>
<name>slist</name>
<can_focus>True</can_focus>
<editable>False</editable>
<text></text>
<columns>3</columns>
<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>

View File

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

View File

@ -841,6 +841,12 @@ class WebReportDialog(ReportDialog):
p = ParagraphStyle()
p.set(font=font,bborder=1)
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.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):
"""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
to provide for case-insenstive sorting"""
return "%-25s%-30s%s" % \
(string.upper(n.Surname),string.upper(n.FirstName),string.upper(n.Suffix))
return "%-25s%-30s%s" % (su(n.Surname),su(n.FirstName),su(n.Suffix))
def build_sort_date(n):
"""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):
"""Sort routine for comparing two last names. If last names are equal,
uses the given name and suffix"""
u = string.upper
name1 = first.PrimaryName
name2 = second.PrimaryName
fsn = u(name1.Surname)
ssn = u(name2.Surname)
fsn = su(name1.Surname)
ssn = su(name2.Surname)
if fsn == ssn :
ffn = u(name1.FirstName)
sfn = u(name2.FirstName)
ffn = su(name1.FirstName)
sfn = su(name2.FirstName)
if ffn == sfn :
return cmp(u(name1.Suffix), u(name2.Suffix))
return cmp(su(name1.Suffix), su(name2.Suffix))
else :
return cmp(ffn, sfn)
else :