diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index beb8cbcb5b..c170f22ad2 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -575,3 +575,8 @@ allow_template_database_functions_in_composites = False # for https://whatever URLs. %u is replaced by the URL to be opened. The scheme # takes a glob pattern allowing a single entry to match multiple URL types. openers_by_scheme = {} + +#: Set the first day of the week for calendar popups +# It must be one of the values Default, Sunday, Monday, Tuesday, Wednesday, +# Thursday, Friday, or Saturday, all in English, spelled exactly as shown. +calendar_start_day_of_week = 'Default' diff --git a/src/calibre/gui2/widgets2.py b/src/calibre/gui2/widgets2.py index 5e1e589fc7..6040479314 100644 --- a/src/calibre/gui2/widgets2.py +++ b/src/calibre/gui2/widgets2.py @@ -707,6 +707,12 @@ class DateTimeEdit(QDateTimeEdit): self.setMinimumDateTime(UNDEFINED_QDATETIME) self.setCalendarPopup(True) self.cw = CalendarWidget(self) + if tweaks['calendar_start_day_of_week'] != 'Default': + try: + dow = Qt.DayOfWeek[tweaks['calendar_start_day_of_week']] + self.cw.setFirstDayOfWeek(dow) + except Exception: + print(f"Bad value for tweak calendar_start_day_of_week: {tweaks['calendar_start_day_of_week']}") self.cw.setVerticalHeaderFormat(QCalendarWidget.VerticalHeaderFormat.NoVerticalHeader) self.setCalendarWidget(self.cw) self.setSpecialValueText(_('Undefined'))