Calendar

../_images/calendar-preview.png

Widget description

This is a calendar widget.

It helps applications to flexibly display a calender with day of the week, date, year and month. Applications are able to set specific dates to be reported back, when selected, in the smart callbacks of the calendar widget. The API of this widget lets the applications perform other functions, like:

  • placing marks on specific dates

  • setting the bounds for the calendar (minimum and maximum years)

  • setting the day names of the week (e.g. “Thu” or “Thursday”)

  • setting the year and month format.

Emitted signals

  • changed - emitted when the date in the calendar is changed.

  • display,changed - emitted when the current month displayed in the calendar is changed.

Enumerations

Calendar mark repeat types

efl.elementary.ELM_CALENDAR_UNIQUE

Default value.

Marks will be displayed only on event day.

efl.elementary.ELM_CALENDAR_DAILY

Marks will be displayed every day after event day (inclusive).

efl.elementary.ELM_CALENDAR_WEEKLY

Marks will be displayed every week after event day (inclusive) - i.e. each seven days.

efl.elementary.ELM_CALENDAR_MONTHLY

Marks will be displayed every month day that coincides to event day.

E.g.: if an event is set to 30th Jan, no marks will be displayed on Feb, but will be displayed on 30th Mar

efl.elementary.ELM_CALENDAR_ANNUALLY

Marks will be displayed every year that coincides to event day (and month).

E.g. an event added to 30th Jan 2012 will be repeated on 30th Jan 2013.

efl.elementary.ELM_CALENDAR_LAST_DAY_OF_MONTH

Marks will be displayed every last day of month after event day (inclusive).

efl.elementary.ELM_CALENDAR_REVERSE_DAILY

Marks will be displayed every day before event day.

New in version 1.19.

Calendar selection modes

efl.elementary.ELM_CALENDAR_SELECT_MODE_DEFAULT

Default mode

efl.elementary.ELM_CALENDAR_SELECT_MODE_ALWAYS

Select always

efl.elementary.ELM_CALENDAR_SELECT_MODE_NONE

Don’t select

efl.elementary.ELM_CALENDAR_SELECT_MODE_ONDEMAND

Select on demand

Selectable

efl.elementary.ELM_CALENDAR_SELECTABLE_NONE

None selectable

efl.elementary.ELM_CALENDAR_SELECTABLE_YEAR

Year is selectable

efl.elementary.ELM_CALENDAR_SELECTABLE_MONTH

Month is selectable

efl.elementary.ELM_CALENDAR_SELECTABLE_DAY

Day is selectable

Days

efl.elementary.ELM_DAY_SUNDAY

Sunday

efl.elementary.ELM_DAY_MONDAY

Monday

efl.elementary.ELM_DAY_TUESDAY

Tuesday

efl.elementary.ELM_DAY_WEDNESDAY

Wednesday

efl.elementary.ELM_DAY_THURSDAY

Thursday

efl.elementary.ELM_DAY_FRIDAY

Friday

efl.elementary.ELM_DAY_SATURDAY

Saturday

Inheritance diagram

class efl.elementary.Calendar(Object parent, *args, **kwargs)
Parameters
  • parent (efl.evas.Object) – The parent object

  • **kwargs – All the remaining keyword arguments are interpreted as properties of the instance

class efl.elementary.CalendarMark(Object cal, mark_type, mark_time, Elm_Calendar_Mark_Repeat_Type repeat)

A mark that will be drawn in the calendar respecting the insertion time and periodicity. It will emit the type as signal to the widget theme. Default theme supports “holiday” and “checked”, but it can be extended.

Instantiating it won’t immediately update the calendar, drawing the marks. For this, call Calendar.marks_draw(). However, when user selects next or previous month calendar forces marks drawn.

Marks created with this method can be deleted with delete().

Example:

from datetime import date, timedelta

cal = Calendar(win)

selected_time = date.today() + timedelta(5)
cal.mark_add("holiday", selected_time, ELM_CALENDAR_ANNUALLY)

selected_time = date.today() + timedelta(1)
cal.mark_add("checked", selected_time, ELM_CALENDAR_UNIQUE)

cal.marks_draw()
Parameters
  • parent (efl.evas.Object) – The parent object

  • mark_type (string) – A string used to define the type of mark. It will be emitted to the theme, that should display a related modification on these days representation.

  • mark_time (datetime.date) – A date object to represent the date of inclusion of the mark. For marks that repeats it will just be displayed after the inclusion date in the calendar.

  • repeat (Calendar mark repeat types) – Repeat the event following this periodicity. Can be a unique mark (that don’t repeat), daily, weekly, monthly or annually.

Returns

The created mark or None upon failure.

Return type

CalendarMark