[Butia-devel-list] FW: Use of functions to colored a block
Alan Jhonn Aguiar Schwyn
alanjas en hotmail.com
Mar Mar 13 18:52:10 UYT 2012
> Date: Thu, 8 Mar 2012 07:26:25 -0500
> Subject: Re: Use of functions to colored a block
> From: walter.bender en gmail.com
> To: alanjas en hotmail.com
>
> I've attached an example the mechanism we agreed upon last month:
>
> (1) from TurtleArt.taconstants import BOX_COLORS
> (2) define colors for your present and not present conditions:
> COLOR_NOT_PRESENT = ["#A0A0A0","#808080"]
> COLOR_PRESENT = ["#00FF00","#008000"]
> (3) In the setup method, for each block that can change state, define
> an initial condition for it in BOX_COLORS, e.g.,
> BOX_COLORS['block1'] = COLOR_PRESENT
> (4) in your refresh method:
> (a) make sure the appropriate value is in BOX_COLORS
> (b) for each block (of types palette and block):
> blk.set_colors(COLOR_PRESENT) or blk.set_colors(COLOR_NOT_PRESENT)
> (c) update the visibility status of each palette entry:
> self.tw.palettes[palette_name_to_index('repaint')][1].set_visibility(False)
> or (True)
> (d) refresh the palette:
> self.tw.show_toolbar_palette(palette_name_to_index('repaint'),
> regenerate=True)
>
> Sorry it is so complicated. When I have time, I will try to
> encapsulate more of this into the palette class itself.
>
> regards.
>
> -walter
>
>
> On Wed, Mar 7, 2012 at 12:06 PM, Walter Bender <walter.bender en gmail.com> wrote:
> > On Wed, Mar 7, 2012 at 11:45 AM, Alan Jhonn Aguiar Schwyn
> > <alanjas en hotmail.com> wrote:
> >>
> >> Hi,
> >>
> >> In our plugin, I found this functions to change the colors of the blocks:
> >>
> >> special_block_colors['block_name'] = ["#FF0000","#808080"]
> >>
> >> And when we iterate in a list of blocks:
> >>
> >> blk.set_colors(["#FF0000","#808080"])
> >> BOX_COLORS[blk.name] = ["#FF0000","#808080"]
> >>
> >> Which function we must call in each part of the plugin?
> >> Is correct call a special_block_colors in the setup?
> >>
> >> Regards!
> >>
> >> Alan
> >
> > Sorry. I;ve been really busy the last couple of days. I'll try to send
> > a summary email tonight to explain all of this.
> >
> > -walter
> >
> > --
> > Walter Bender
> > Sugar Labs
> > http://www.sugarlabs.org
>
>
>
> --
> Walter Bender
> Sugar Labs
> http://www.sugarlabs.org
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: https://www.fing.edu.uy/mailman/private/butia-devel-l/attachments/20120313/114a376f/attachment.html"
------------ próxima parte ------------
Se ha borrado un mensaje que no está en formato texto plano...
Nombre : repaint.py
Tipo : text/x-python
Tamaño : 4735 bytes
Descripción: no disponible
Url : https://www.fing.edu.uy/mailman/private/butia-devel-l/attachments/20120313/114a376f/attachment.py
Más información sobre la lista de distribución Butia-devel-l