def custom_view_allow_no_range(): """DateRangeEditor with allow_no_selection set to True.""" view = View( Item( name="date_range", style="custom", editor=DateRangeEditor(allow_no_selection=True), )) return view
def default_custom_view(): """ Default view of DateRangeEditor """ view = View( Item( name='date_range', style="custom", editor=DateRangeEditor(), ) ) return view
class DateRangeEditorDemo(HasTraits): """ Demo class to show DateRangeEditor. """ date_range = Tuple(Date, Date) traits_view = View(Group(Item('date_range', editor=DateRangeEditor(), style='custom', label='Date range'), label='Date range'), resizable=True) def _date_range_changed(self): print(self.date_range)
def test_date_range_multi_select_is_constant(self): with self.assertRaises(TraitError): DateRangeEditor(multi_select=False)