From 042c12775688b7bab609fa44167ddf1df289631d Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Thu, 29 Mar 2012 16:04:33 +0200 Subject: [PATCH] indexlib: add page_number to IndexItem The multi-page renderer needs to know on which page each IndexItem has been found. Therefore, we introduce a new page_number field in the IndexItem class. This field remains to None for the single page renderers, and is used to store an integer by the multi-page renderer. Signed-off-by: Thomas Petazzoni --- ocitysmap2/indexlib/commons.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ocitysmap2/indexlib/commons.py b/ocitysmap2/indexlib/commons.py index 6bbc88c..5a762f6 100644 --- a/ocitysmap2/indexlib/commons.py +++ b/ocitysmap2/indexlib/commons.py @@ -104,6 +104,7 @@ class IndexItem: endpoint1 = None # coords.Point endpoint2 = None # coords.Point location_str = None # str or None + page_number = None # integer or None. Only used by multi-page renderer. def __init__(self, label, endpoint1, endpoint2): assert label is not None @@ -111,14 +112,15 @@ class IndexItem: self.endpoint1 = endpoint1 self.endpoint2 = endpoint2 self.location_str = None + self.page_number = None def __str__(self): return '%s...%s' % (self.label, self.location_str) def __repr__(self): - return ('IndexItem(%s, %s, %s, %s)' + return ('IndexItem(%s, %s, %s, %s, %s)' % (repr(self.label), self.endpoint1, self.endpoint2, - repr(self.location_str))) + repr(self.location_str), repr(self.page_number))) def draw(self, rtl, ctx, pc, layout, fascent, fheight, baseline_x, baseline_y):