Use new event store when displaying calendar

This is faster because the event store is not yet connected to the calendar so
it does not trigger an update each time an event is added.

issue8875
review264841002
This commit is contained in:
Cédric Krier committed 2020-02-29 23:27:02 +01:00
1 parent b11b970b07
commit 6855f5295d
1 file changed
+3 -6
@@ -88,11 +88,7 @@ class Calendar_(goocalendar.Calendar):
if date: # select the day of the current record
self.select(date)
if self._event_store:
self._event_store.clear()
else:
event_store = goocalendar.EventStore()
self.event_store = event_store
event_store = goocalendar.EventStore()
for record in group:
if not record[dtstart].get(record):
@@ -120,6 +116,7 @@ class Calendar_(goocalendar.Calendar):
event = goocalendar.Event(label, start, end, text_color=text_color,
bg_color=bg_color, all_day=all_day)
event.record = record
self._event_store.add(event)
event_store.add(event)
self.event_store = event_store
self.grab_focus(self.get_root_item())