Esempio n. 1
0
    def _desc_data_func(self, column, renderer, model, iter_, data=None):
        """Method for format the description text in the column."""
        task = model.get_task(iter_)
        # Get current state of the iter
        if self.selection.iter_is_selected(iter_):
            if self.has_focus():
                state = Gtk.StateFlags.SELECTED
            else:
                state = Gtk.StateFlags.ACTIVE
        else:
            state = Gtk.StateFlags.NORMAL
        # Get the color for the description
        color = get_mix_color(self, state)

        # If task completed, don't show completed length
        if task.in_category:
            completed_text = ""
        else:
            completed_text = "{} / ".format(psize(task.completed_length))

        markup = (
            "<small>"
            "<b>{}</b>\n"
            '<span fgcolor="{}">{}{}</span>'
            "</small>".format(GLib.markup_escape_text(task.name), color, completed_text, psize(task.total_length))
        )

        renderer.set_properties(markup=markup, ellipsize_set=True, ellipsize=Pango.EllipsizeMode.END)
Esempio n. 2
0
    def _markup_data_func(self, column, renderer, model, iter_, data=None):
        """
        Method for format the text in the column.
        """
        presentable = model.get_presentable(iter_)
        # Get current state of the iter
        if self.selection.iter_is_selected(iter_):
            if self.has_focus():
                state = Gtk.StateFlags.SELECTED
            else:
                state = Gtk.StateFlags.ACTIVE
        else:
            state = Gtk.StateFlags.NORMAL
        # Get the color for the description
        color = get_mix_color(self, state)

        tasks = list(presentable.tasks)
        total_length = sum(task.total_length for task in tasks)
        description = _('{} Task(s) {}').format(len(tasks),
                                                psize(total_length))
        markup = '<small>' \
                     '<b>{}</b>\n' \
                     '<span fgcolor="{}">{}</span>' \
                 '</small>' \
                 .format(GLib.markup_escape_text(presentable.name),
                         color, description)

        renderer.set_properties(
            markup=markup,
            ellipsize_set=True,
            ellipsize=Pango.EllipsizeMode.MIDDLE,
        )
Esempio n. 3
0
    def _desc_data_func(self, column, renderer, model, iter_, data=None):
        """Method for format the description text in the column."""
        task = model.get_task(iter_)
        # Get current state of the iter
        if self.selection.iter_is_selected(iter_):
            if self.has_focus():
                state = Gtk.StateFlags.SELECTED
            else:
                state = Gtk.StateFlags.ACTIVE
        else:
            state = Gtk.StateFlags.NORMAL
        # Get the color for the description
        color = get_mix_color(self, state)

        # If task completed, don't show completed length
        if task.in_category:
            completed_text = ''
        else:
            completed_text = '{} / '.format(psize(task.completed_length))

        markup = '<small>' \
                     '<b>{}</b>\n' \
                     '<span fgcolor="{}">{}{}</span>' \
                 '</small>' \
                 .format(GLib.markup_escape_text(task.name),
                         color, completed_text, psize(task.total_length))

        renderer.set_properties(
            markup=markup,
            ellipsize_set=True,
            ellipsize=Pango.EllipsizeMode.END,
        )
Esempio n. 4
0
    def _markup_data_func(self, column, renderer, model, iter_, data=None):
        """
        Method for format the text in the column.
        """
        presentable = model.get_presentable(iter_)
        # Get current state of the iter
        if self.selection.iter_is_selected(iter_):
            if self.has_focus():
                state = Gtk.StateFlags.SELECTED
            else:
                state = Gtk.StateFlags.ACTIVE
        else:
            state = Gtk.StateFlags.NORMAL
        # Get the color for the description
        color = get_mix_color(self, state)

        tasks = list(presentable.tasks)
        total_length = sum(task.total_length for task in tasks)
        description = _('{} Task(s) {}').format(len(tasks), psize(total_length))
        markup = '<small>' \
                     '<b>{}</b>\n' \
                     '<span fgcolor="{}">{}</span>' \
                 '</small>' \
                 .format(GLib.markup_escape_text(presentable.name),
                         color, description)

        renderer.set_properties(
                markup = markup,
                ellipsize_set = True,
                ellipsize = Pango.EllipsizeMode.MIDDLE,
                )