Exemple #1
0
    def _create_additional_columns(self):

        def _tomato_render_func(col, renderer, model, iter, user_data=None):
            tomatoes = model.get_value(iter, ActivityStore.TOMATO_COL)
            renderer.set_property('markup', '<span foreground="#32CD32">%s</span>' % tomatoes)

        def _interrupt_render_func(col, renderer, model, iter, user_data=None):
            interrupts = model.get_value(iter, ActivityStore.INTERRUPT_COL)
            renderer.set_property('markup', '<span foreground="#CD3232">%s</span>' % interrupts)

        tomato_col = util.new_text_col('$', _tomato_render_func)
        tomato_col.set_expand(False)
        interrupt_col = util.new_text_col('!', _interrupt_render_func)
        interrupt_col.set_expand(False)
        return (tomato_col, interrupt_col)
Exemple #2
0
    def _create_list_view(self, act_model):
        def _act_name_render_func(col, renderer, model, iter, user_data=None):
            name = model.get_value(iter, ActivityStore.TITLE_COL)
            finished = model.get_value(iter, ActivityStore.FINISHED_COL)
            if finished:
                name = '<span foreground="#32CD32"><s>%s</s></span>' % name
            renderer.set_property('markup', name)

        act_view = gtk.TreeView()
        act_view.set_model(act_model)

        toggle_renderer = gtk.CellRendererToggle()
        toggle_renderer.set_property('activatable', True)
        toggle_renderer.connect('toggled', self._on_toggle_finish)
        toggle_col = gtk.TreeViewColumn('#', toggle_renderer, active=1)
        toggle_col.set_expand(False)
        title_col = util.new_text_col(_('Activity'), _act_name_render_func)
        title_col.set_resizable(True)
        title_col.set_expand(True)
        title_col.get_cell_renderers()[0].set_property('editable', True)
        title_col.get_cell_renderers()[0].connect('edited', self._on_update)

        other_cols = self._create_additional_columns()
        act_view.append_column(toggle_col)
        act_view.append_column(title_col)
        for col in other_cols:
            act_view.append_column(col)

        sel = act_view.get_selection()
        sel.set_mode(gtk.SELECTION_SINGLE)
        act_model.load_activities()
        return act_view
Exemple #3
0
    def _create_additional_columns(self):
        def _tomato_render_func(col, renderer, model, iter, user_data=None):
            tomatoes = model.get_value(iter, ActivityStore.TOMATO_COL)
            renderer.set_property(
                'markup', '<span foreground="#32CD32">%s</span>' % tomatoes)

        def _interrupt_render_func(col, renderer, model, iter, user_data=None):
            interrupts = model.get_value(iter, ActivityStore.INTERRUPT_COL)
            renderer.set_property(
                'markup', '<span foreground="#CD3232">%s</span>' % interrupts)

        tomato_col = util.new_text_col('$', _tomato_render_func)
        tomato_col.set_expand(False)
        interrupt_col = util.new_text_col('!', _interrupt_render_func)
        interrupt_col.set_expand(False)
        return (tomato_col, interrupt_col)
Exemple #4
0
    def _create_list_view(self, act_model):

        def _act_name_render_func(col, renderer, model, iter, user_data=None):
            name = model.get_value(iter, ActivityStore.TITLE_COL)
            finished = model.get_value(iter, ActivityStore.FINISHED_COL)
            if finished:
                name = '<span foreground="#32CD32"><s>%s</s></span>' % name
            renderer.set_property('markup', name)

        act_view = gtk.TreeView()
        act_view.set_model(act_model)

        toggle_renderer = gtk.CellRendererToggle()
        toggle_renderer.set_property('activatable', True)
        toggle_renderer.connect('toggled', self._on_toggle_finish)
        toggle_col = gtk.TreeViewColumn('#', toggle_renderer, active=1)
        toggle_col.set_expand(False)
        title_col = util.new_text_col(_('Activity'), _act_name_render_func)
        title_col.set_resizable(True)
        title_col.set_expand(True)
        title_col.get_cell_renderers()[0].set_property('editable', True)
        title_col.get_cell_renderers()[0].connect('edited', self._on_update)

        other_cols = self._create_additional_columns()
        act_view.append_column(toggle_col)
        act_view.append_column(title_col)
        for col in other_cols:
            act_view.append_column(col)

        sel = act_view.get_selection()
        sel.set_mode(gtk.SELECTION_SINGLE)
        act_model.load_activities()
        return act_view