Re: Actor signals




On Tue, October 30, 2012 12:27 pm, Lionel Landwerlin wrote:


On 30/10/12 01:19, Patrick Shirkey wrote:
Thanks for your advice.

This is the pick method:

     def do_pick (self, pick_color):
         if self.should_pick_paint() == False:
             return

         box = self.get_allocation_box()
         self.__draw_shape(box.x2 - box.x1, box.y2 - box.y1, pick_color)



There's not much to it so I am not sure why it is doing something weird
or
how to fix it.



Are you sure the __draw_shape() method doesn't alterate the picking
color when drawing? (opacity? mask?)


The opacity is being explicitly set in the button-press-event handler.

    if(status == 0): # button-press-event
        opacity = 200
    else: # button-release-event/button-leave-event
        opacity = 255

    set_opacity(opacity)


The __draw_shape function doesn't appear to have anything that would cause
trouble. Also the code works for the top layer but not the bottom layer.
The issue appears to be that the id of the actor is not found for the
bottom layer but I am not sure why it would be unable to find it's own id
especially when the top layer doesn't have this problem.


Here's the __draw_shape methods:

    def do_draw_shape(self, width, height):
        pass

    def __draw_shape(self, width, height, color=None, texture=None):
        tmp_alpha = self.get_paint_opacity() * color.alpha / 255
        if texture:
            Cogl.set_source_texture(texture)
        else:
            Cogl.set_source_color4ub(color.red, color.green, color.blue,
tmp_alpha)
        self.do_draw_shape(width, height)
        Cogl.path_fill()



--
Patrick Shirkey
Boost Hardware Ltd



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]