Revert "5098: refactor code to use User.progress"
This reverts commit db9a64ef7da5f26c586452c1a84a96675991d9a4. This was tested with "runtest.sh" only, but turns out things are broken under GUI. I'll investigate on a private branch, reverting meanwhile to unblock the affected plugins on trunk. svn: r23099
This commit is contained in:
parent
92c13a36bf
commit
85c1a9a0fd
@ -137,11 +137,11 @@ def diff_dbs(db1, db2, user=None):
|
||||
missing_from_old = []
|
||||
missing_from_new = []
|
||||
diffs = []
|
||||
with user.progress(_('Family Tree Differences'),
|
||||
_('Searching...'), 10) as step:
|
||||
user.begin_progress(_('Family Tree Differences'),
|
||||
_('Searching...'), 10)
|
||||
for item in ['Person', 'Family', 'Source', 'Citation', 'Event', 'Media',
|
||||
'Place', 'Repository', 'Note', 'Tag']:
|
||||
step()
|
||||
user.step_progress()
|
||||
handles1 = sorted(db1._tables[item]["handles_func"]())
|
||||
handles2 = sorted(db2._tables[item]["handles_func"]())
|
||||
p1 = 0
|
||||
@ -172,6 +172,7 @@ def diff_dbs(db1, db2, user=None):
|
||||
item2 = db2._tables[item]["handle_func"](handles2[p2])
|
||||
missing_from_old += [(item, item2)]
|
||||
p2 += 1
|
||||
user.end_progress()
|
||||
return diffs, missing_from_old, missing_from_new
|
||||
|
||||
def diff_db_to_file(old_db, filename, user=None):
|
||||
|
@ -707,8 +707,8 @@ class AncestorTree(Report):
|
||||
self.canvas.report_opts.box_pgap *= self.connect.get_val('box_Yscale')
|
||||
self.canvas.report_opts.box_mgap *= self.connect.get_val('box_Yscale')
|
||||
|
||||
with self._user.progress(_('Ancestor Tree'),
|
||||
_('Making the Tree...'), 4) as step:
|
||||
self._user.begin_progress(_('Ancestor Tree'),
|
||||
_('Making the Tree...'), 4)
|
||||
|
||||
#make the tree onto the canvas
|
||||
inlc_marr = self.connect.get_val("inc_marr")
|
||||
@ -719,7 +719,7 @@ class AncestorTree(Report):
|
||||
tree.start(self.connect.get_val('pid'))
|
||||
tree = None
|
||||
|
||||
step()
|
||||
self._user.step_progress()
|
||||
|
||||
#Title
|
||||
title = self.connect.title_class(self.doc)
|
||||
@ -737,7 +737,7 @@ class AncestorTree(Report):
|
||||
self.max_generations = report.get_generations() #already know
|
||||
report = None
|
||||
|
||||
step()
|
||||
self._user.step_progress()
|
||||
|
||||
#Note?
|
||||
if self.connect.get_val("inc_note"):
|
||||
@ -756,11 +756,13 @@ class AncestorTree(Report):
|
||||
scale = self.canvas.scale_report(one_page,
|
||||
scale_report != 0, scale_report == 2)
|
||||
|
||||
step()
|
||||
self._user.step_progress()
|
||||
|
||||
if scale != 1 or self.connect.get_val('shadowscale') != 1.0:
|
||||
self.scale_styles(scale)
|
||||
|
||||
self._user.end_progress()
|
||||
|
||||
def write_report(self):
|
||||
|
||||
one_page = self.connect.get_val("resize_page")
|
||||
@ -794,8 +796,8 @@ class AncestorTree(Report):
|
||||
#lets finally make some pages!!!
|
||||
#####################
|
||||
pages = self.canvas.page_count(incblank)
|
||||
with self._user.progress( _('Ancestor Tree'),
|
||||
_('Printing the Tree...'), pages) as step:
|
||||
self._user.begin_progress( _('Ancestor Tree'),
|
||||
_('Printing the Tree...'), pages)
|
||||
|
||||
for page in self.canvas.page_iter_gen(incblank):
|
||||
|
||||
@ -812,9 +814,12 @@ class AncestorTree(Report):
|
||||
#Print the individual people and lines
|
||||
page.display()
|
||||
|
||||
step()
|
||||
self._user.step_progress()
|
||||
self.doc.end_page()
|
||||
|
||||
self._user.end_progress()
|
||||
|
||||
|
||||
def scale_styles(self, scale):
|
||||
"""
|
||||
Scale the styles for this report.
|
||||
|
@ -165,11 +165,12 @@ class Calendar(Report):
|
||||
# get data from database:
|
||||
self.collect_data()
|
||||
# generate the report:
|
||||
with self._user.progress( _('Calendar Report'),
|
||||
_('Formatting months...'), 12) as step:
|
||||
self._user.begin_progress( _('Calendar Report'),
|
||||
_('Formatting months...'), 12)
|
||||
for month in range(1, 13):
|
||||
step()
|
||||
self._user.step_progress()
|
||||
self.print_page(month)
|
||||
self._user.end_progress()
|
||||
|
||||
def print_page(self, month):
|
||||
"""
|
||||
@ -267,15 +268,17 @@ class Calendar(Report):
|
||||
"""
|
||||
db = self.database
|
||||
people = db.iter_person_handles()
|
||||
with self._user.progress(_('Calendar Report'),
|
||||
self._user.begin_progress(_('Calendar Report'),
|
||||
_('Applying Filter...'),
|
||||
db.get_number_of_people()) as step:
|
||||
people = self.filter.apply(self.database, people, step)
|
||||
db.get_number_of_people())
|
||||
people = self.filter.apply(self.database, people,
|
||||
self._user.step_progress)
|
||||
self._user.end_progress()
|
||||
|
||||
with self._user.progress(_('Calendar Report'),
|
||||
_('Reading database...'), len(people)) as step:
|
||||
self._user.begin_progress(_('Calendar Report'),
|
||||
_('Reading database...'), len(people))
|
||||
for person_handle in people:
|
||||
step()
|
||||
self._user.step_progress()
|
||||
person = db.get_person_from_handle(person_handle)
|
||||
mark = ReportUtils.get_person_mark(db, person)
|
||||
birth_ref = person.get_birth_ref()
|
||||
@ -392,6 +395,7 @@ class Calendar(Report):
|
||||
if ((self.alive and alive1 and alive2) or not self.alive):
|
||||
self.add_day_item(text, month, day,
|
||||
marks=[mark,s_m])
|
||||
self._user.end_progress()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -123,12 +123,13 @@ class TimeLine(Report):
|
||||
|
||||
def write_report(self):
|
||||
# Apply the filter
|
||||
with self._user.progress(_('Timeline'),
|
||||
self._user.begin_progress(_('Timeline'),
|
||||
_('Applying filter...'),
|
||||
self.database.get_number_of_people()) as step:
|
||||
self.database.get_number_of_people())
|
||||
self.plist = self.filter.apply(self.database,
|
||||
self.database.iter_person_handles(),
|
||||
step)
|
||||
self._user.step_progress)
|
||||
self._user.end_progress()
|
||||
|
||||
# Find the range of dates to include
|
||||
(low, high) = self.find_year_range()
|
||||
@ -149,8 +150,9 @@ class TimeLine(Report):
|
||||
self.header = 2.0
|
||||
|
||||
# Sort the people as requested
|
||||
with self._user.progress(_('Timeline'), _('Sorting dates...'), 0) as step:
|
||||
self._user.begin_progress(_('Timeline'), _('Sorting dates...'), 0)
|
||||
self.plist.sort(key=self.sort_func)
|
||||
self._user.end_progress()
|
||||
|
||||
self.doc.start_page()
|
||||
self.build_grid(low, high, start, stop, True)
|
||||
@ -160,8 +162,8 @@ class TimeLine(Report):
|
||||
|
||||
length = len(self.plist)
|
||||
|
||||
with self._user.progress(_('Timeline'),
|
||||
_('Calculating timeline...'), length) as step:
|
||||
self._user.begin_progress(_('Timeline'),
|
||||
_('Calculating timeline...'), length)
|
||||
|
||||
for p_id in self.plist:
|
||||
p = self.database.get_person_from_handle(p_id)
|
||||
@ -217,8 +219,9 @@ class TimeLine(Report):
|
||||
else:
|
||||
index += 1;
|
||||
current += 1
|
||||
step()
|
||||
self._user.step_progress()
|
||||
self.doc.end_page()
|
||||
self._user.end_progress()
|
||||
|
||||
def build_grid(self, year_low, year_high, start_pos, stop_pos, toc=False):
|
||||
"""
|
||||
@ -340,9 +343,9 @@ class TimeLine(Report):
|
||||
high = year
|
||||
return (low, high)
|
||||
|
||||
with self._user.progress(_('Timeline'),
|
||||
self._user.begin_progress(_('Timeline'),
|
||||
_('Finding date range...'),
|
||||
len(self.plist)) as step:
|
||||
len(self.plist))
|
||||
|
||||
for p_id in self.plist:
|
||||
p = self.database.get_person_from_handle(p_id)
|
||||
@ -355,7 +358,7 @@ class TimeLine(Report):
|
||||
if death:
|
||||
d = death.get_date_object().to_calendar(self.calendar).get_year()
|
||||
(low, high) = min_max_year(low, high, d)
|
||||
step()
|
||||
self._user.step_progress()
|
||||
|
||||
# round the dates to the nearest decade
|
||||
if low is not None:
|
||||
@ -373,6 +376,7 @@ class TimeLine(Report):
|
||||
if low is not None and high is not None:
|
||||
low -= 50 - ((high-low) % 50)
|
||||
|
||||
self._user.end_progress()
|
||||
return (low, high)
|
||||
|
||||
def name_size(self):
|
||||
|
@ -324,19 +324,19 @@ class CSVParser(object):
|
||||
|
||||
:param filehandle: open file handle positioned at start of the file
|
||||
"""
|
||||
progress_title = _('CSV Import')
|
||||
with self.user.progress(progress_title,
|
||||
_('Reading data...'), 1) as step:
|
||||
data = self.read_csv(filehandle)
|
||||
|
||||
with self.user.progress(progress_title,
|
||||
_('Importing data...'), len(data)) as step:
|
||||
progress_title = _('CSV Import')
|
||||
self.user.begin_progress(progress_title,
|
||||
_('Reading data...'), 1)
|
||||
self.user.end_progress()
|
||||
self.user.begin_progress(progress_title,
|
||||
_('Importing data...'), len(data))
|
||||
tym = time.time()
|
||||
self.db.disable_signals()
|
||||
with DbTxn(_("CSV import"), self.db, batch=True) as self.trans:
|
||||
if self.default_tag and self.default_tag.handle is None:
|
||||
self.db.add_tag(self.default_tag, self.trans)
|
||||
self._parse_csv_data(data, step)
|
||||
self._parse_csv_data(data)
|
||||
self.db.enable_signals()
|
||||
self.db.request_rebuild()
|
||||
tym = time.time() - tym
|
||||
@ -345,8 +345,9 @@ class CSVParser(object):
|
||||
LOG.debug(msg)
|
||||
LOG.debug("New Families: %d" % self.fam_count)
|
||||
LOG.debug("New Individuals: %d" % self.indi_count)
|
||||
self.user.end_progress()
|
||||
|
||||
def _parse_csv_data(self, data, step):
|
||||
def _parse_csv_data(self, data):
|
||||
"""Parse each line of the input data and act accordingly."""
|
||||
self.lineno = 0
|
||||
self.index = 0
|
||||
@ -357,7 +358,7 @@ class CSVParser(object):
|
||||
header = None
|
||||
line_number = 0
|
||||
for row in data:
|
||||
step()
|
||||
self.user.step_progress()
|
||||
line_number += 1
|
||||
if "".join(row) == "": # no blanks are allowed inside a table
|
||||
header = None # clear headers, ready for next "table"
|
||||
|
@ -216,11 +216,12 @@ class BirthdayReport(Report):
|
||||
self.doc.write_text(self._("Relationships shown are to %s") %
|
||||
self._name_display.display_name(name), mark)
|
||||
self.doc.end_paragraph()
|
||||
with self._user.progress(_('Birthday and Anniversary Report'),
|
||||
_('Formatting months...'), 12) as step:
|
||||
self._user.begin_progress(_('Birthday and Anniversary Report'),
|
||||
_('Formatting months...'), 12)
|
||||
for month in range(1, 13):
|
||||
step()
|
||||
self._user.step_progress()
|
||||
self.print_page(month)
|
||||
self._user.end_progress()
|
||||
|
||||
def print_page(self, month):
|
||||
""" Prints a month as a page """
|
||||
@ -255,20 +256,21 @@ class BirthdayReport(Report):
|
||||
and text.
|
||||
"""
|
||||
people = self.database.iter_person_handles()
|
||||
with self._user.progress(_('Birthday and Anniversary Report'),
|
||||
self._user.begin_progress(_('Birthday and Anniversary Report'),
|
||||
_('Applying Filter...'),
|
||||
self.database.get_number_of_people()) as step:
|
||||
self.database.get_number_of_people())
|
||||
people = self.filter.apply(self.database, people,
|
||||
step)
|
||||
self._user.step_progress)
|
||||
self._user.end_progress()
|
||||
|
||||
rel_calc = get_relationship_calculator(reinit=True,
|
||||
clocale=self._locale)
|
||||
ngettext = self._locale.translation.ngettext
|
||||
|
||||
with self._user.progress(_('Birthday and Anniversary Report'),
|
||||
_('Reading database...'), len(people)) as step:
|
||||
self._user.begin_progress(_('Birthday and Anniversary Report'),
|
||||
_('Reading database...'), len(people))
|
||||
for person_handle in people:
|
||||
step()
|
||||
self._user.step_progress()
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
birth_ref = person.get_birth_ref()
|
||||
birth_date = None
|
||||
@ -388,6 +390,7 @@ class BirthdayReport(Report):
|
||||
prob_alive_date)
|
||||
if (self.alive and alive1 and alive2) or not self.alive:
|
||||
self.add_day_item(text, month, day, spouse)
|
||||
self._user.end_progress()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -126,9 +126,9 @@ class PlaceReport(Report):
|
||||
"""
|
||||
place_nbr = 1
|
||||
|
||||
with self._user.progress(_("Place Report"),
|
||||
self._user.begin_progress(_("Place Report"),
|
||||
_("Generating report"),
|
||||
len(self.place_handles)) as step:
|
||||
len(self.place_handles))
|
||||
|
||||
for handle in self.place_handles:
|
||||
self.__write_place(handle, place_nbr)
|
||||
@ -140,8 +140,9 @@ class PlaceReport(Report):
|
||||
raise AttributeError("no such center: '%s'" % self.center)
|
||||
place_nbr += 1
|
||||
# increment progress bar
|
||||
step()
|
||||
self._user.step_progress()
|
||||
|
||||
self._user.end_progress()
|
||||
|
||||
def __write_place(self, handle, place_nbr):
|
||||
"""
|
||||
|
@ -3037,15 +3037,16 @@ class FamilyPages(BasePage):
|
||||
for item in self.report.obj_dict[Family].items():
|
||||
log.debug(" %s" % str(item))
|
||||
|
||||
with self.report.user.progress(_("Narrated Web Site Report"),
|
||||
self.report.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_("Creating family pages..."),
|
||||
len(self.report.obj_dict[Family]) + 1) as step:
|
||||
len(self.report.obj_dict[Family]) + 1)
|
||||
self.FamilyListPage(self.report, title,
|
||||
self.report.obj_dict[Family].keys())
|
||||
|
||||
for family_handle in self.report.obj_dict[Family]:
|
||||
step()
|
||||
self.report.user.step_progress()
|
||||
self.FamilyPage(self.report, title, family_handle)
|
||||
self.report.user.end_progress()
|
||||
|
||||
def FamilyListPage(self, report, title, fam_list):
|
||||
self.dbase_ = report.database
|
||||
@ -3313,16 +3314,17 @@ class PlacePages(BasePage):
|
||||
log.debug("obj_dict[Place]")
|
||||
for item in self.report.obj_dict[Place].items():
|
||||
log.debug(" %s" % str(item))
|
||||
with self.report.user.progress(_("Narrated Web Site Report"),
|
||||
self.report.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_("Creating place pages"),
|
||||
len(self.report.obj_dict[Place]) + 1) as step:
|
||||
len(self.report.obj_dict[Place]) + 1)
|
||||
|
||||
self.PlaceListPage(self.report, title,
|
||||
self.report.obj_dict[Place].keys())
|
||||
|
||||
for place_handle in self.report.obj_dict[Place]:
|
||||
step()
|
||||
self.report.user.step_progress()
|
||||
self.PlacePage(self.report, title, place_handle)
|
||||
self.report.user.end_progress()
|
||||
pass
|
||||
|
||||
def PlaceListPage(self, report, title, place_handles):
|
||||
@ -3596,15 +3598,16 @@ class EventPages(BasePage):
|
||||
for event_handle in event_handle_list:
|
||||
event = self.report.database.get_event_from_handle(event_handle)
|
||||
event_types.append(str(event.get_type()))
|
||||
with self.report.user.progress(_("Narrated Web Site Report"),
|
||||
self.report.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_("Creating event pages"),
|
||||
len(event_handle_list) + 1) as step:
|
||||
len(event_handle_list) + 1)
|
||||
self.EventListPage(self.report, title, event_types, event_handle_list)
|
||||
|
||||
for event_handle in event_handle_list:
|
||||
step()
|
||||
self.report.user.step_progress()
|
||||
self.EventPage(self.report, title, event_handle)
|
||||
|
||||
self.report.user.end_progress()
|
||||
|
||||
def EventListPage(self, report, title, event_types, event_handle_list):
|
||||
"""
|
||||
@ -4140,16 +4143,17 @@ class SourcePages(BasePage):
|
||||
log.debug("obj_dict[Source]")
|
||||
for item in self.report.obj_dict[Source].items():
|
||||
log.debug(" %s" % str(item))
|
||||
with self.report.user.progress(_("Narrated Web Site Report"),
|
||||
self.report.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_("Creating source pages"),
|
||||
len(self.report.obj_dict[Source]) + 1) as step:
|
||||
len(self.report.obj_dict[Source]) + 1)
|
||||
self.SourceListPage(self.report, title,
|
||||
self.report.obj_dict[Source].keys())
|
||||
|
||||
for source_handle in self.report.obj_dict[Source]:
|
||||
step()
|
||||
self.report.user.step_progress()
|
||||
self.SourcePage(self.report, title, source_handle)
|
||||
|
||||
self.report.user.end_progress()
|
||||
|
||||
def SourceListPage(self, report, title, source_handles):
|
||||
"""
|
||||
@ -4354,9 +4358,9 @@ class MediaPages(BasePage):
|
||||
log.debug("obj_dict[Media]")
|
||||
for item in self.report.obj_dict[MediaObject].items():
|
||||
log.debug(" %s" % str(item))
|
||||
with self.report.user.progress(_("Narrated Web Site Report"),
|
||||
self.report.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_("Creating media pages"),
|
||||
len(self.report.obj_dict[MediaObject]) + 1) as step:
|
||||
len(self.report.obj_dict[MediaObject]) + 1)
|
||||
|
||||
sorted_media_handles = sorted(self.report.obj_dict[MediaObject].keys(),
|
||||
key=lambda x: SORT_KEY(self.report.database.get_object_from_handle(x).desc))
|
||||
@ -4368,10 +4372,11 @@ class MediaPages(BasePage):
|
||||
for handle in sorted_media_handles:
|
||||
gc.collect() # Reduce memory usage when there are many images.
|
||||
next = None if index == total else sorted_media_handles[index]
|
||||
step()
|
||||
self.report.user.step_progress()
|
||||
self.MediaPage(self.report, title, handle, (prev, next, index, total))
|
||||
prev = handle
|
||||
index += 1
|
||||
self.report.user.end_progress()
|
||||
|
||||
def MediaListPage(self, report, title, sorted_media_handles):
|
||||
"""
|
||||
@ -5152,15 +5157,16 @@ class PersonPages(BasePage):
|
||||
log.debug("obj_dict[Person]")
|
||||
for item in self.report.obj_dict[Person].items():
|
||||
log.debug(" %s" % str(item))
|
||||
with self.report.user.progress(_("Narrated Web Site Report"),
|
||||
self.report.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_('Creating individual pages'),
|
||||
len(self.report.obj_dict[Person]) + 1) as step:
|
||||
len(self.report.obj_dict[Person]) + 1)
|
||||
self.IndividualListPage(self.report, title,
|
||||
self.report.obj_dict[Person].keys())
|
||||
for person_handle in self.report.obj_dict[Person]:
|
||||
step()
|
||||
self.report.user.step_progress()
|
||||
person = self.report.database.get_person_from_handle(person_handle)
|
||||
self.IndividualPage(self.report, title, person)
|
||||
self.report.user.end_progress()
|
||||
|
||||
#################################################
|
||||
#
|
||||
@ -6514,9 +6520,9 @@ class RepositoryPages(BasePage):
|
||||
log.debug(" %s" % str(item))
|
||||
|
||||
# set progress bar pass for Repositories
|
||||
with self.report.user.progress(_("Narrated Web Site Report"),
|
||||
self.report.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_('Creating repository pages'),
|
||||
len(self.report.obj_dict[Repository]) + 1) as step:
|
||||
len(self.report.obj_dict[Repository]) + 1)
|
||||
# Sort the repositories
|
||||
repos_dict = {}
|
||||
for repository_handle in self.report.obj_dict[Repository]:
|
||||
@ -6532,8 +6538,9 @@ class RepositoryPages(BasePage):
|
||||
for index, key in enumerate(keys):
|
||||
(repo, handle) = repos_dict[key]
|
||||
|
||||
step()
|
||||
self.report.user.step_progress()
|
||||
self.RepositoryPage(self.report, title, repo, handle)
|
||||
self.report.user.end_progress()
|
||||
|
||||
def RepositoryListPage(self, report, title, repos_dict, keys):
|
||||
self.dbase_ = report.database
|
||||
@ -7130,22 +7137,24 @@ class NavWebReport(Report):
|
||||
self.obj_dict[obj_class] = defaultdict(set)
|
||||
|
||||
ind_list = self.database.iter_person_handles()
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
self.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_('Applying Person Filter...'),
|
||||
self.database.get_number_of_people()) as step:
|
||||
self.database.get_number_of_people())
|
||||
ind_list = self.filter.apply(self.database, ind_list,
|
||||
step)
|
||||
self.user.step_progress)
|
||||
self.user.end_progress()
|
||||
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
self.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_('Constructing list of other objects...'),
|
||||
sum(1 for _ in ind_list)) as step:
|
||||
sum(1 for _ in ind_list))
|
||||
for handle in ind_list:
|
||||
# FIXME work around bug that self.database.iter under python 3
|
||||
# returns (binary) data rather than text
|
||||
if not isinstance(handle, UNITYPE):
|
||||
handle = handle.decode('utf-8')
|
||||
step()
|
||||
self.user.step_progress()
|
||||
self._add_person(handle, "", "")
|
||||
self.user.end_progress()
|
||||
|
||||
log.debug("final object dictionary \n" +
|
||||
"".join(("%s: %s\n" % item) for item in self.obj_dict.items()))
|
||||
@ -7554,11 +7563,11 @@ class NavWebReport(Report):
|
||||
|
||||
def build_gendex(self, ind_list):
|
||||
if self.inc_gendex:
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
_('Creating GENDEX file'), len(ind_list)) as step:
|
||||
self.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_('Creating GENDEX file'), len(ind_list))
|
||||
fp_gendex, gendex_io = self.create_file("gendex", ext=".txt")
|
||||
for person_handle in ind_list:
|
||||
step()
|
||||
self.user.step_progress()
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
self.write_gendex(fp_gendex, person)
|
||||
if self.archive:
|
||||
@ -7566,6 +7575,7 @@ class NavWebReport(Report):
|
||||
else:
|
||||
self.write_gendex(fp_gendex, person)
|
||||
self.close_file(fp_gendex, gendex_io)
|
||||
self.user.end_progress()
|
||||
|
||||
def write_gendex(self, fp, person):
|
||||
"""
|
||||
@ -7598,8 +7608,8 @@ class NavWebReport(Report):
|
||||
"""
|
||||
local_list = sort_people(self.database, ind_list)
|
||||
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
_("Creating surname pages"), len(local_list)) as step:
|
||||
self.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_("Creating surname pages"), len(local_list))
|
||||
|
||||
SurnameListPage(self, self.title, ind_list, SurnameListPage.ORDER_BY_NAME,
|
||||
self.surname_fname)
|
||||
@ -7609,16 +7619,18 @@ class NavWebReport(Report):
|
||||
|
||||
for (surname, handle_list) in local_list:
|
||||
SurnamePage(self, self.title, surname, handle_list)
|
||||
step()
|
||||
self.user.step_progress()
|
||||
self.user.end_progress()
|
||||
|
||||
def thumbnail_preview_page(self):
|
||||
"""
|
||||
creates the thumbnail preview page
|
||||
"""
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
self.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_("Creating thumbnail preview page..."),
|
||||
len(self.obj_dict[MediaObject])) as step:
|
||||
ThumbnailPreviewPage(self, self.title, step)
|
||||
len(self.obj_dict[MediaObject]))
|
||||
ThumbnailPreviewPage(self, self.title, self.user.step_progress)
|
||||
self.user.end_progress()
|
||||
|
||||
def addressbook_pages(self, ind_list):
|
||||
"""
|
||||
@ -7656,12 +7668,13 @@ class NavWebReport(Report):
|
||||
# begin Address Book pages
|
||||
addr_size = len(url_addr_res)
|
||||
|
||||
with self.user.progress(_("Narrated Web Site Report"),
|
||||
self.user.begin_progress(_("Narrated Web Site Report"),
|
||||
_("Creating address book pages ..."),
|
||||
addr_size) as step:
|
||||
addr_size)
|
||||
for (sort_name, person_handle, add, res, url) in url_addr_res:
|
||||
AddressBookPage(self, self.title, person_handle, add, res, url)
|
||||
step()
|
||||
self.user.step_progress()
|
||||
self.user.end_progress()
|
||||
|
||||
def base_pages(self):
|
||||
"""
|
||||
|
@ -296,9 +296,9 @@ class WebCalReport(Report):
|
||||
def __get_holidays(self, year):
|
||||
|
||||
# _('translation')
|
||||
with self._user.progress(_("Web Calendar Report"),
|
||||
self._user.begin_progress(_("Web Calendar Report"),
|
||||
(_('Calculating Holidays for year %04d') % year),
|
||||
365) as step:
|
||||
365)
|
||||
|
||||
""" Get the holidays for the specified country and year """
|
||||
holiday_table = libholiday.HolidayTable()
|
||||
@ -309,7 +309,8 @@ class WebCalReport(Report):
|
||||
holiday_names = holiday_table.get_holidays(month, day)
|
||||
for holiday_name in holiday_names:
|
||||
self.add_day_item(holiday_name, year, month, day, 'Holiday')
|
||||
step()
|
||||
self._user.step_progress()
|
||||
self._user.end_progress()
|
||||
|
||||
def copy_calendar_files(self):
|
||||
"""
|
||||
@ -838,8 +839,8 @@ class WebCalReport(Report):
|
||||
|
||||
nr_up = 1 # Number of directory levels up to get to self.html_dir / root
|
||||
|
||||
with self._user.progress(_("Web Calendar Report"),
|
||||
_('Formatting months ...'), 12) as step:
|
||||
self._user.begin_progress(_("Web Calendar Report"),
|
||||
_('Formatting months ...'), 12)
|
||||
|
||||
for month in range(1, 13):
|
||||
cal_fname = _dd.long_months[month]
|
||||
@ -889,7 +890,8 @@ class WebCalReport(Report):
|
||||
# and close the file
|
||||
self.XHTMLWriter(webcal, of)
|
||||
|
||||
step()
|
||||
self._user.step_progress()
|
||||
self._user.end_progress()
|
||||
|
||||
def year_glance(self, year):
|
||||
"""
|
||||
@ -900,8 +902,8 @@ class WebCalReport(Report):
|
||||
nr_up = 1 # Number of directory levels up to get to root
|
||||
|
||||
# generate progress pass for "Year At A Glance"
|
||||
with self._user.progress(_("Web Calendar Report"),
|
||||
_('Creating Year At A Glance calendar'), 12) as step:
|
||||
self._user.begin_progress(_("Web Calendar Report"),
|
||||
_('Creating Year At A Glance calendar'), 12)
|
||||
|
||||
of = self.create_file('fullyearlinked', str(year))
|
||||
|
||||
@ -938,7 +940,7 @@ class WebCalReport(Report):
|
||||
content += monthly_calendar
|
||||
|
||||
# increase progress bar
|
||||
step()
|
||||
self._user.step_progress()
|
||||
|
||||
# create blank line for stylesheets
|
||||
# write footer section
|
||||
@ -948,6 +950,7 @@ class WebCalReport(Report):
|
||||
# send calendar page to web output
|
||||
# and close the file
|
||||
self.XHTMLWriter(yearglance, of)
|
||||
self._user.end_progress()
|
||||
|
||||
def one_day(self, event_date, fname_date, day_list):
|
||||
"""
|
||||
@ -1080,15 +1083,16 @@ class WebCalReport(Report):
|
||||
db = self.database
|
||||
|
||||
people = db.iter_person_handles()
|
||||
with self._user.progress(_("Web Calendar Report"),
|
||||
self._user.begin_progress(_("Web Calendar Report"),
|
||||
_('Applying Filter...'),
|
||||
db.get_number_of_people()) as step:
|
||||
people = self.filter.apply(db, people, step_progress)
|
||||
db.get_number_of_people())
|
||||
people = self.filter.apply(db, people, self._user.step_progress)
|
||||
self._user.end_progress()
|
||||
|
||||
with self._user.progress(_("Web Calendar Report"),
|
||||
_("Reading database..."), len(people)) as step:
|
||||
self._user.begin_progress(_("Web Calendar Report"),
|
||||
_("Reading database..."), len(people))
|
||||
for person in map(db.get_person_from_handle, people):
|
||||
step()
|
||||
self._user.step_progress()
|
||||
|
||||
family_list = person.get_family_handle_list()
|
||||
birth_ref = person.get_birth_ref()
|
||||
@ -1186,6 +1190,7 @@ class WebCalReport(Report):
|
||||
'person' : short_name}
|
||||
|
||||
self.add_day_item(text, year, month, day, 'Anniversary')
|
||||
self._user.end_progress()
|
||||
|
||||
def write_footer(self, nr_up):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user