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:
changed
- emitted when the date in the calendar is changed.display,changed
- emitted when the current month displayed in the
calendar is changed.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_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
efl.elementary.
Calendar
(Object parent, *args, **kwargs)¶Bases: efl.elementary.__init__.LayoutClass
Parameters: |
|
---|
callback_changed_add
(func, *args, **kwargs)¶Emitted when the date in the calendar is changed.
callback_changed_del
(func)¶callback_display_changed_add
(func, *args, **kwargs)¶Emitted when the current month displayed in the calendar is changed.
displayed_time
¶Get the current time displayed in the widget
Type: | datetime.date |
---|
New in version 1.8.
first_day_of_week
¶The first day of week to use on the calendar widget.
Type: | int |
---|
interval
¶Set the interval on time updates for an user mouse button hold on calendar widgets’ month selection.
This interval value is decreased while the user holds the mouse pointer either selecting next or previous month.
This helps the user to get to a given month distant from the current one easier/faster, as it will start to change quicker and quicker on mouse button holds.
The calculation for the next change interval value, starting from the one set with this call, is the previous interval divided by 1.05, so it decreases a little bit.
The default starting interval value for automatic changes is 0.85 seconds.
Type: | float |
---|
mark_add
(mark_type, mark_time, repeat)¶A constructor for a CalendarMark
.
Parameters: |
|
---|---|
Returns: | The created mark or |
Return type: |
marks
¶Calendar marks.
Type: | list of CalendarMark |
---|
marks_draw
()¶Draw calendar marks.
Should be used after adding, removing or clearing marks. It will go through the entire marks list updating the calendar. If lots of marks will be added, add all the marks and then call this function.
When the month is changed, i.e. user selects next or previous month, marks will be drawn.
Seealso: | CalendarMark |
---|
min_max_year
¶The minimum and maximum values for the year
Maximum must be greater than minimum, except if you don’t want to set maximum year. Default values are 1902 and -1.
If the maximum year is a negative value, it will be limited depending on the platform architecture (year 2037 for 32 bits)
Type: | (int min, int max) |
---|
select_mode
¶The day selection mode used.
Type: | Calendar selection modes |
---|
selectable
¶How selected_time manages a date
Type: | Selectable |
---|
New in version 1.8.
selected_time
¶Selected date on the calendar.
Setting this changes the displayed month if needed. Selected date changes when the user goes to next/previous month or select a day pressing over it on calendar.
Type: | datetime.date |
---|
Changed in version 1.8: Returns None when the selected date cannot be fetched.
weekdays_names
¶The weekdays’ names to be displayed by the calendar.
By default, weekdays abbreviations get from system are displayed: E.g. for an en_US locale: “Sun, Mon, Tue, Wed, Thu, Fri, Sat”
The first string should be related to Sunday, the second to Monday...
The usage should be like this:
weekdays =
(
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
)
calendar.weekdays_names = weekdays
Type: | tuple of strings |
---|
Warning
It must have 7 elements, or it will access invalid memory.
efl.elementary.
CalendarMark
(Object cal, mark_type, mark_time, Elm_Calendar_Mark_Repeat_Type repeat)¶Bases: object
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: |
|
---|---|
Returns: | The created mark or |
Return type: |
delete
()¶Delete a mark from the calendar.
If deleting all calendar marks is required, del
Calendar.marks
should be used instead of getting marks list
and deleting each one.
See also
Parameters: | mark (CalendarMark ) – The mark to be deleted. |
---|