Code clean up, fixed the elusive AutoComp failure.
svn: r1046
This commit is contained in:
parent
b07b287d36
commit
5ad9d1149e
@ -104,8 +104,7 @@ class AddressEditor:
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,
|
||||
self.slist,src_changed)
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,self.slist)
|
||||
|
||||
date_stat = self.top.get_widget("date_stat")
|
||||
self.date_check = DateEdit(self.addr_start,date_stat)
|
||||
@ -162,7 +161,3 @@ class AddressEditor:
|
||||
self.check(self.addr.getNote,self.addr.setNote,note)
|
||||
self.check(self.addr.getPrivacy,self.addr.setPrivacy,priv)
|
||||
|
||||
def src_changed(parent):
|
||||
"""Sets the lists_changed flag of the parent object. Used as a callback
|
||||
to the source editor, so the source editor can indicate a change."""
|
||||
parent.lists_changed = 1
|
||||
|
@ -77,8 +77,7 @@ class AttributeEditor(Sources.SourceTab):
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,
|
||||
self.slist,src_changed)
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,self.slist)
|
||||
|
||||
# Typing CR selects OK button
|
||||
self.window.editable_enters(self.type_field);
|
||||
@ -140,7 +139,3 @@ class AttributeEditor(Sources.SourceTab):
|
||||
self.check(self.attrib.getNote,self.attrib.setNote,note)
|
||||
self.check(self.attrib.getPrivacy,self.attrib.setPrivacy,priv)
|
||||
|
||||
def src_changed(parent):
|
||||
"""Sets the lists_changed flag of the parent object. Used as a callback
|
||||
to the source editor, so the source editor can indicate a change."""
|
||||
parent.lists_changed = 1
|
||||
|
@ -59,9 +59,7 @@ class AutoCompBase:
|
||||
else:
|
||||
cnv = string.lower
|
||||
self.nlist = []
|
||||
for n in plist:
|
||||
self.nlist.append((cnv(n),n))
|
||||
# self.nlist = map((lambda n: (cnv(n),n)),plist)
|
||||
self.nlist = map((lambda n: (cnv(n),n)),plist)
|
||||
self.nlist.sort()
|
||||
self.nl = "xzsdkdjecsc"
|
||||
self.l = 0
|
||||
|
@ -280,21 +280,22 @@ class ChooseParents:
|
||||
self.family_update(None)
|
||||
|
||||
def add_new_parent(self,person):
|
||||
id = person.getId()
|
||||
self.type = const.save_frel(self.prel.get_text())
|
||||
rdata = [Utils.phonebook_name(person),Utils.birthday(person),
|
||||
sort.build_sort_name(person.getPrimaryName())]
|
||||
dinfo = self.db.getPersonDisplay(id)
|
||||
rdata = [dinfo[0],dinfo[3],dinfo[5],dinfo[6]]
|
||||
|
||||
if self.type == "Partners":
|
||||
self.parent_relation_changed(self.prel)
|
||||
elif person.getGender() == RelLib.Person.male:
|
||||
self.father_list.insert(0,rdata)
|
||||
self.father_list.set_row_data(0,person)
|
||||
self.father_list.set_row_data(0,id)
|
||||
self.father_list.select_row(0,0)
|
||||
self.father_list.sort()
|
||||
self.father_list.moveto(self.father_list.selection[0],0)
|
||||
else:
|
||||
self.mother_list.insert(0,rdata)
|
||||
self.mother_list.set_row_data(0,person)
|
||||
self.mother_list.set_row_data(0,id)
|
||||
self.mother_list.select_row(0,0)
|
||||
self.mother_list.moveto(0,0)
|
||||
self.mother_list.sort()
|
||||
|
@ -1167,7 +1167,7 @@ class EditPerson:
|
||||
|
||||
if surname != name.getSurname():
|
||||
name.setSurname(surname)
|
||||
self.db.addSurname(name)
|
||||
self.db.addSurname(surname)
|
||||
|
||||
if given != name.getFirstName():
|
||||
name.setFirstName(given)
|
||||
@ -1346,7 +1346,7 @@ class EditPerson:
|
||||
|
||||
def on_primary_name_source_clicked(self,obj):
|
||||
import Sources
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self,src_changed)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self)
|
||||
|
||||
def on_name_note_clicked(self,obj):
|
||||
import NoteEdit
|
||||
@ -1358,7 +1358,7 @@ class EditPerson:
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsBaptism(ord)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self,src_changed)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self)
|
||||
|
||||
def on_ldsbap_note_clicked(self,obj):
|
||||
import NoteEdit
|
||||
@ -1374,7 +1374,7 @@ class EditPerson:
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsEndowment(ord)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self,src_changed)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self)
|
||||
|
||||
def on_ldsendow_note_clicked(self,obj):
|
||||
import NoteEdit
|
||||
@ -1390,7 +1390,7 @@ class EditPerson:
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsSeal(ord)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self,src_changed)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self)
|
||||
|
||||
def on_ldsseal_note_clicked(self,obj):
|
||||
import NoteEdit
|
||||
@ -1533,14 +1533,6 @@ def disp_event(event):
|
||||
return [const.display_pevent(event.getName()),event.getDescription(),
|
||||
event.getQuoteDate(),event.getPlaceName(),attr]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# src_changed
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# birth_dates_in_order
|
||||
|
@ -298,7 +298,7 @@ class EditPlace:
|
||||
LocEdit.LocationEditor(self,None)
|
||||
|
||||
def on_source_clicked(self,obj):
|
||||
Sources.SourceSelector(self.srcreflist,self,src_changed)
|
||||
Sources.SourceSelector(self.srcreflist,self)
|
||||
|
||||
def on_web_list_select_row(self,obj,row,b,c):
|
||||
url = obj.get_row_data(row)
|
||||
@ -380,14 +380,6 @@ def disp_url(url):
|
||||
def disp_loc(loc):
|
||||
return [loc.get_city(),loc.get_county(),loc.get_state(),loc.get_country()]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# src_changed
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# DeletePlaceQuery
|
||||
|
@ -96,8 +96,7 @@ class EventEditor(Sources.SourceTab):
|
||||
self.event_menu.set_sensitive(0)
|
||||
self.date_field.grab_focus()
|
||||
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,
|
||||
self.slist,src_changed)
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,self.slist)
|
||||
|
||||
# Typing CR selects OK button
|
||||
self.window.editable_enters(self.name_field);
|
||||
@ -224,6 +223,4 @@ class EventEditor(Sources.SourceTab):
|
||||
self.event.setPrivacy(priv)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
||||
|
||||
|
@ -211,7 +211,7 @@ class Marriage:
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.family.setLdsSeal(ord)
|
||||
Sources.SourceSelector(ord.getSourceRefList(),self,src_changed)
|
||||
Sources.SourceSelector(ord.getSourceRefList(),self)
|
||||
|
||||
def lds_note_clicked(self,obj):
|
||||
import NoteEdit
|
||||
@ -544,5 +544,3 @@ def disp_event(event):
|
||||
return [const.display_fevent(event.getName()), event.getQuoteDate(),
|
||||
event.getPlaceName(), Utils.get_detail_flags(event)]
|
||||
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
||||
|
@ -84,8 +84,7 @@ class NameEditor:
|
||||
self.window.editable_enters(self.title_field)
|
||||
self.window.editable_enters(self.type_field.entry)
|
||||
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,
|
||||
self.slist,src_changed)
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top,self.slist)
|
||||
|
||||
if name != None:
|
||||
self.given_field.set_text(name.getFirstName())
|
||||
@ -162,6 +161,4 @@ class NameEditor:
|
||||
self.name.setPrivacy(priv)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
||||
|
||||
|
@ -20,21 +20,47 @@
|
||||
|
||||
"Report Generation Framework"
|
||||
|
||||
import RelLib
|
||||
import const
|
||||
__author__ = "David R. Hampton, Donald N. Allingham"
|
||||
__version__ = "$Revision$"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
import gnome.ui
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import Utils
|
||||
import Plugins
|
||||
import GenericFilter
|
||||
|
||||
import TextDoc
|
||||
import StyleEditor
|
||||
import GrampsCfg
|
||||
import PaperMenu
|
||||
import intl
|
||||
import latin_utf8
|
||||
|
||||
u2l = latin_utf8.utf8_to_latin
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Import XML libraries
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
try:
|
||||
@ -42,16 +68,11 @@ try:
|
||||
except:
|
||||
from _xmlplus.sax import make_parser,handler,SAXParseException
|
||||
|
||||
from TextDoc import *
|
||||
from StyleEditor import *
|
||||
|
||||
import GrampsCfg
|
||||
import PaperMenu
|
||||
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
import libglade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
_default_template = _("Default Template")
|
||||
_user_template = _("User Defined Template")
|
||||
|
||||
@ -59,14 +80,12 @@ _template_map = {
|
||||
_user_template : None
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# The Report base class. This is a base class for generating
|
||||
# customized reports. It cannot be used as is, but it can be easily
|
||||
# sub-classed to create a functional report generator.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class Report:
|
||||
"""
|
||||
The Report base class. This is a base class for generating
|
||||
customized reports. It cannot be used as is, but it can be easily
|
||||
sub-classed to create a functional report generator.
|
||||
"""
|
||||
|
||||
# Ordinal generation names. Used by multiple reports.
|
||||
gen = {
|
||||
@ -116,12 +135,12 @@ class Report:
|
||||
|
||||
# Customize the dialog for this report
|
||||
(title, header) = self.get_progressbar_data()
|
||||
self.ptop = GnomeDialog()
|
||||
self.ptop = gnome.ui.GnomeDialog()
|
||||
self.ptop.set_title(title)
|
||||
self.ptop.vbox.add(GtkLabel(header))
|
||||
self.ptop.vbox.add(GtkHSeparator())
|
||||
self.ptop.vbox.add(gtk.GtkLabel(header))
|
||||
self.ptop.vbox.add(gtk.GtkHSeparator())
|
||||
self.ptop.vbox.set_spacing(10)
|
||||
self.pbar = GtkProgressBar()
|
||||
self.pbar = gtk.GtkProgressBar()
|
||||
self.pbar.set_format_string(_("%v of %u (%P%%)"))
|
||||
self.pbar.configure(0.0,0.0,total)
|
||||
self.pbar.set_show_text(1)
|
||||
@ -132,8 +151,6 @@ class Report:
|
||||
self.ptop.vbox.add(self.pbar)
|
||||
self.ptop.show_all()
|
||||
|
||||
# Setup the progress bar limits
|
||||
|
||||
def progress_bar_step(self):
|
||||
"""Click the progress bar over to the next value. Be paranoid
|
||||
and insure that it doesn't go over 100%."""
|
||||
@ -147,15 +164,13 @@ class Report:
|
||||
Utils.destroy_passed_object(self.ptop)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# The ReportDialog base class. This is a base class for generating
|
||||
# customized dialogs to solicit options for a report. It cannot be
|
||||
# used as is, but it can be easily sub-classed to create a functional
|
||||
# dialog.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class ReportDialog:
|
||||
"""
|
||||
The ReportDialog base class. This is a base class for generating
|
||||
customized dialogs to solicit options for a report. It cannot be
|
||||
used as is, but it can be easily sub-classed to create a functional
|
||||
dialog.
|
||||
"""
|
||||
|
||||
frame_pad = 5
|
||||
border_pad = 2
|
||||
@ -179,7 +194,8 @@ class ReportDialog:
|
||||
self.frame_names = []
|
||||
self.frames = {}
|
||||
|
||||
self.window = GnomeDialog('GRAMPS',STOCK_BUTTON_OK,STOCK_BUTTON_CANCEL)
|
||||
self.window = gnome.ui.GnomeDialog('GRAMPS',gnome.ui.STOCK_BUTTON_OK,
|
||||
gnome.ui.STOCK_BUTTON_CANCEL)
|
||||
self.window.set_default(0)
|
||||
self.window.button_connect(0,self.on_ok_clicked)
|
||||
self.window.button_connect(1,self.on_cancel)
|
||||
@ -364,15 +380,15 @@ class ReportDialog:
|
||||
def make_default_style(self):
|
||||
"""Create the default style to be used by the associated report. This
|
||||
routine is a default implementation and should be overridden."""
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=16,bold=1)
|
||||
para = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(face=TextDoc.FONT_SANS_SERIF,size=16,bold=1)
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(1)
|
||||
para.set(pad=0.5)
|
||||
self.default_style.add_style("Title",para)
|
||||
|
||||
def build_style_menu(self,dummy):
|
||||
def build_style_menu(self):
|
||||
"""Build a menu of style sets that are available for use in
|
||||
this report. This menu will always have a default style
|
||||
available, and will have any other style set name that the
|
||||
@ -394,11 +410,11 @@ class ReportDialog:
|
||||
this report. This menu will be generated based upon the type
|
||||
of document (text, draw, graph, etc. - a subclass), whether or
|
||||
not the document requires table support, etc."""
|
||||
assert 0, "The make_doc_menu function must be overridden."
|
||||
pass
|
||||
|
||||
def make_document(self):
|
||||
"""Create a document of the type selected by the user."""
|
||||
assert 0, "The make_document function must be overridden."
|
||||
pass
|
||||
|
||||
def doc_type_changed(self, obj):
|
||||
"""This routine is called when the user selects a new file
|
||||
@ -444,10 +460,10 @@ class ReportDialog:
|
||||
of the currently selected person."""
|
||||
|
||||
title = self.get_header(self.name)
|
||||
label = GtkLabel(title)
|
||||
label = gtk.GtkLabel(title)
|
||||
label.set_usize(450,10)
|
||||
self.window.vbox.pack_start(label,TRUE,TRUE,ReportDialog.border_pad)
|
||||
self.window.vbox.add(GtkHSeparator())
|
||||
self.window.vbox.pack_start(label,gtk.TRUE,gtk.TRUE,ReportDialog.border_pad)
|
||||
self.window.vbox.add(gtk.GtkHSeparator())
|
||||
|
||||
def setup_target_frame(self):
|
||||
"""Set up the target frame of the dialog. This function
|
||||
@ -457,21 +473,21 @@ class ReportDialog:
|
||||
directory should be used."""
|
||||
|
||||
# Save Frame
|
||||
frame = GtkFrame(_("Save As"))
|
||||
frame = gtk.GtkFrame(_("Save As"))
|
||||
frame.set_border_width(ReportDialog.frame_pad)
|
||||
hid = self.get_stylesheet_savefile()
|
||||
if hid[-4:]==".xml":
|
||||
hid = hid[0:-4]
|
||||
self.target_fileentry = GnomeFileEntry(hid,_("Save As"))
|
||||
self.target_fileentry = gnome.ui.GnomeFileEntry(hid,_("Save As"))
|
||||
|
||||
hbox = GtkHBox()
|
||||
hbox = gtk.GtkHBox()
|
||||
hbox.set_border_width(ReportDialog.border_pad)
|
||||
if (self.get_target_is_directory()):
|
||||
import _gnomeui
|
||||
_gnomeui.gnome_file_entry_set_directory(self.target_fileentry._o, 1)
|
||||
label = GtkLabel(_("Directory"))
|
||||
label = gtk.GtkLabel(_("Directory"))
|
||||
else:
|
||||
label = GtkLabel(_("Filename"))
|
||||
label = gtk.GtkLabel(_("Filename"))
|
||||
hbox.pack_start(label,0,0,5)
|
||||
|
||||
hbox.add(self.target_fileentry)
|
||||
@ -502,9 +518,9 @@ class ReportDialog:
|
||||
relies on the make_doc_menu() function to do all the hard
|
||||
work."""
|
||||
|
||||
self.format_menu = GtkOptionMenu()
|
||||
self.format_menu = gtk.GtkOptionMenu()
|
||||
self.make_doc_menu()
|
||||
frame = GtkFrame(_("Output Format"))
|
||||
frame = gtk.GtkFrame(_("Output Format"))
|
||||
frame.add(self.format_menu)
|
||||
frame.set_border_width(ReportDialog.frame_pad)
|
||||
self.window.vbox.add(frame)
|
||||
@ -517,12 +533,12 @@ class ReportDialog:
|
||||
choose from."""
|
||||
|
||||
# Styles Frame
|
||||
self.style_frame = GtkFrame(_("Styles"))
|
||||
hbox = GtkHBox()
|
||||
self.style_frame = gtk.GtkFrame(_("Styles"))
|
||||
hbox = gtk.GtkHBox()
|
||||
hbox.set_border_width(ReportDialog.border_pad)
|
||||
self.style_menu = GtkOptionMenu()
|
||||
hbox.pack_start(self.style_menu,TRUE,TRUE,2)
|
||||
style_button = GtkButton(_("Style Editor"))
|
||||
self.style_menu = gtk.GtkOptionMenu()
|
||||
hbox.pack_start(self.style_menu,gtk.TRUE,gtk.TRUE,2)
|
||||
style_button = gtk.GtkButton(_("Style Editor"))
|
||||
style_button.connect('clicked',self.on_style_edit_clicked)
|
||||
hbox.pack_end(style_button,0,0,2)
|
||||
self.style_frame.add(hbox)
|
||||
@ -530,30 +546,30 @@ class ReportDialog:
|
||||
self.window.vbox.add(self.style_frame)
|
||||
|
||||
# Build the default style set for this report.
|
||||
self.default_style = StyleSheet()
|
||||
self.default_style = TextDoc.StyleSheet()
|
||||
self.make_default_style()
|
||||
|
||||
# Build the initial list of available styles sets. This
|
||||
# includes the default style set and any style sets saved from
|
||||
# previous invocations of gramps.
|
||||
self.style_sheet_list = StyleSheetList(self.get_stylesheet_savefile(),
|
||||
self.default_style)
|
||||
self.style_sheet_list = TextDoc.StyleSheetList(self.get_stylesheet_savefile(),
|
||||
self.default_style)
|
||||
|
||||
# Now build the actual menu.
|
||||
self.build_style_menu(None)
|
||||
self.build_style_menu()
|
||||
|
||||
def setup_output_notebook(self):
|
||||
"""Set up the output notebook of the dialog. This sole
|
||||
purpose of this function is to grab a pointer for later use in
|
||||
the callback from when the file format is changed."""
|
||||
|
||||
self.output_notebook = GtkNotebook()
|
||||
self.paper_frame = GtkFrame(_("Paper Options"))
|
||||
self.output_notebook = gtk.GtkNotebook()
|
||||
self.paper_frame = gtk.GtkFrame(_("Paper Options"))
|
||||
self.paper_frame.set_border_width(ReportDialog.frame_pad)
|
||||
self.output_notebook.append_page(self.paper_frame,GtkLabel(_("Paper Options")))
|
||||
self.html_frame = GtkFrame(_("HTML Options"))
|
||||
self.output_notebook.append_page(self.paper_frame,gtk.GtkLabel(_("Paper Options")))
|
||||
self.html_frame = gtk.GtkFrame(_("HTML Options"))
|
||||
self.html_frame.set_border_width(ReportDialog.frame_pad)
|
||||
self.output_notebook.append_page(self.html_frame,GtkLabel(_("HTML Options")))
|
||||
self.output_notebook.append_page(self.html_frame,gtk.GtkLabel(_("HTML Options")))
|
||||
self.output_notebook.set_show_tabs(0)
|
||||
self.output_notebook.set_show_border(0)
|
||||
self.output_notebook.set_page(self.notebook_page)
|
||||
@ -566,28 +582,28 @@ class ReportDialog:
|
||||
its strings should be."""
|
||||
|
||||
(pagecount_map, start_text) = self.get_print_pagecount_map()
|
||||
table = GtkTable(2,4)
|
||||
table = gtk.GtkTable(2,4)
|
||||
self.paper_frame.add(table)
|
||||
self.papersize_menu = GtkOptionMenu()
|
||||
self.orientation_menu = GtkOptionMenu()
|
||||
l = GtkLabel(_("Size"))
|
||||
self.papersize_menu = gtk.GtkOptionMenu()
|
||||
self.orientation_menu = gtk.GtkOptionMenu()
|
||||
l = gtk.GtkLabel(_("Size"))
|
||||
pad = ReportDialog.border_pad
|
||||
l.set_alignment(1.0,0.5)
|
||||
table.attach(l,0,1,0,1,FILL,FILL,pad,pad)
|
||||
table.attach(l,0,1,0,1,gtk.FILL,gtk.FILL,pad,pad)
|
||||
table.attach(self.papersize_menu,1,2,0,1,xpadding=pad,ypadding=pad)
|
||||
l = GtkLabel(_("Orientation"))
|
||||
l = gtk.GtkLabel(_("Orientation"))
|
||||
l.set_alignment(1.0,0.5)
|
||||
table.attach(l,2,3,0,1,FILL,FILL,pad,pad)
|
||||
table.attach(l,2,3,0,1,gtk.FILL,gtk.FILL,pad,pad)
|
||||
table.attach(self.orientation_menu,3,4,0,1,xpadding=pad,ypadding=pad)
|
||||
PaperMenu.make_paper_menu(self.papersize_menu)
|
||||
PaperMenu.make_orientation_menu(self.orientation_menu)
|
||||
|
||||
# The optional pagecount stuff.
|
||||
if pagecount_map:
|
||||
self.pagecount_menu = GtkOptionMenu()
|
||||
self.pagecount_menu = gtk.GtkOptionMenu()
|
||||
myMenu = Utils.build_string_optmenu(pagecount_map, start_text)
|
||||
self.pagecount_menu.set_menu(myMenu)
|
||||
table.attach(GtkLabel(_("Page Count")),0,1,1,2,FILL,FILL,pad,pad)
|
||||
table.attach(gtk.GtkLabel(_("Page Count")),0,1,1,2,gtk.FILL,gtk.FILL,pad,pad)
|
||||
table.attach(self.pagecount_menu,1,2,1,2,xpadding=pad,ypadding=pad)
|
||||
|
||||
def html_file_enable(self,obj):
|
||||
@ -605,13 +621,13 @@ class ReportDialog:
|
||||
this function is to grab a pointer for later use in the parse
|
||||
html frame function."""
|
||||
|
||||
table = GtkTable(2,2)
|
||||
table = gtk.GtkTable(2,2)
|
||||
self.html_frame.add(table)
|
||||
l = GtkLabel(_("Template"))
|
||||
l = gtk.GtkLabel(_("Template"))
|
||||
pad = ReportDialog.border_pad
|
||||
l.set_alignment(1.0,0.5)
|
||||
table.attach(l,0,1,0,1,FILL,FILL,pad,pad)
|
||||
self.template_combo = GtkCombo()
|
||||
table.attach(l,0,1,0,1,gtk.FILL,gtk.FILL,pad,pad)
|
||||
self.template_combo = gtk.GtkCombo()
|
||||
|
||||
template_list = [ _default_template ]
|
||||
tlist = _template_map.keys()
|
||||
@ -627,14 +643,14 @@ class ReportDialog:
|
||||
self.template_combo.entry.connect('changed',self.html_file_enable)
|
||||
|
||||
table.attach(self.template_combo,1,2,0,1,
|
||||
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"),
|
||||
gtk.FILL|gtk.EXPAND,gtk.FILL|gtk.EXPAND,pad,pad)
|
||||
table.attach(gtk.GtkLabel(_("User Template")),0,1,1,2,
|
||||
gtk.FILL,gtk.FILL,pad,pad)
|
||||
self.html_fileentry = gnome.ui.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)
|
||||
gtk.FILL|gtk.EXPAND,gtk.FILL|gtk.EXPAND,pad,pad)
|
||||
|
||||
def setup_report_options_frame(self):
|
||||
"""Set up the report options frame of the dialog. This
|
||||
@ -667,25 +683,25 @@ class ReportDialog:
|
||||
if max_rows == 0:
|
||||
return
|
||||
|
||||
table = GtkTable(2,max_rows)
|
||||
table = gtk.GtkTable(2,max_rows)
|
||||
|
||||
if len(self.frame_names) == 0:
|
||||
frame = GtkFrame(_("Report Options"))
|
||||
frame = gtk.GtkFrame(_("Report Options"))
|
||||
frame.set_border_width(ReportDialog.frame_pad)
|
||||
self.window.vbox.add(frame)
|
||||
frame.add(table)
|
||||
else:
|
||||
self.notebook = GtkNotebook()
|
||||
self.notebook = gtk.GtkNotebook()
|
||||
self.window.vbox.pack_start(self.notebook,padding=ReportDialog.frame_pad)
|
||||
self.notebook.append_page(table,GtkLabel(_("Report Options")))
|
||||
self.notebook.append_page(table,gtk.GtkLabel(_("Report Options")))
|
||||
self.notebook.set_border_width(ReportDialog.frame_pad)
|
||||
|
||||
pad = ReportDialog.border_pad
|
||||
if len(local_filters):
|
||||
self.filter_combo = GtkOptionMenu()
|
||||
l = GtkLabel(_("Filter"))
|
||||
self.filter_combo = gtk.GtkOptionMenu()
|
||||
l = gtk.GtkLabel(_("Filter"))
|
||||
l.set_alignment(1.0,0.5)
|
||||
table.attach(l,0,1,row,row+1,xoptions=FILL,yoptions=0,
|
||||
table.attach(l,0,1,row,row+1,xoptions=gtk.FILL,yoptions=0,
|
||||
xpadding=pad,ypadding=pad)
|
||||
table.attach(self.filter_combo,1,2,row,row+1,yoptions=0,
|
||||
xpadding=pad,ypadding=pad)
|
||||
@ -698,14 +714,14 @@ class ReportDialog:
|
||||
|
||||
# Set up the generations spin and page break checkbox
|
||||
if use_gen:
|
||||
self.generations_spinbox = GtkSpinButton(digits=0)
|
||||
self.generations_spinbox = gtk.GtkSpinButton(digits=0)
|
||||
self.generations_spinbox.set_numeric(1)
|
||||
adjustment = GtkAdjustment(use_gen,1,31,1,0)
|
||||
adjustment = gtk.GtkAdjustment(use_gen,1,31,1,0)
|
||||
self.generations_spinbox.set_adjustment(adjustment)
|
||||
adjustment.value_changed()
|
||||
l = GtkLabel(_("Generations"))
|
||||
l = gtk.GtkLabel(_("Generations"))
|
||||
l.set_alignment(1.0,0.5)
|
||||
table.attach(l,0,1,row,row+1,xoptions=FILL,yoptions=0,
|
||||
table.attach(l,0,1,row,row+1,xoptions=gtk.FILL,yoptions=0,
|
||||
xpadding=pad,ypadding=pad)
|
||||
table.attach(self.generations_spinbox,1,2,row,row+1,
|
||||
yoptions=0, xpadding=pad,ypadding=pad)
|
||||
@ -713,35 +729,35 @@ class ReportDialog:
|
||||
|
||||
if use_break:
|
||||
msg = _("Page break between generations")
|
||||
self.pagebreak_checkbox = GtkCheckButton(msg)
|
||||
self.pagebreak_checkbox = gtk.GtkCheckButton(msg)
|
||||
table.attach(self.pagebreak_checkbox,1,2,row,row+1,
|
||||
xpadding=pad,ypadding=pad)
|
||||
row = row + 1
|
||||
|
||||
# Now the "extra" option menu
|
||||
if extra_map:
|
||||
self.extra_menu_label = GtkLabel(em_label)
|
||||
self.extra_menu_label = gtk.GtkLabel(em_label)
|
||||
self.extra_menu_label.set_alignment(1.0,0.5)
|
||||
self.extra_menu = GtkOptionMenu()
|
||||
self.extra_menu = gtk.GtkOptionMenu()
|
||||
myMenu = Utils.build_string_optmenu(extra_map, preset)
|
||||
self.extra_menu.set_menu(myMenu)
|
||||
self.extra_menu.set_sensitive(len(extra_map) > 1)
|
||||
self.add_tooltip(self.extra_menu,em_tip)
|
||||
table.attach(self.extra_menu_label,0,1,row,row+1,
|
||||
xoptions=FILL,yoptions=0,xpadding=pad,ypadding=pad)
|
||||
xoptions=gtk.FILL,yoptions=0,xpadding=pad,ypadding=pad)
|
||||
table.attach(self.extra_menu,1,2,row,row+1,yoptions=0,
|
||||
xpadding=pad,ypadding=pad)
|
||||
row = row + 1
|
||||
|
||||
# Now the "extra" text box
|
||||
if string:
|
||||
self.extra_textbox_label = GtkLabel(et_label)
|
||||
self.extra_textbox_label = gtk.GtkLabel(et_label)
|
||||
self.extra_textbox_label.set_alignment(1.0,0)
|
||||
self.extra_textbox = GtkText()
|
||||
self.extra_textbox = gtk.GtkText()
|
||||
self.extra_textbox.insert_defaults(string)
|
||||
self.extra_textbox.set_editable(1)
|
||||
self.add_tooltip(self.extra_textbox,et_tip)
|
||||
table.attach(self.extra_textbox_label,0,1,row,row+1,xoptions=FILL,
|
||||
table.attach(self.extra_textbox_label,0,1,row,row+1,xoptions=gtk.FILL,
|
||||
yoptions=0,xpadding=pad,ypadding=pad)
|
||||
table.attach(self.extra_textbox,1,2,row,row+1,
|
||||
yoptions=0,xpadding=pad,ypadding=pad)
|
||||
@ -752,7 +768,7 @@ class ReportDialog:
|
||||
if text == None:
|
||||
table.attach(widget,0,2,row,row+1,yoptions=0,xpadding=pad,ypadding=pad)
|
||||
else:
|
||||
text_widget = GtkLabel(text)
|
||||
text_widget = gtk.GtkLabel(text)
|
||||
text_widget.set_alignment(1.0,0)
|
||||
table.attach(text_widget,0,1,row,row+1,yoptions=0,xpadding=pad,ypadding=pad)
|
||||
table.attach(widget,1,2,row,row+1,yoptions=0,xpadding=pad,ypadding=pad)
|
||||
@ -763,8 +779,8 @@ class ReportDialog:
|
||||
pad = ReportDialog.border_pad
|
||||
for key in self.frame_names:
|
||||
list = self.frames[key]
|
||||
table = GtkTable(2,len(list))
|
||||
self.notebook.append_page(table,GtkLabel(_(key)))
|
||||
table = gtk.GtkTable(2,len(list))
|
||||
self.notebook.append_page(table,gtk.GtkLabel(_(key)))
|
||||
|
||||
row = 0
|
||||
for (text,widget) in list:
|
||||
@ -772,9 +788,9 @@ class ReportDialog:
|
||||
table.attach(widget,0,2,row,row+1,
|
||||
xpadding=pad,ypadding=pad)
|
||||
else:
|
||||
text_widget = GtkLabel(text)
|
||||
text_widget = gtk.GtkLabel(text)
|
||||
text_widget.set_alignment(1.0,0)
|
||||
table.attach(text_widget,0,1,row,row+1,FILL,FILL,pad,pad)
|
||||
table.attach(text_widget,0,1,row,row+1,gtk.FILL,gtk.FILL,pad,pad)
|
||||
table.attach(widget,1,2,row,row+1,yoptions=0,
|
||||
xpadding=pad,ypadding=pad)
|
||||
row = row + 1
|
||||
@ -795,7 +811,7 @@ class ReportDialog:
|
||||
return None
|
||||
|
||||
if not self.get_target_is_directory() and os.path.isdir(self.target_path):
|
||||
GnomeErrorDialog(_("The filename that you gave is a directory.\n"
|
||||
gnome.ui.GnomeErrorDialog(_("The filename that you gave is a directory.\n"
|
||||
"You need to provide a valid filename."))
|
||||
return None
|
||||
|
||||
@ -893,7 +909,7 @@ class ReportDialog:
|
||||
style sheet editor object and let them play. When they are
|
||||
done, the previous routine will be called to update the dialog
|
||||
menu for selecting a style."""
|
||||
StyleListDisplay(self.style_sheet_list,self.build_style_menu,None)
|
||||
StyleEditor.StyleListDisplay(self.style_sheet_list,self.build_style_menu)
|
||||
|
||||
def on_cancel(self, obj):
|
||||
self.window.destroy()
|
||||
@ -922,7 +938,7 @@ class ReportDialog:
|
||||
try:
|
||||
self.make_report()
|
||||
except (IOError,OSError),msg:
|
||||
GnomeErrorDialog(str(msg))
|
||||
gnome.ui.GnomeErrorDialog(str(msg))
|
||||
|
||||
# Clean up the dialog object
|
||||
self.window.destroy()
|
||||
@ -939,7 +955,7 @@ class ReportDialog:
|
||||
routine should either write the data directly to the file, or
|
||||
better yet, should create a subclass of a Report that will
|
||||
write the data to a file."""
|
||||
assert 0, "The make_report function must be overridden."
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -947,18 +963,16 @@ class ReportDialog:
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def add_tooltip(self,widget,string):
|
||||
"""Adds a tooltip to the specified widget"""
|
||||
if not widget or not string:
|
||||
return
|
||||
tip = gtk.GtkTooltips()
|
||||
tip.set_tip(widget,string)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# TextReportDialog - A class of ReportDialog customized for text based
|
||||
# reports.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
class TextReportDialog(ReportDialog):
|
||||
"""A class of ReportDialog customized for text based reports."""
|
||||
|
||||
def __init__(self,database,person):
|
||||
"""Initialize a dialog to request that the user select options
|
||||
for a basic text report. See the ReportDialog class for more
|
||||
@ -1007,13 +1021,8 @@ class TextReportDialog(ReportDialog):
|
||||
self.doc.write_text(title)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# DrawReportDialog - A class of ReportDialog customized for drawing based
|
||||
# reports.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DrawReportDialog(ReportDialog):
|
||||
"""A class of ReportDialog customized for drawing based reports."""
|
||||
def __init__(self,database,person):
|
||||
"""Initialize a dialog to request that the user select options
|
||||
for a basic drawing report. See the ReportDialog class for
|
||||
@ -1034,26 +1043,36 @@ class DrawReportDialog(ReportDialog):
|
||||
"""Create a document of the type requested by the user."""
|
||||
self.doc = self.format(self.selected_style,self.paper,self.orien)
|
||||
|
||||
import latin_utf8
|
||||
|
||||
u2l = latin_utf8.utf8_to_latin
|
||||
|
||||
class TemplateParser(handler.ContentHandler):
|
||||
"""
|
||||
Interface to the document template file
|
||||
"""
|
||||
def __init__(self,data,fpath):
|
||||
"""
|
||||
Creates a template parser. The parser loads map of tempate names
|
||||
to the file containing the tempate.
|
||||
|
||||
data - dictionary that holds the name to path mappings
|
||||
fpath - filename of the XML file
|
||||
"""
|
||||
handler.ContentHandler.__init__(self)
|
||||
self.data = data
|
||||
self.path = fpath
|
||||
|
||||
def setDocumentLocator(self,locator):
|
||||
"""Sets the XML document locator"""
|
||||
self.locator = locator
|
||||
|
||||
def startElement(self,tag,attrs):
|
||||
"""
|
||||
Loads the dictionary when an XML tag of 'template' is found. The format
|
||||
XML tag is <template title=\"name\" file=\"path\">
|
||||
"""
|
||||
|
||||
if tag == "template":
|
||||
self.data[u2l(attrs['title'])] = u2l(attrs['file'])
|
||||
|
||||
def characters(self, data):
|
||||
pass
|
||||
|
||||
try:
|
||||
parser = make_parser()
|
||||
path = const.template_dir
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 Donald N. Allingham
|
||||
# Copyright (C) 2002 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
|
||||
@ -93,23 +93,22 @@ class Sorter:
|
||||
self.clist.sort()
|
||||
if _enable:
|
||||
try:
|
||||
loddbg = oddbg
|
||||
loddfg = oddfg
|
||||
levenbg = evenbg
|
||||
levenfg = evenfg
|
||||
|
||||
cmap = self.clist.get_colormap()
|
||||
toddbg = cmap.alloc(loddbg[0],loddbg[1],loddbg[2])
|
||||
toddfg = cmap.alloc(loddfg[0],loddfg[1],loddfg[2])
|
||||
tevenbg = cmap.alloc(levenbg[0],levenbg[1],levenbg[2])
|
||||
tevenfg = cmap.alloc(levenfg[0],levenfg[1],levenfg[2])
|
||||
loddbg = cmap.alloc(to_signed(oddbg[0]),to_signed(oddbg[1]),
|
||||
to_signed(oddbg[2]))
|
||||
loddfg = cmap.alloc(to_signed(oddfg[0]),to_signed(oddfg[1]),
|
||||
to_signed(oddfg[2]))
|
||||
levenbg = cmap.alloc(to_signed(evenbg[0]),to_signed(evenbg[1]),
|
||||
to_signed(evenbg[2]))
|
||||
levenfg = cmap.alloc(to_signed(evenfg[0]),to_signed(evenfg[1]),
|
||||
to_signed(evenfg[2]))
|
||||
rows = self.clist.rows
|
||||
for i in range(0,rows,2):
|
||||
self.clist.set_background(i,toddbg)
|
||||
self.clist.set_foreground(i,toddfg)
|
||||
self.clist.set_background(i,loddbg)
|
||||
self.clist.set_foreground(i,loddfg)
|
||||
if i != rows:
|
||||
self.clist.set_background(i+1,tevenbg)
|
||||
self.clist.set_foreground(i+1,tevenfg)
|
||||
self.clist.set_background(i+1,levenbg)
|
||||
self.clist.set_foreground(i+1,levenfg)
|
||||
except OverflowError:
|
||||
pass
|
||||
self.clist.thaw()
|
||||
|
@ -110,11 +110,10 @@ class SourceSelector:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SourceTab:
|
||||
def __init__(self,srclist,parent,top,clist,update=None):
|
||||
def __init__(self,srclist,parent,top,clist):
|
||||
self.db = parent.db
|
||||
self.parent = parent
|
||||
self.list = srclist
|
||||
self.update=update
|
||||
self.top = top
|
||||
self.slist = clist
|
||||
self.top.signal_autoconnect({
|
||||
|
@ -18,48 +18,64 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
"""
|
||||
Paragraph/Font style editor
|
||||
"""
|
||||
|
||||
__author__ = "Donald N. Allingham"
|
||||
__version__ = "$Revision$"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import libglade
|
||||
import gtk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import Utils
|
||||
import const
|
||||
import TextDoc
|
||||
|
||||
from TextDoc import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class StyleListDisplay:
|
||||
"""
|
||||
Shows the available paragraph/font styles. Allows the user to select,
|
||||
add, edit, and delete styles from a StyleSheet.
|
||||
"""
|
||||
|
||||
def __init__(self,stylesheetlist,callback,object):
|
||||
self.object = object
|
||||
def __init__(self,stylesheetlist,callback):
|
||||
"""
|
||||
Creates a StyleListDisplay object that displays the styles in the
|
||||
StyleSheet.
|
||||
|
||||
stylesheetlist - styles that can be editied
|
||||
callback - task called with an object has been added.
|
||||
"""
|
||||
self.callback = callback
|
||||
|
||||
self.sheetlist = stylesheetlist
|
||||
self.top = libglade.GladeXML(const.stylesFile,"styles")
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_list_select_row" : on_list_select_row,
|
||||
"on_ok_clicked" : on_ok_clicked,
|
||||
"on_add_clicked" : on_add_clicked,
|
||||
"on_delete_clicked" : on_delete_clicked,
|
||||
"on_edit_clicked" : on_edit_clicked
|
||||
"on_ok_clicked" : self.on_ok_clicked,
|
||||
"on_add_clicked" : self.on_add_clicked,
|
||||
"on_delete_clicked" : self.on_delete_clicked,
|
||||
"on_edit_clicked" : self.on_edit_clicked
|
||||
})
|
||||
self.list = self.top.get_widget("list")
|
||||
self.dialog = self.top.get_widget("styles")
|
||||
self.dialog.set_data("o",self)
|
||||
self.redraw()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def redraw(self):
|
||||
"""Redraws the list of styles that are current available"""
|
||||
|
||||
self.list.clear()
|
||||
|
||||
self.list.set_data("i",0)
|
||||
sheet = self.sheetlist.get_style_sheet("default")
|
||||
self.list.append(["default"])
|
||||
self.list.set_row_data(0,("default",sheet))
|
||||
@ -73,83 +89,62 @@ class StyleListDisplay:
|
||||
self.list.set_row_data(index,(style,sheet))
|
||||
index = index + 1
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_add_clicked(obj):
|
||||
top = obj.get_data("o")
|
||||
def on_add_clicked(self,obj):
|
||||
"""Called with the ADD button is clicked. Invokes the StyleEditor to
|
||||
create a new style"""
|
||||
style = self.sheetlist.get_style_sheet("default")
|
||||
StyleEditor("New Style",style,self)
|
||||
|
||||
style = top.sheetlist.get_style_sheet("default")
|
||||
StyleEditor("New Style",style,top)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_ok_clicked(obj):
|
||||
top = obj.get_data("o")
|
||||
|
||||
top.callback(top.object)
|
||||
top.sheetlist.save()
|
||||
Utils.destroy_passed_object(obj)
|
||||
def on_ok_clicked(self,obj):
|
||||
"""Called with the OK button is clicked; Calls the callback task, then
|
||||
saves the stylesheet, and destroys the window."""
|
||||
self.callback()
|
||||
self.sheetlist.save()
|
||||
Utils.destroy_passed_object(obj)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_list_select_row(obj,row,a,b):
|
||||
list = obj.get_data("o").list
|
||||
list.set_data("i",row)
|
||||
def on_edit_clicked(self,obj):
|
||||
"""
|
||||
Called with the EDIT button is clicked. Calls the StyleEditor to edit the
|
||||
selected style.
|
||||
"""
|
||||
if len(self.list.selection) > 0:
|
||||
(name,style) = self.list.get_row_data(self.list.selection[0])
|
||||
StyleEditor(name,style,self)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_edit_clicked(obj):
|
||||
top = obj.get_data("o")
|
||||
def on_delete_clicked(self,obj):
|
||||
"""Deletes teh selected style."""
|
||||
if len(self.list.selection) > 0:
|
||||
(name,style) = self.list.get_row_data(self.list.selection[0])
|
||||
self.sheetlist.delete_style_sheet(name)
|
||||
self.redraw()
|
||||
|
||||
index = top.list.get_data("i")
|
||||
(name,style) = top.list.get_row_data(index)
|
||||
StyleEditor(name,style,top)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_delete_clicked(obj):
|
||||
top = obj.get_data("o")
|
||||
|
||||
index = top.list.get_data("i")
|
||||
(name,style) = top.list.get_row_data(index)
|
||||
top.sheetlist.delete_style_sheet(name)
|
||||
top.redraw()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class StyleEditor:
|
||||
"""
|
||||
Edits the current style definition. Presents a dialog allowing the values of
|
||||
the paragraphs in the style to be altered.
|
||||
"""
|
||||
|
||||
def __init__(self,name,style,parent):
|
||||
"""
|
||||
Creates the StyleEditor.
|
||||
|
||||
name - name of the style that is to be edited
|
||||
style - style object that is to be edited
|
||||
parent - StyleListDisplay object that called the editor
|
||||
"""
|
||||
|
||||
self.original_style = style
|
||||
self.style = StyleSheet(style)
|
||||
self.style = TextDoc.StyleSheet(style)
|
||||
self.parent = parent
|
||||
self.top = libglade.GladeXML(const.stylesFile,"editor")
|
||||
self.current_p = None
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
"on_save_style_clicked" : on_save_style_clicked,
|
||||
"on_save_style_clicked" : self.on_save_style_clicked,
|
||||
"destroy_passed_object" : Utils.destroy_passed_object
|
||||
})
|
||||
|
||||
self.window = self.top.get_widget("editor")
|
||||
self.window.set_data("obj",self)
|
||||
self.pnames = self.top.get_widget("name")
|
||||
|
||||
# Typing CR selects OK button
|
||||
@ -167,33 +162,29 @@ class StyleEditor:
|
||||
first = 1
|
||||
menuitem = gtk.GtkMenuItem(p_name)
|
||||
menuitem.set_data("o",p)
|
||||
menuitem.set_data("t",self)
|
||||
menuitem.connect("activate",change_display)
|
||||
menuitem.connect("activate",self.change_display)
|
||||
menuitem.show()
|
||||
myMenu.append(menuitem)
|
||||
self.pnames.set_menu(myMenu)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def draw(self,p):
|
||||
"""Updates the display with the selected paragraph."""
|
||||
|
||||
self.current_p = p
|
||||
font = p.get_font()
|
||||
self.top.get_widget("size").set_value(font.get_size())
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.top.get_widget("roman").set_active(1)
|
||||
else:
|
||||
self.top.get_widget("swiss").set_active(1)
|
||||
self.top.get_widget("bold").set_active(font.get_bold())
|
||||
self.top.get_widget("italic").set_active(font.get_italic())
|
||||
self.top.get_widget("underline").set_active(font.get_underline())
|
||||
if p.get_alignment() == PARA_ALIGN_LEFT:
|
||||
if p.get_alignment() == TextDoc.PARA_ALIGN_LEFT:
|
||||
self.top.get_widget("lalign").set_active(1)
|
||||
elif p.get_alignment() == PARA_ALIGN_RIGHT:
|
||||
elif p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.top.get_widget("ralign").set_active(1)
|
||||
elif p.get_alignment() == PARA_ALIGN_CENTER:
|
||||
elif p.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
|
||||
self.top.get_widget("calign").set_active(1)
|
||||
else:
|
||||
self.top.get_widget("jalign").set_active(1)
|
||||
@ -209,31 +200,28 @@ class StyleEditor:
|
||||
c = p.get_background_color()
|
||||
self.top.get_widget("bgcolor").set_i8(c[0],c[1],c[2],0)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def save_paragraph(self,p):
|
||||
"""Saves the current paragraph displayed on the dialog"""
|
||||
|
||||
font = p.get_font()
|
||||
font.set_size(int(self.top.get_widget("size").get_value()))
|
||||
|
||||
if self.top.get_widget("roman").get_active():
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
else:
|
||||
font.set_type_face(FONT_SERIF)
|
||||
font.set_type_face(TextDoc.FONT_SERIF)
|
||||
|
||||
font.set_bold(self.top.get_widget("bold").get_active())
|
||||
font.set_italic(self.top.get_widget("italic").get_active())
|
||||
font.set_underline(self.top.get_widget("underline").get_active())
|
||||
if self.top.get_widget("lalign").get_active():
|
||||
p.set_alignment(PARA_ALIGN_LEFT)
|
||||
p.set_alignment(TextDoc.PARA_ALIGN_LEFT)
|
||||
elif self.top.get_widget("ralign").get_active():
|
||||
p.set_alignment(PARA_ALIGN_RIGHT)
|
||||
p.set_alignment(TextDoc.PARA_ALIGN_RIGHT)
|
||||
elif self.top.get_widget("calign").get_active():
|
||||
p.set_alignment(PARA_ALIGN_CENTER)
|
||||
p.set_alignment(TextDoc.PARA_ALIGN_CENTER)
|
||||
else:
|
||||
p.set_alignment(PARA_ALIGN_JUSTIFY)
|
||||
p.set_alignment(TextDoc.PARA_ALIGN_JUSTIFY)
|
||||
|
||||
p.set_right_margin(float(self.top.get_widget("rmargin").get_text()))
|
||||
p.set_left_margin(float(self.top.get_widget("lmargin").get_text()))
|
||||
@ -248,33 +236,27 @@ class StyleEditor:
|
||||
c = self.top.get_widget("bgcolor").get_i8()
|
||||
p.set_background_color((c[0],c[1],c[2]))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def change_display(obj):
|
||||
top = obj.get_data("t")
|
||||
style = obj.get_data("o")
|
||||
p = top.current_p
|
||||
def on_save_style_clicked(self,obj):
|
||||
"""
|
||||
Saves the current style sheet and causes the parent to be updated with
|
||||
the changes.
|
||||
"""
|
||||
p = self.current_p
|
||||
name = self.top.get_widget("style_name").get_text()
|
||||
|
||||
top.save_paragraph(p)
|
||||
top.draw(style)
|
||||
self.save_paragraph(p)
|
||||
self.parent.sheetlist.set_style_sheet(name,self.style)
|
||||
self.parent.redraw()
|
||||
Utils.destroy_passed_object(obj)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_save_style_clicked(obj):
|
||||
top = obj.get_data("obj")
|
||||
p = top.current_p
|
||||
name = top.top.get_widget("style_name").get_text()
|
||||
def change_display(self,obj):
|
||||
"""Called when the paragraph selection has been changed. Saves the
|
||||
old paragraph, then draws the newly selected paragraph"""
|
||||
|
||||
style = obj.get_data("o")
|
||||
self.save_paragraph(self.current_p)
|
||||
self.draw(style)
|
||||
|
||||
top.save_paragraph(p)
|
||||
top.parent.sheetlist.set_style_sheet(name,top.style)
|
||||
top.parent.redraw()
|
||||
Utils.destroy_passed_object(obj)
|
||||
|
||||
|
||||
|
||||
|
@ -92,7 +92,7 @@ startup = 1
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
progName = "GRAMPS"
|
||||
version = "0.8.0-snap20020531"
|
||||
version = "0.8.0-snap20020621"
|
||||
copyright = "© 2001-2002 Donald N. Allingham"
|
||||
authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"]
|
||||
comments = _("GRAMPS (Genealogical Research and Analysis "
|
||||
|
@ -28,6 +28,7 @@ import intl
|
||||
_ = intl.gettext
|
||||
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
|
||||
import gtk
|
||||
import gnome.ui
|
||||
|
@ -35,6 +35,7 @@ import string
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
import intl
|
||||
|
||||
_ = intl.gettext
|
||||
|
@ -28,6 +28,7 @@ import intl
|
||||
_ = intl.gettext
|
||||
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
|
||||
import gtk
|
||||
import gnome.ui
|
||||
|
@ -29,7 +29,6 @@ import os
|
||||
import sort
|
||||
import Utils
|
||||
import string
|
||||
import ListColors
|
||||
import const
|
||||
import GenericFilter
|
||||
from TextDoc import *
|
||||
@ -208,11 +207,10 @@ class DisplayChart:
|
||||
eventlist = gtk.GtkCList(len(self.event_titles),self.event_titles)
|
||||
self.table.add(eventlist)
|
||||
eventlist.show()
|
||||
color_clist = ListColors.ColorList(eventlist,2)
|
||||
|
||||
for (top,bottom) in self.row_data:
|
||||
color_clist.add(top)
|
||||
color_clist.add(bottom)
|
||||
eventlist.append(top)
|
||||
eventlist.append(bottom)
|
||||
|
||||
for index in range(0,len(self.event_titles)):
|
||||
width = min(150,eventlist.optimal_column_width(index))
|
||||
|
@ -26,6 +26,7 @@ import intl
|
||||
_ = intl.gettext
|
||||
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -26,10 +26,13 @@ import string
|
||||
import intl
|
||||
import Utils
|
||||
|
||||
import gtk
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
import libglade
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
|
||||
_scaled = 0
|
||||
_single = 1
|
||||
@ -93,25 +96,25 @@ class GraphVizDialog(ReportDialog):
|
||||
return [all,des,ans]
|
||||
|
||||
def add_user_options(self):
|
||||
self.arrowstyle_optionmenu = GtkOptionMenu()
|
||||
menu = GtkMenu()
|
||||
self.arrowstyle_optionmenu = gtk.GtkOptionMenu()
|
||||
menu = gtk.GtkMenu()
|
||||
|
||||
menuitem = GtkMenuItem(_("Descendants <- Ancestors"))
|
||||
menuitem = gtk.GtkMenuItem(_("Descendants <- Ancestors"))
|
||||
menuitem.set_data('t', ('none', 'normal'))
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
|
||||
menuitem = GtkMenuItem(_("Descendants -> Ancestors"))
|
||||
menuitem = gtk.GtkMenuItem(_("Descendants -> Ancestors"))
|
||||
menuitem.set_data('t', ('normal', 'none'))
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
|
||||
menuitem = GtkMenuItem(_("Descendants <-> Ancestors"))
|
||||
menuitem = gtk.GtkMenuItem(_("Descendants <-> Ancestors"))
|
||||
menuitem.set_data('t', ('normal', 'normal'))
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
|
||||
menuitem = GtkMenuItem(_("Descendants - Ancestors"))
|
||||
menuitem = gtk.GtkMenuItem(_("Descendants - Ancestors"))
|
||||
menuitem.set_data('t', ('none', 'none'))
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
@ -126,7 +129,7 @@ class GraphVizDialog(ReportDialog):
|
||||
_("Choose the direction that the arrows point."))
|
||||
|
||||
msg = _("Include Birth and Death Dates")
|
||||
self.includedates_cb = GtkCheckButton(msg)
|
||||
self.includedates_cb = gtk.GtkCheckButton(msg)
|
||||
self.includedates_cb.set_active(1)
|
||||
self.add_frame_option(_("GraphViz Options"), '',
|
||||
self.includedates_cb,
|
||||
@ -134,7 +137,7 @@ class GraphVizDialog(ReportDialog):
|
||||
"was born and/or died in the graph node "
|
||||
"labels."))
|
||||
|
||||
self.includeurl_cb = GtkCheckButton(_("Include URLs"))
|
||||
self.includeurl_cb = gtk.GtkCheckButton(_("Include URLs"))
|
||||
self.includeurl_cb.set_active(1)
|
||||
self.add_frame_option(_("GraphViz Options"), '',
|
||||
self.includeurl_cb,
|
||||
@ -144,7 +147,7 @@ class GraphVizDialog(ReportDialog):
|
||||
"to the files generated by the 'Generate "
|
||||
"Web Site' report."))
|
||||
|
||||
self.colorize_cb = GtkCheckButton(_("Colorize Graph"))
|
||||
self.colorize_cb = gtk.GtkCheckButton(_("Colorize Graph"))
|
||||
self.colorize_cb.set_active(1)
|
||||
self.add_frame_option(_("GraphViz Options"),
|
||||
'',
|
||||
@ -154,7 +157,7 @@ class GraphVizDialog(ReportDialog):
|
||||
"an individual is unknown it will be "
|
||||
"outlined in black."))
|
||||
|
||||
self.adoptionsdashed_cb = GtkCheckButton(_("Indicate non-birth relationships with dashed lines"))
|
||||
self.adoptionsdashed_cb = gtk.GtkCheckButton(_("Indicate non-birth relationships with dashed lines"))
|
||||
self.adoptionsdashed_cb.set_active(1)
|
||||
self.add_frame_option(_("GraphViz Options"),
|
||||
'',
|
||||
@ -162,13 +165,13 @@ class GraphVizDialog(ReportDialog):
|
||||
_("Non-birth relationships will show up "
|
||||
"as dashed lines in the graph."))
|
||||
|
||||
tb_margin_adj = GtkAdjustment(value=0.5, lower=0.25,
|
||||
tb_margin_adj = gtk.GtkAdjustment(value=0.5, lower=0.25,
|
||||
upper=100.0, step_incr=0.25)
|
||||
lr_margin_adj = GtkAdjustment(value=0.5, lower=0.25,
|
||||
lr_margin_adj = gtk.GtkAdjustment(value=0.5, lower=0.25,
|
||||
upper=100.0, step_incr=0.25)
|
||||
|
||||
self.tb_margin_sb = GtkSpinButton(adj=tb_margin_adj, digits=2)
|
||||
self.lr_margin_sb = GtkSpinButton(adj=lr_margin_adj, digits=2)
|
||||
self.tb_margin_sb = gtk.GtkSpinButton(adj=tb_margin_adj, digits=2)
|
||||
self.lr_margin_sb = gtk.GtkSpinButton(adj=lr_margin_adj, digits=2)
|
||||
|
||||
self.add_frame_option(_("GraphViz Options"),
|
||||
_("Top & Bottom Margins"),
|
||||
@ -177,11 +180,11 @@ class GraphVizDialog(ReportDialog):
|
||||
_("Left & Right Margins"),
|
||||
self.lr_margin_sb)
|
||||
|
||||
hpages_adj = GtkAdjustment(value=1, lower=1, upper=25, step_incr=1)
|
||||
vpages_adj = GtkAdjustment(value=1, lower=1, upper=25, step_incr=1)
|
||||
hpages_adj = gtk.GtkAdjustment(value=1, lower=1, upper=25, step_incr=1)
|
||||
vpages_adj = gtk.GtkAdjustment(value=1, lower=1, upper=25, step_incr=1)
|
||||
|
||||
self.hpages_sb = GtkSpinButton(adj=hpages_adj, digits=0)
|
||||
self.vpages_sb = GtkSpinButton(adj=vpages_adj, digits=0)
|
||||
self.hpages_sb = gtk.GtkSpinButton(adj=hpages_adj, digits=0)
|
||||
self.vpages_sb = gtk.GtkSpinButton(adj=vpages_adj, digits=0)
|
||||
|
||||
self.add_frame_option(_("GraphViz Options"),
|
||||
_("Number of Horizontal Pages"),
|
||||
|
Loading…
Reference in New Issue
Block a user