1234567891011121314151617181920212223242526272829303132333435363738394041 |
- from widgets import *
- import section_profile_editor
- import timetable_calendar
- _calendar: ReactiveCalendarWidget
- def _on_selection_changed(calendar: ReactiveCalendarWidget) -> None:
- selected_date = calendar.selectedDate()
- profile_id = timetable_calendar.get_profile_id(selected_date)
- section_profile_editor.update(profile_id, selected_date)
-
- def update() -> None:
- global _calendar
- _on_selection_changed(_calendar)
- _calendar.updateCells()
- def create() -> QWidget:
- global _calendar
- frame = SectionFrame()
- _calendar = ReactiveCalendarWidget()
- _calendar.setGridVisible(True)
- _calendar.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
- _calendar.setSelectionMode(QCalendarWidget.SelectionMode.SingleSelection)
- _calendar.setVerticalHeaderFormat(QCalendarWidget.VerticalHeaderFormat.NoVerticalHeader)
- _calendar.selectionChanged.connect(lambda: _on_selection_changed(_calendar))
- # Это спровоцирует отображения редактора профилей
- update()
-
- layout = QHBoxLayout(frame)
- layout.setContentsMargins(0, 0, 0, 0)
- layout.addWidget(_calendar)
- return frame
|