import gtk
import pango
import gobject
+import itertools
from FukuiNoNamariExt import thread_view_extend
selection_start, selection_end = self._get_selection_start_end()
-
top_layout = self.get_layout_on_y(view_y)
- index = 0
- if top_layout:
- index = top_layout.list_index
- while index < len(self.res_layout_list):
- layout = self.res_layout_list[index]
- w, h = layout.get_pixel_size()
- layout_top = layout.posY
- layout_bottom = layout.posY + h
- area_top = view_y + area.y
- area_bottom = view_y + area.y + area.height
- if layout_top <= area_bottom and layout_bottom >= area_top:
- layout.draw(self.drawingarea,
- 0, layout.posY - int(view_y),
- selection_start, selection_end)
- if layout_top > area_bottom:
- break
-
- index += 1
+ if top_layout is None:
+ return
+ #area_top = view_y + area.y
+ area_bottom = view_y + area.y + area.height
+
+ iter = range(top_layout.list_index, len(self.res_layout_list))
+ iter = itertools.imap(lambda index: self.res_layout_list[index], iter)
+ iter = itertools.takewhile(lambda lay: lay.posY <= area_bottom, iter)
+ for layout in iter:
+ layout.draw(self.drawingarea, 0, layout.posY - int(view_y),
+ selection_start, selection_end)
def transform_coordinate_gdk_to_adj(self, y):
return y + self.vscrollbar.get_value()