Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def refresh_titles(self):
"""refresh the titles of all events"""
for uevent in self.body[1:]:
if isinstance(uevent._original_widget, U_Event):
uevent.original_widget.set_title()
def _search(self, search_term):
"""search for events matching `search_term"""
self.window.backtrack()
events = sorted(self.collection.search(search_term))
event_list = []
event_list.extend([
urwid.AttrMap(
U_Event(event, relative=False, conf=self._conf, delete_status=self.delete_status),
'calendar ' + event.calendar, 'reveal focus')
for event in events])
events = EventListBox(
urwid.SimpleFocusListWalker(event_list), parent=self.eventscolumn, conf=self._conf,
delete_status=self.delete_status,
toggle_delete_all=self.toggle_delete_all,
toggle_delete_instance=self.toggle_delete_instance
)
events = EventColumn(pane=self, elistbox=events)
ContainerWidget = linebox[self._conf['view']['frame']]
columns = NColumns(
[(self.lwidth, self.calendar), ContainerWidget(events)],
dividechars=0,
box_columns=[0, 0],
outermost=True,
)
def _search(self, search_term):
"""search for events matching `search_term"""
self.window.backtrack()
events = sorted(self.collection.search(search_term))
event_list = []
event_list.extend([
urwid.AttrMap(
U_Event(event, relative=False, conf=self._conf, delete_status=self.delete_status),
'calendar ' + event.calendar, 'reveal focus')
for event in events])
events = EventListBox(
urwid.SimpleFocusListWalker(event_list), parent=self.eventscolumn, conf=self._conf,
delete_status=self.delete_status,
toggle_delete_all=self.toggle_delete_all,
toggle_delete_instance=self.toggle_delete_instance
)
events = EventColumn(pane=self, elistbox=events)
ContainerWidget = linebox[self._conf['view']['frame']]
columns = NColumns(
[(self.lwidth, self.calendar), ContainerWidget(events)],
dividechars=0,
box_columns=[0, 0],
outermost=True,
)
def _get_events(self, day):
"""get all events on day, return a DateListBox of `U_Event()`s
:type day: datetime.date
"""
event_list = list()
date_header = DateHeader(
day=day,
dateformat=self._conf['locale']['longdateformat'],
conf=self._conf,
)
event_list.append(urwid.AttrMap(date_header, 'date'))
self.events = sorted(self._collection.get_events_on(day))
event_list.extend([
urwid.AttrMap(
U_Event(event, conf=self._conf, this_date=day, delete_status=self.delete_status),
'calendar ' + event.calendar, 'reveal focus')
for event in self.events])
return urwid.BoxAdapter(
DateListBox(urwid.SimpleFocusListWalker(event_list), date=day),
(len(event_list) + 1) if self.events else 1
)
def _get_events(self, day):
"""get all events on day, return a DateListBox of `U_Event()`s
:type day: datetime.date
"""
event_list = list()
date_header = DateHeader(
day=day,
dateformat=self._conf['locale']['longdateformat'],
conf=self._conf,
)
event_list.append(urwid.AttrMap(date_header, 'date'))
self.events = sorted(self._collection.get_events_on(day))
event_list.extend([
urwid.AttrMap(
U_Event(event, conf=self._conf, this_date=day, delete_status=self.delete_status),
'calendar ' + event.calendar, 'reveal focus')
for event in self.events])
return urwid.BoxAdapter(
DateListBox(urwid.SimpleFocusListWalker(event_list), date=day),
(len(event_list) + 1) if self.events else 1
)
def refresh_titles(self):
"""refresh the titles of all events"""
for uevent in self.body[1:]:
if isinstance(uevent._original_widget, U_Event):
uevent.original_widget.set_title()