Layer solo + blink

I opened this github thread:

I’d be glad to take care of it but I don’t know which function to call to update the canvas in place of
self.layerblink_state.activate(action)

any hint on how to do that would be trully appreciated.

thanks

Hi @arrouan,

For others reading this, arrouan wants to make MyPaint not blink the current layer if MyPaint is in layer-solo mode, at least not for PgUp and PgDown actions. The original issue report is

Here’s the bit of code in question (see see gui/document.py line 1065)

    def select_layer_below_cb(self, action):
        """``SelectLayerBelow`` GtkAction callback"""
        layers = self.model.layer_stack
        path = layers.get_current_path()
        path = layers.path_below(path)
        if path:
            self.model.select_layer(path=path)
        self.layerblink_state.activate(action)

    def select_layer_above_cb(self, action):
        """``SelectLayerAbove`` GtkAction callback"""
        layers = self.model.layer_stack
        path = layers.get_current_path()
        path = layers.path_above(path)
        if path:
            self.model.select_layer(path=path)
        self.layerblink_state.activate(action)

I think I see what you’re getting at here now. I was wondering why you wanted to replace the activate() call. Does MyPaint not update the canvas as you’d expect, if you just remove the self.layerblink_state.activate call()?

I think calling self.tdw.queue_draw() may help if that’s the case. That TiledDrawWidget is derived from Gtk.Widget, so it can be forced to redraw in the same way: Gtk – 3.0

But I wonder whether some new callback should be observing current_path_updated announcements made by the base of the layer stack object. Something making decisions about whether to do a layer blink or issue a simple redraw based on the layer-solo flag.

Hi,

thank you for your answer.
self.tdw.queue_draw() does exatly what I wanted.
I will try this modification for a couple of days to see if everything works correctly.

I am not sure I understood the last part of your post though.