Ejemplo n.º 1
0
    def _status_input(self):
        issue_statuses = data.issue_statuses(self.project)
        items = tuple(((urwid.AttrSpec("h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))), "default"),
                        s.get("name", "")), s.get("id", None)) for s in issue_statuses.values())
        selected = self.issue.get("status", None) or self.project.get("default_issue_status", None)

        self._status_combo = generic.ComboBox(items, selected_value=selected, style="cyan")

        colum_items = [(17, urwid.Padding(generic.ListText("Status", align="right"), right=4))]
        colum_items.append(self._status_combo)
        return urwid.Columns(colum_items)
Ejemplo n.º 2
0
    def _statuses_input(self):
        issue_statuses = data.issue_statuses(self.project)
        max_length = max([len(s["name"]) for s in issue_statuses.values()])
        selected_filters = self._filters.get("status", set())

        self._issue_statuses_group = []
        for id, item in issue_statuses.items():
            state = id in selected_filters

            color = utils.color_to_hex(data.color(item))
            attr = urwid.AttrSpec("h{0}".format(color), "default")

            self._issue_statuses_group.append(urwid.CheckBox((attr, item["name"]), state, False,
                                                             self._handle_filter_change, ("status", id)))

        colum_items = [(16, urwid.Padding(generic.ListText("Statuses", align="right"), right=2))]
        colum_items.append(generic.Grid(self._issue_statuses_group, 4 + max_length, 3, 0, "left"))
        return urwid.Columns(colum_items)
Ejemplo n.º 3
0
    def _status_input(self):
        issue_statuses = data.issue_statuses(self.project)
        items = tuple(((urwid.AttrSpec(
            "h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))),
            "default"), s.get("name", "")), s.get("id", None))
                      for s in issue_statuses.values())
        selected = self.issue.get("status", None) or self.project.get(
            "default_issue_status", None)

        self._status_combo = generic.ComboBox(items,
                                              selected_value=selected,
                                              style="cyan")

        colum_items = [(17,
                        urwid.Padding(generic.ListText("Status",
                                                       align="right"),
                                      right=4))]
        colum_items.append(self._status_combo)
        return urwid.Columns(colum_items)
Ejemplo n.º 4
0
    def __init__(self, issue, project, on_status_change=None, on_priority_change=None, on_severity_change=None,
                 on_assigned_to_change=None):
        self.issue = issue

        issue_ref_and_name = "#{0: <4} {1}".format(str(data.issue_ref(issue)), data.issue_subject(issue))

        colum_items = [("weight", 0.5, generic.ListText(issue_ref_and_name, align="left"))]

        issue_statuses = data.issue_statuses(project)
        items = tuple(((urwid.AttrSpec("h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))), "default"),
                        s.get("name", "")), s.get("id", None)) for s in issue_statuses.values())
        selected = issue.get("status", None) or project.get("default_issue_status", None)
        status_combo = generic.ComboBox(items, selected_value=selected, style="cyan", enable_markup=True,
                                        on_state_change=on_status_change, user_data=issue)
        colum_items.append(("weight", 0.1, status_combo))

        issue_priorities = data.priorities(project)
        items = tuple(((urwid.AttrSpec("h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))), "default"),
                        s.get("name", "")), s.get("id", None)) for s in issue_priorities.values())
        selected = issue.get("priority", None) or project.get("default_priority", None)
        priority_combo = generic.ComboBox(items, selected_value=selected, style="cyan", enable_markup=True,
                                        on_state_change=on_priority_change, user_data=issue)
        colum_items.append(("weight", 0.1, priority_combo))

        issue_severities = data.severities(project)
        items = tuple(((urwid.AttrSpec("h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))), "default"),
                        s.get("name", "")), s.get("id", None)) for s in issue_severities.values())
        selected = issue.get("severity", None) or project.get("default_severity", None)
        severity_combo = generic.ComboBox(items, selected_value=selected, style="cyan", enable_markup=True,
                                        on_state_change=on_severity_change, user_data=issue)
        colum_items.append(("weight", 0.1, severity_combo))

        memberships = [{"user": None, "full_name": "Unassigned"}] + list(data.active_memberships(project).values())
        items = tuple(((urwid.AttrSpec("h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))), "default"),
                        s.get("full_name", "")), s.get("user", None)) for s in memberships)
        selected = issue.get("assigned_to", None)
        assigned_to_combo = generic.ComboBox(items, selected_value=selected, style="cyan", enable_markup=True,
                                        on_state_change=on_assigned_to_change, user_data=issue)
        colum_items.append(("weight", 0.15, assigned_to_combo))

        self.widget = urwid.Columns(colum_items)
        super().__init__(urwid.AttrMap(self.widget, "default", "focus"))
Ejemplo n.º 5
0
    def _statuses_input(self):
        issue_statuses = data.issue_statuses(self.project)
        max_length = max([len(s["name"]) for s in issue_statuses.values()])
        selected_filters = self._filters.get("status", set())

        self._issue_statuses_group = []
        for id, item in issue_statuses.items():
            state = id in selected_filters

            color = utils.color_to_hex(data.color(item))
            attr = urwid.AttrSpec("h{0}".format(color), "default")

            self._issue_statuses_group.append(
                urwid.CheckBox((attr, item["name"]), state, False,
                               self._handle_filter_change, ("status", id)))

        colum_items = [(16,
                        urwid.Padding(generic.ListText("Statuses",
                                                       align="right"),
                                      right=2))]
        colum_items.append(
            generic.Grid(self._issue_statuses_group, 4 + max_length, 3, 0,
                         "left"))
        return urwid.Columns(colum_items)
Ejemplo n.º 6
0
    def __init__(self,
                 issue,
                 project,
                 on_status_change=None,
                 on_priority_change=None,
                 on_severity_change=None,
                 on_assigned_to_change=None):
        self.issue = issue

        issue_ref_and_name = "#{0: <4} {1}".format(str(data.issue_ref(issue)),
                                                   data.issue_subject(issue))

        colum_items = [("weight", 0.5,
                        generic.ListText(issue_ref_and_name, align="left"))]

        issue_statuses = data.issue_statuses(project)
        items = tuple(((urwid.AttrSpec(
            "h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))),
            "default"), s.get("name", "")), s.get("id", None))
                      for s in issue_statuses.values())
        selected = issue.get("status", None) or project.get(
            "default_issue_status", None)
        status_combo = generic.ComboBox(items,
                                        selected_value=selected,
                                        style="cyan",
                                        enable_markup=True,
                                        on_state_change=on_status_change,
                                        user_data=issue)
        colum_items.append(("weight", 0.1, status_combo))

        issue_priorities = data.priorities(project)
        items = tuple(((urwid.AttrSpec(
            "h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))),
            "default"), s.get("name", "")), s.get("id", None))
                      for s in issue_priorities.values())
        selected = issue.get("priority", None) or project.get(
            "default_priority", None)
        priority_combo = generic.ComboBox(items,
                                          selected_value=selected,
                                          style="cyan",
                                          enable_markup=True,
                                          on_state_change=on_priority_change,
                                          user_data=issue)
        colum_items.append(("weight", 0.1, priority_combo))

        issue_severities = data.severities(project)
        items = tuple(((urwid.AttrSpec(
            "h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))),
            "default"), s.get("name", "")), s.get("id", None))
                      for s in issue_severities.values())
        selected = issue.get("severity", None) or project.get(
            "default_severity", None)
        severity_combo = generic.ComboBox(items,
                                          selected_value=selected,
                                          style="cyan",
                                          enable_markup=True,
                                          on_state_change=on_severity_change,
                                          user_data=issue)
        colum_items.append(("weight", 0.1, severity_combo))

        memberships = [{
            "user": None,
            "full_name": "Unassigned"
        }] + list(data.active_memberships(project).values())
        items = tuple(((urwid.AttrSpec(
            "h{0}".format(utils.color_to_hex(s.get("color", "#ffffff"))),
            "default"), s.get("full_name", "")), s.get("user", None))
                      for s in memberships)
        selected = issue.get("assigned_to", None)
        assigned_to_combo = generic.ComboBox(
            items,
            selected_value=selected,
            style="cyan",
            enable_markup=True,
            on_state_change=on_assigned_to_change,
            user_data=issue)
        colum_items.append(("weight", 0.15, assigned_to_combo))

        self.widget = urwid.Columns(colum_items)
        super().__init__(urwid.AttrMap(self.widget, "default", "focus"))