def _assigned_to_input(self): members = [{ "user": "******", "full_name": "Unassigned" }] + list(data.active_memberships(self.project).values()) max_length = max([len(data.user_full_name(s)) for s in members]) selected_filters = self._filters.get("assigned_to", set()) self._assigned_to_group = [] for item in members: state = item["user"] in selected_filters color = utils.color_to_hex(data.color(item)) attr = urwid.AttrSpec("h{0}".format(color), "default") self._assigned_to_group.append( urwid.CheckBox((attr, data.user_full_name(item)), state, False, self._handle_filter_change, ("assigned_to", item["user"]))) colum_items = [(16, urwid.Padding(generic.ListText("Assigned To", align="right"), right=2))] colum_items.append( generic.Grid(self._assigned_to_group, 4 + max_length, 3, 0, "left")) return urwid.Columns(colum_items)
def _created_by_input(self): members = data.active_memberships(self.project) max_length = max([len(data.user_full_name(s)) for s in members.values()]) selected_filters = self._filters.get("owner", set()) self._created_by_group = [] for id, item in members.items(): state = id in selected_filters color = utils.color_to_hex(data.color(item)) attr = urwid.AttrSpec("h{0}".format(color), "default") self._created_by_group.append(urwid.CheckBox((attr, data.user_full_name(item)), state, False, self._handle_filter_change, ("owner", id))) colum_items = [(16, urwid.Padding(generic.ListText("Created By", align="right"), right=2))] colum_items.append(generic.Grid(self._created_by_group, 4 + max_length, 3, 0, "left")) return urwid.Columns(colum_items)
def _severities_input(self): severities = data.severities(self.project) max_length = max([len(s["name"]) for s in severities.values()]) selected_filters = self._filters.get("severity", set()) self._severities_group = [] for id, item in severities.items(): state = id in selected_filters color = utils.color_to_hex(data.color(item)) attr = urwid.AttrSpec("h{0}".format(color), "default") self._severities_group.append(urwid.CheckBox((attr, item["name"]), state, False, self._handle_filter_change, ("severity", id))) colum_items = [(16, urwid.Padding(generic.ListText("Severities", align="right"), right=2))] colum_items.append(generic.Grid(self._severities_group, 4 + max_length, 3, 0, "left")) return urwid.Columns(colum_items)
def _assigned_to_input(self): members = [{"user": "******", "full_name": "Unassigned"}] + list(data.active_memberships(self.project).values()) max_length = max([len(data.user_full_name(s)) for s in members]) selected_filters = self._filters.get("assigned_to", set()) self._assigned_to_group = [] for item in members: state = item["user"] in selected_filters color = utils.color_to_hex(data.color(item)) attr = urwid.AttrSpec("h{0}".format(color), "default") self._assigned_to_group.append(urwid.CheckBox((attr, data.user_full_name(item)), state, False, self._handle_filter_change, ("assigned_to", item["user"]))) colum_items = [(16, urwid.Padding(generic.ListText("Assigned To", align="right"), right=2))] colum_items.append(generic.Grid(self._assigned_to_group, 4 + max_length, 3, 0, "left")) return urwid.Columns(colum_items)
def _severities_input(self): severities = data.severities(self.project) max_length = max([len(s["name"]) for s in severities.values()]) selected_filters = self._filters.get("severity", set()) self._severities_group = [] for id, item in severities.items(): state = id in selected_filters color = utils.color_to_hex(data.color(item)) attr = urwid.AttrSpec("h{0}".format(color), "default") self._severities_group.append( urwid.CheckBox((attr, item["name"]), state, False, self._handle_filter_change, ("severity", id))) colum_items = [(16, urwid.Padding(generic.ListText("Severities", align="right"), right=2))] colum_items.append( generic.Grid(self._severities_group, 4 + max_length, 3, 0, "left")) return urwid.Columns(colum_items)
def _created_by_input(self): members = data.active_memberships(self.project) max_length = max( [len(data.user_full_name(s)) for s in members.values()]) selected_filters = self._filters.get("owner", set()) self._created_by_group = [] for id, item in members.items(): state = id in selected_filters color = utils.color_to_hex(data.color(item)) attr = urwid.AttrSpec("h{0}".format(color), "default") self._created_by_group.append( urwid.CheckBox((attr, data.user_full_name(item)), state, False, self._handle_filter_change, ("owner", id))) colum_items = [(16, urwid.Padding(generic.ListText("Created By", align="right"), right=2))] colum_items.append( generic.Grid(self._created_by_group, 4 + max_length, 3, 0, "left")) return urwid.Columns(colum_items)