def get_views(self, i_start, i_end):
'''Gets a 2-tuple of the new and old views for the current viewport.
The new views are synced to the data except for the size/pos
properties.
The old views need to be removed from the layout, and the new views
added.
'''
current_views = self.views
visible_views = {}
new_views = []
dirty_views = self.dirty_views
get_view = self.get_view
make_view_dirty = self.make_view_dirty
# iterate though the visible view
# add them into the container if not already done
for index in range(i_start, i_end + 1):
view = get_view(index)
if not view:
continue
visible_views[index] = view
current_views.pop(index, None)
new_views.append((view, index))
# put all the hidden view as dirty views
for index, view in current_views.items():
make_view_dirty(view, index)
# save the current visible views
self.views = visible_views
return new_views, current_views.values()
评论列表
文章目录