Пример #1
0
    def __init__(self, project, user_story={}):
        self.project = project
        self.user_story = user_story
        self.options = []

        contents = [
            generic.box_solid_fill(" ", 2),
            urwid.Padding(self._description(), right=2, left=2),
            generic.box_solid_fill(" ", 1),
            urwid.Padding(self._milestone_selector(), right=2, left=2),
            generic.box_solid_fill(" ", 2),
            self._buttons(),
            generic.box_solid_fill(" ", 1),
        ]
        self.widget = urwid.Pile(contents)

        title = "Move User Story #{} to a Milestone".format(data.us_ref(self.user_story))
        super().__init__(urwid.AttrMap(urwid.LineBox(urwid.Padding(self.widget, right=2, left=2),
                                                     title), "popup"))
Пример #2
0
    def __init__(self, project, user_story={}):
        self.project = project
        self.user_story = user_story
        self.options = []

        contents = [
            generic.box_solid_fill(" ", 2),
            urwid.Padding(self._description(), right=2, left=2),
            generic.box_solid_fill(" ", 1),
            urwid.Padding(self._milestone_selector(), right=2, left=2),
            generic.box_solid_fill(" ", 2),
            self._buttons(),
            generic.box_solid_fill(" ", 1),
        ]
        self.widget = urwid.Pile(contents)

        title = "Move User Story #{} to a Milestone".format(
            data.us_ref(self.user_story))
        super().__init__(
            urwid.AttrMap(
                urwid.LineBox(urwid.Padding(self.widget, right=2, left=2),
                              title), "popup"))
Пример #3
0
    def __init__(self, us, project, roles, summation=0.0, on_status_change=None, on_points_change=None):
        self.user_story = us

        colum_items = [(6, generic.ListText("#{0}".format(str(data.us_ref(us))), align="left"))]

        colum_items.append((1, urwid.AttrMap(generic.ListText("⊕" if data.us_client_requirement(us) else " ",
                                                              align="left"), "yellow", "focus")))
        colum_items.append((1, urwid.AttrMap(generic.ListText("☂" if data.us_team_requirement(us) else " ",
                                                              align="left"), "cyan", "focus")))
        colum_items.append((2, urwid.AttrMap(generic.ListText("✖" if data.us_is_blocked(us) else " ",
                                                              align="left"), "red", "focus")))

        colum_items.append(("weight", 0.5, generic.ListText(data.us_subject(us), align="left")))

        us_statuses = data.us_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 us_statuses.values())
        selected = us.get("status", None) or project.get("default_us_status", None)
        status_combo = generic.ComboBox(items, selected_value=selected, style="cyan", enable_markup=True,
                                        on_state_change=on_status_change, user_data=us)
        colum_items.append(("weight", 0.15, status_combo))

        points = data.points(project)
        items = tuple((p.get("name", ""), p.get("id", None)) for p in points.values())
        for r_id, role in roles.items():
            selected = (us.get("points", {}).get(r_id, None) or
                        project.get("default_points", None))
            points_combo = generic.ComboBox(items, selected_value=selected, style="cyan",
                                            on_state_change=on_points_change, user_data=(us, r_id))
            colum_items.append(("weight", 0.05, points_combo))

        colum_items.append(("weight", 0.05, generic.ListText(("green", "{0:.1f}".format(
                                                                        data.us_total_points(us))))))
        colum_items.append(("weight", 0.08, generic.ListText(("cyan", "{0:.1f}".format(summation)))))

        self.widget = urwid.Columns(colum_items)
        super().__init__(urwid.AttrMap(self.widget, "default", "focus"))
Пример #4
0
    def __init__(self, us, project, roles, on_status_change=None, on_points_change=None):
        self.user_story = us

        if us.get("is_closed", False):
            is_closed = urwid.AttrMap(generic.ListText("☑"), "green", "focus-header")
        else:
            is_closed = urwid.AttrMap(generic.ListText("☒"), "red", "focus-header")
        colum_items = [("weight", 0.05, is_closed)]

        us_ref_and_name = "US #{0: <4} {1}".format(str(data.us_ref(us)), data.us_subject(us))
        colum_items.append(("weight", 0.6, generic.ListText(us_ref_and_name, align="left")))

        us_statuses = data.us_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 us_statuses.values())
        selected = us.get("status", None) or project.get("default_us_status", None)
        status_combo = generic.ComboBox(items, selected_value=selected, style="cyan", enable_markup=True,
                                        on_state_change=on_status_change, user_data=us)
        colum_items.append(("weight", 0.15, status_combo))

        points = data.points(project)
        items = tuple((p.get("name", ""), p.get("id", None)) for p in points.values())
        for r_id, role in roles.items():
            role_name = generic.ListText("{}:".format(role.get("name", "UNK.")))

            selected = (us.get("points", {}).get(r_id, None) or
                        project.get("default_points", None))
            points_combo = generic.ComboBox(items, selected_value=selected, style="cyan",
                                            on_state_change=on_points_change, user_data=(us, r_id))
            colum_items.append(("weight", 0.15, urwid.Columns([('pack',role_name), points_combo])))

        colum_items.append(("weight", 0.1, generic.ListText(("green", "TOTAL: {0:.1f}".format(
                                                                      data.us_total_points(us))))))

        self.widget = urwid.Columns(colum_items)
        super().__init__(urwid.AttrMap(urwid.LineBox(urwid.AttrMap(self.widget, "cyan", "focus-header")),
                                       "green"))
Пример #5
0
    def __init__(self,
                 us,
                 project,
                 roles,
                 on_status_change=None,
                 on_points_change=None):
        self.user_story = us

        if us.get("is_closed", False):
            is_closed = urwid.AttrMap(generic.ListText("☑"), "green",
                                      "focus-header")
        else:
            is_closed = urwid.AttrMap(generic.ListText("☒"), "red",
                                      "focus-header")
        colum_items = [("weight", 0.05, is_closed)]

        us_ref_and_name = "US #{0: <4} {1}".format(str(data.us_ref(us)),
                                                   data.us_subject(us))
        colum_items.append(
            ("weight", 0.6, generic.ListText(us_ref_and_name, align="left")))

        us_statuses = data.us_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 us_statuses.values())
        selected = us.get("status", None) or project.get(
            "default_us_status", None)
        status_combo = generic.ComboBox(items,
                                        selected_value=selected,
                                        style="cyan",
                                        enable_markup=True,
                                        on_state_change=on_status_change,
                                        user_data=us)
        colum_items.append(("weight", 0.15, status_combo))

        points = data.points(project)
        items = tuple(
            (p.get("name", ""), p.get("id", None)) for p in points.values())
        for r_id, role in roles.items():
            role_name = generic.ListText("{}:".format(role.get("name",
                                                               "UNK.")))

            selected = (us.get("points", {}).get(r_id, None)
                        or project.get("default_points", None))
            points_combo = generic.ComboBox(items,
                                            selected_value=selected,
                                            style="cyan",
                                            on_state_change=on_points_change,
                                            user_data=(us, r_id))
            colum_items.append(("weight", 0.15,
                                urwid.Columns([('pack', role_name),
                                               points_combo])))

        colum_items.append(
            ("weight", 0.1,
             generic.ListText(
                 ("green",
                  "TOTAL: {0:.1f}".format(data.us_total_points(us))))))

        self.widget = urwid.Columns(colum_items)
        super().__init__(
            urwid.AttrMap(
                urwid.LineBox(
                    urwid.AttrMap(self.widget, "cyan", "focus-header")),
                "green"))
Пример #6
0
 def _description(self):
     description = "Move US #{0} '{1}' to milestone...".format(data.us_ref(self.user_story),
                                                               data.us_subject(self.user_story))
     return urwid.Text(description)
Пример #7
0
 def _description(self):
     description = "Move US #{0} '{1}' to milestone...".format(
         data.us_ref(self.user_story), data.us_subject(self.user_story))
     return urwid.Text(description)
Пример #8
0
    def __init__(self,
                 us,
                 project,
                 roles,
                 summation=0.0,
                 on_status_change=None,
                 on_points_change=None):
        self.user_story = us

        colum_items = [(6,
                        generic.ListText("#{0}".format(str(data.us_ref(us))),
                                         align="left"))]

        colum_items.append(
            (1,
             urwid.AttrMap(
                 generic.ListText(
                     "⊕" if data.us_client_requirement(us) else " ",
                     align="left"), "yellow", "focus")))
        colum_items.append(
            (1,
             urwid.AttrMap(
                 generic.ListText("☂" if data.us_team_requirement(us) else " ",
                                  align="left"), "cyan", "focus")))
        colum_items.append(
            (2,
             urwid.AttrMap(
                 generic.ListText("✖" if data.us_is_blocked(us) else " ",
                                  align="left"), "red", "focus")))

        colum_items.append(
            ("weight", 0.5, generic.ListText(data.us_subject(us),
                                             align="left")))

        us_statuses = data.us_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 us_statuses.values())
        selected = us.get("status", None) or project.get(
            "default_us_status", None)
        status_combo = generic.ComboBox(items,
                                        selected_value=selected,
                                        style="cyan",
                                        enable_markup=True,
                                        on_state_change=on_status_change,
                                        user_data=us)
        colum_items.append(("weight", 0.15, status_combo))

        points = data.points(project)
        items = tuple(
            (p.get("name", ""), p.get("id", None)) for p in points.values())
        for r_id, role in roles.items():
            selected = (us.get("points", {}).get(r_id, None)
                        or project.get("default_points", None))
            points_combo = generic.ComboBox(items,
                                            selected_value=selected,
                                            style="cyan",
                                            on_state_change=on_points_change,
                                            user_data=(us, r_id))
            colum_items.append(("weight", 0.05, points_combo))

        colum_items.append(
            ("weight", 0.05,
             generic.ListText(
                 ("green", "{0:.1f}".format(data.us_total_points(us))))))
        colum_items.append(("weight", 0.08,
                            generic.ListText(
                                ("cyan", "{0:.1f}".format(summation)))))

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