9127 : Geography : performance issue when selecting the events or places views.

This commit is contained in:
SNoiraud 2015-12-23 11:10:27 +01:00
parent ab67c786b0
commit 0ff9363d72
2 changed files with 23 additions and 17 deletions

View File

@ -133,6 +133,7 @@ class GeoEvents(GeoGraphyView):
self.generic_filter = None
self.additional_uis.append(self.additional_ui())
self.no_show_places_in_status_bar = False
self.show_all = False
def get_title(self):
"""
@ -178,6 +179,7 @@ class GeoEvents(GeoGraphyView):
"""
Ask to show all events.
"""
self.show_all = True
self._createmap(None)
def build_tree(self):
@ -283,18 +285,18 @@ class GeoEvents(GeoGraphyView):
self.cal = config.get('preferences.calendar-format-report')
self.no_show_places_in_status_bar = False
if self.generic_filter:
events_list = self.generic_filter.apply(dbstate.db)
for event_handle in events_list:
event = dbstate.db.get_event_from_handle(event_handle)
self._createmap_for_one_event(event)
else:
if obj is None:
if self.show_all:
self.show_all = False
events_handle = dbstate.db.get_event_handles()
for event_hdl in events_handle:
event = dbstate.db.get_event_from_handle(event_hdl)
self._createmap_for_one_event(event)
else:
elif self.generic_filter:
events_list = self.generic_filter.apply(dbstate.db)
for event_handle in events_list:
event = dbstate.db.get_event_from_handle(event_handle)
self._createmap_for_one_event(event)
elif obj:
event = dbstate.db.get_event_from_handle(obj)
self._createmap_for_one_event(event)
self.sort = sorted(self.place_list,

View File

@ -133,6 +133,7 @@ class GeoPlaces(GeoGraphyView):
self.generic_filter = None
self.additional_uis.append(self.additional_ui())
self.no_show_places_in_status_bar = False
self.show_all = False
def get_title(self):
"""
@ -178,6 +179,7 @@ class GeoPlaces(GeoGraphyView):
"""
Ask to show all places.
"""
self.show_all = True
self._createmap(None)
def build_tree(self):
@ -256,12 +258,8 @@ class GeoPlaces(GeoGraphyView):
# 65598 places : createmap : 08'48"; create_markers : 0'01"; draw markers : 0'07"
_LOG.debug("%s" % time.strftime("start createmap : "
"%a %d %b %Y %H:%M:%S", time.gmtime()))
if self.generic_filter:
place_list = self.generic_filter.apply(dbstate.db)
for place_handle in place_list:
place = dbstate.db.get_place_from_handle(place_handle)
self._create_one_place(place)
else:
if self.show_all:
self.show_all = False
try:
places_handle = dbstate.db.get_place_handles()
except:
@ -269,8 +267,14 @@ class GeoPlaces(GeoGraphyView):
for place_hdl in places_handle:
place = dbstate.db.get_place_from_handle(place_hdl)
self._create_one_place(place)
if place_x:
elif self.generic_filter:
place_list = self.generic_filter.apply(dbstate.db)
for place_handle in place_list:
place = dbstate.db.get_place_from_handle(place_handle)
self._create_one_place(place)
elif place_x:
place = dbstate.db.get_place_from_handle(place_x)
self._create_one_place(place)
if ( place.get_latitude() != "" and place.get_longitude() != "" ):
self.osm.set_center_and_zoom(float(place.get_latitude()),
float(place.get_longitude()),