Fixed WebPage dialog box
svn: r689
This commit is contained in:
parent
e31320fa17
commit
ce2f013381
@ -194,9 +194,9 @@ class HtmlDoc(TextDoc):
|
||||
font_size = font.get_size()
|
||||
font_color = '#%02x%02x%02x' % font.get_color()
|
||||
align = style.get_alignment_text()
|
||||
text_indent = fl2txt("%.2f",style.get_first_indent())
|
||||
right_margin = fl2txt("%.2f",style.get_right_margin())
|
||||
left_margin = fl2txt("%.2f",style.get_left_margin())
|
||||
text_indent = "%.2f" % style.get_first_indent()
|
||||
right_margin = "%.2f" % style.get_right_margin()
|
||||
left_margin = "%.2f" % style.get_left_margin()
|
||||
|
||||
top = bottom = left = right = 'none'
|
||||
if style.get_top_border():
|
||||
|
@ -140,12 +140,9 @@ class ReportDialog:
|
||||
frame_pad = 5
|
||||
border_pad = 5
|
||||
|
||||
def __init__(self,database,person,filename="basicreport.glade"):
|
||||
def __init__(self,database,person):
|
||||
"""Initialize a dialog to request that the user select options
|
||||
for a basic report. The glade filename is optional. If
|
||||
provided it must reference a glade file that is either be a
|
||||
superset of the basic dialog, or the subclass must override
|
||||
most of the setup_xxx and parse_xxx functions."""
|
||||
for a basic report."""
|
||||
|
||||
# Save info about who the report is about.
|
||||
self.db = database
|
||||
@ -169,10 +166,10 @@ class ReportDialog:
|
||||
# Set up and run the dialog. These calls are not in top down
|
||||
# order when looking at the dialog box as there is some
|
||||
# interaction between the various frames.
|
||||
self.add_user_options()
|
||||
self.setup_title()
|
||||
self.setup_header()
|
||||
self.setup_target_frame()
|
||||
self.setup_format_frame()
|
||||
self.setup_style_frame()
|
||||
self.setup_output_notebook()
|
||||
self.setup_paper_frame()
|
||||
@ -180,6 +177,11 @@ class ReportDialog:
|
||||
self.setup_report_options_frame()
|
||||
self.setup_other_frames()
|
||||
self.window.show_all()
|
||||
self.setup_format_frame()
|
||||
|
||||
def add_user_options(self):
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks for subclasses
|
||||
@ -395,6 +397,9 @@ class ReportDialog:
|
||||
# Save Frame
|
||||
frame = 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"))
|
||||
|
||||
hbox = GtkHBox()
|
||||
@ -406,10 +411,6 @@ class ReportDialog:
|
||||
else:
|
||||
label = GtkLabel(_("Filename"))
|
||||
hbox.pack_start(label,0,0,5)
|
||||
|
||||
hid = self.get_stylesheet_savefile()
|
||||
if hid[-4:]==".xml":
|
||||
hid = hid[0:-4]
|
||||
|
||||
hbox.add(self.target_fileentry)
|
||||
frame.add(hbox)
|
||||
@ -419,7 +420,6 @@ class ReportDialog:
|
||||
if (self.get_target_is_directory()):
|
||||
import _gnomeui
|
||||
_gnomeui.gnome_file_entry_set_directory(self.target_fileentry._o, 1)
|
||||
self.topDialog.get_widget("saveas").set_text(_("Directory"))
|
||||
|
||||
target_filename = self.target_fileentry.children()[0].entry
|
||||
target_filename.set_text(self.get_default_directory())
|
||||
@ -812,11 +812,11 @@ class ReportDialog:
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class TextReportDialog(ReportDialog):
|
||||
def __init__(self,database,person,filename="basicreport.glade"):
|
||||
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
|
||||
information."""
|
||||
ReportDialog.__init__(self,database,person,filename)
|
||||
ReportDialog.__init__(self,database,person)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -66,11 +66,6 @@ def ancestors_of(p1,list):
|
||||
#-------------------------------------------------------------------------
|
||||
class Merge:
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def __init__(self,database,callback):
|
||||
self.db = database
|
||||
self.map = {}
|
||||
@ -113,31 +108,18 @@ class Merge:
|
||||
})
|
||||
|
||||
def on_merge_ok_clicked(self,obj):
|
||||
|
||||
active = self.menu.get_menu().get_active().get_data("v")
|
||||
self.use_soundex = self.soundex_obj.get_active()
|
||||
utils.destroy_passed_object(obj)
|
||||
self.find_potentials(active)
|
||||
self.show()
|
||||
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def progress_update(self,val):
|
||||
self.progress.set_value(val)
|
||||
while events_pending():
|
||||
mainiteration()
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def find_potentials(self,thresh):
|
||||
|
||||
top = GladeXML(self.glade_file,"message")
|
||||
self.topWin = top.get_widget("message")
|
||||
self.progress = top.get_widget("progressbar1")
|
||||
@ -199,11 +181,6 @@ class Merge:
|
||||
self.topWin.destroy()
|
||||
self.dellist = {}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def show(self):
|
||||
top = GladeXML(self.glade_file,"mergelist")
|
||||
self.window = top.get_widget("mergelist")
|
||||
@ -266,11 +243,6 @@ class Merge:
|
||||
self.update(1)
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def list_reduce(self,list1,list2):
|
||||
value = 0
|
||||
for name in list1:
|
||||
@ -292,33 +264,18 @@ class Merge:
|
||||
else:
|
||||
return min(value,1)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-----------------------------------------------------------------
|
||||
def gen_key(self,val):
|
||||
if self.use_soundex:
|
||||
return soundex.soundex(val)
|
||||
else:
|
||||
return val
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-----------------------------------------------------------------
|
||||
def name_compare(self,s1,s2):
|
||||
if self.use_soundex:
|
||||
return soundex.compare(s1,s2)
|
||||
else:
|
||||
return s1 == s2
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-----------------------------------------------------------------
|
||||
def date_match(self,date1,date2):
|
||||
if date1.getDate() == "" or date2.getDate() == "":
|
||||
return 0
|
||||
@ -341,11 +298,6 @@ class Merge:
|
||||
else:
|
||||
return -1
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-----------------------------------------------------------------
|
||||
def range_compare(self,date1,date2):
|
||||
if date1.isRange() and date2.isRange():
|
||||
if date1.get_start_date() >= date2.get_start_date() and \
|
||||
@ -372,11 +324,6 @@ class Merge:
|
||||
else:
|
||||
return -1
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-----------------------------------------------------------------
|
||||
def name_match(self,name,name1):
|
||||
|
||||
if not name1 or not name:
|
||||
@ -404,11 +351,6 @@ class Merge:
|
||||
else:
|
||||
return self.list_reduce(list2,list1)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def place_match(self,p1,p2):
|
||||
if p1 == p2:
|
||||
return 1
|
||||
@ -445,11 +387,6 @@ class Merge:
|
||||
else:
|
||||
return min(value,1)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def compare_people(self,p1,p2):
|
||||
|
||||
name1 = p1.getPrimaryName()
|
||||
|
@ -1,4 +1,4 @@
|
||||
#
|
||||
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 Donald N. Allingham
|
||||
@ -777,8 +777,28 @@ class WebReport(Report):
|
||||
#------------------------------------------------------------------------
|
||||
class WebReportDialog(ReportDialog):
|
||||
def __init__(self,database,person):
|
||||
ReportDialog.__init__(self,database,person,"webpage.glade")
|
||||
ReportDialog.__init__(self,database,person)
|
||||
|
||||
def add_user_options(self):
|
||||
|
||||
self.use_link = GtkCheckButton(_("Include a link to the index page"))
|
||||
self.use_link.set_active(1)
|
||||
self.no_private = GtkCheckButton(_("Do not include records marked private"))
|
||||
self.no_private.set_active(1)
|
||||
self.restrict_living = GtkCheckButton(_("Restrict information on living people"))
|
||||
self.no_images = GtkCheckButton(_("Do not use images"))
|
||||
self.no_living_images = GtkCheckButton(_("Do not use images for living people"))
|
||||
self.no_comments = GtkCheckButton(_("Do not include comments and text in source information"))
|
||||
|
||||
self.add_option('',self.use_link)
|
||||
self.add_option('',self.no_private)
|
||||
self.add_option('',self.restrict_living)
|
||||
self.add_option('',self.no_images)
|
||||
self.add_option('',self.no_living_images)
|
||||
self.add_option('',self.no_comments)
|
||||
|
||||
self.no_images.connect('toggled',self.on_nophotos_toggled)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks
|
||||
@ -936,21 +956,6 @@ class WebReportDialog(ReportDialog):
|
||||
page."""
|
||||
self.output_notebook.set_page(1)
|
||||
|
||||
def setup_other_frames(self):
|
||||
"""Set up the privacy frame of the dialog. This sole purpose of
|
||||
this function is to grab a pointer for later use in a callback
|
||||
routine."""
|
||||
self.restrict_photos_check = self.topDialog.get_widget("restrict_photos")
|
||||
|
||||
def connect_signals(self):
|
||||
"""Connect the signal handlers for this dialog. This routine
|
||||
uses the parent routine to connect the common handlers, and
|
||||
the connects its own unique handler."""
|
||||
ReportDialog.connect_signals(self)
|
||||
self.topDialog.signal_autoconnect({
|
||||
"on_nophotos_toggled" : self.on_nophotos_toggled,
|
||||
})
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Functions related to retrieving data from the dialog window
|
||||
@ -965,17 +970,17 @@ class WebReportDialog(ReportDialog):
|
||||
"""Parse the report options frame of the dialog. Save the
|
||||
user selected choices for later use."""
|
||||
ReportDialog.parse_report_options_frame(self)
|
||||
self.include_link = self.topDialog.get_widget("include_link").get_active()
|
||||
self.include_link = self.use_link.get_active()
|
||||
|
||||
def parse_other_frames(self):
|
||||
"""Parse the privacy options frame of the dialog. Save the
|
||||
user selected choices for later use."""
|
||||
self.restrict = self.topDialog.get_widget("restrict").get_active()
|
||||
self.private = self.topDialog.get_widget("private").get_active()
|
||||
self.srccomments = self.topDialog.get_widget("srccomments").get_active()
|
||||
if (self.topDialog.get_widget("nophotos").get_active() == 1):
|
||||
self.restrict = self.restrict_living.get_active()
|
||||
self.private = self.no_private.get_active()
|
||||
self.srccomments = self.no_comments.get_active()
|
||||
if self.no_images.get_active() == 1:
|
||||
self.photos = 0
|
||||
elif (self.restrict_photos_check.get_active() == 1):
|
||||
elif self.no_living_images.get_active() == 1:
|
||||
self.photos = 1
|
||||
else:
|
||||
self.photos = 2
|
||||
@ -991,9 +996,9 @@ class WebReportDialog(ReportDialog):
|
||||
no sense to worry about restricting which photos are included,
|
||||
now does it?"""
|
||||
if obj.get_active():
|
||||
self.restrict_photos_check.set_sensitive(0)
|
||||
self.no_living_images.set_sensitive(0)
|
||||
else:
|
||||
self.restrict_photos_check.set_sensitive(1)
|
||||
self.no_living_images.set_sensitive(1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user