# HG changeset patch # User Paul Boddie # Date 1425936923 -3600 # Node ID 15fe57c7fbc15b4c8548226226da4a846939f90d # Parent 06cb68286ae6144f32e67490e929c548b582f45b Added docstrings. diff -r 06cb68286ae6 -r 15fe57c7fbc1 imip_manager.py --- a/imip_manager.py Mon Mar 09 22:28:10 2015 +0100 +++ b/imip_manager.py Mon Mar 09 22:35:23 2015 +0100 @@ -1812,6 +1812,14 @@ page.span(self.format_time(endpoint or get_end_of_day(point, tzid), "long"), class_="endpoint") def _slot_selector(self, value, identifier, slots): + + """ + Provide a timeslot control having the given 'value', employing the + indicated HTML 'identifier', and using the given 'slots' collection + to select any control whose 'value' is in this collection, unless the + "reset" request parameter has been asserted. + """ + reset = self.env.get_args().has_key("reset") page = self.page if not reset and value in slots: @@ -1820,21 +1828,40 @@ page.input(name="slot", type="checkbox", value=value, id=identifier, class_="newevent selector") def _empty_slot(self, point, endpoint): + + "Show an empty slot label for the given 'point' and 'endpoint'." + page = self.page value, identifier = self._slot_value_and_identifier(point, endpoint) page.label("Select/deselect period", class_="newevent popup", for_=identifier) def _day_value_and_identifier(self, day): + + "Return a day value and HTML identifier for the given 'day'." + value = "%s-" % format_datetime(day) identifier = "day-%s" % value return value, identifier def _slot_value_and_identifier(self, point, endpoint): + + """ + Return a slot value and HTML identifier for the given 'point' and + 'endpoint'. + """ + value = "%s-%s" % (format_datetime(point), endpoint and format_datetime(endpoint) or "") identifier = "slot-%s" % value return value, identifier def _show_menu(self, name, default, items, class_=""): + + """ + Show a select menu having the given 'name', set to the given 'default', + providing the given (value, label) 'items', and employing the given CSS + 'class_' if specified. + """ + page = self.page values = self.env.get_args().get(name, [default]) page.select(name=name, class_=class_)