def get_example_model(): return DateModel( special_days={ "public-holidays": [datetime.date(2020, 1, 1)], "weekends": [datetime.date(2020, 1, 12)], }, styles_mapping={ "public-holidays": CellFormat(bgcolor=(255, 0, 0)), "weekends": CellFormat(bold=True), }, )
def _textformat_to_cellformat(textformat): """ Convert QTextCharFormat to a CellFormat """ bg_brush = textformat.background() fg_brush = textformat.foreground() return CellFormat( italics=textformat.fontItalic(), underline=textformat.fontUnderline(), bold=textformat.fontWeight() == QtGui.QFont.Bold, bgcolor=_brush_to_color(bg_brush), fgcolor=_brush_to_color(fg_brush), )
def multi_select_selected_color_view(): view = View( Item( name="dates", style="custom", editor=DateEditor( multi_select=True, selected_style=CellFormat(bold=True, bgcolor=(128, 10, 0)), ), )) return view