How to use illuminer method in SeleniumBase

Best Python code snippet using SeleniumBase

_hovergetter.py

Source:_hovergetter.py Github

copy

Full Screen

1from pygame import Surface2from thorpy.miscgui import constants, functions, style3from thorpy.painting.painters.optionnal.illuminer import IlluminerAlphaExcept as Illuminer4from thorpy.painting import pilgraphics5def get_already_illuminated_title(hoverable, state, color=None):6 color = style.COLOR_TXT_HOVER if color is None else color7 fusionner = hoverable._states[state].fusionner8 old_color_target = fusionner.painter.color_target9 old_color_bulk = fusionner.painter.color_bulk10 fusionner.painter.color_target = color11 fusionner.painter.color_bulk = color12 img = fusionner.get_hover_fusion()13 fusionner.painter.color_target = old_color_target14 fusionner.painter.color_bulk = old_color_bulk15 return img16def get_not_already_illuminated_title(hoverable, state, color=None):17 color = style.COLOR_TXT_HOVER if color is None else color18 #produce illumination then blit it on the painter not fusionned.19 fusionner = hoverable._states[state].fusionner20 target_img = hoverable.get_image(state)21 r = target_img.get_rect()22 #the shadow will be larger in order to make free space for fadeout.23 shadow_radius = 224 r.inflate_ip(2*shadow_radius, 2*shadow_radius)25 img = Surface(r.size)26 img.fill((255, 255, 255, 255))27 img.blit(target_img, (shadow_radius, shadow_radius))28 shadow = pilgraphics.get_shadow(img,29 radius=shadow_radius,30 black=255,31 alpha_factor=0.95,32 decay_mode="exponential",33 color=color)34 shadow = shadow.subsurface(shadow.get_rect().inflate((-2*shadow_radius, -2*shadow_radius)))35 return shadow36def get_illuminated_title(hoverable, state, color=None):37 if is_illuminated(hoverable, state):38 return get_already_illuminated_title(hoverable, state, color)39 else:40 return get_not_already_illuminated_title(hoverable, state, color)41def get_highlighted_title(hoverable, state, color=None):42 color = style.COLOR_TXT_HOVER if color is None else color43 return hoverable._states[state].fusionner.get_hover_fusion(color=color)44def get_all_highlighted_title(hoverable, state, colors):45 color_text, color_bulk = colors46 if not color_text:47 color_text=style.COLOR_TXT_HOVER48 if not color_bulk:49 color_bulk=style.COLOR_BULK_HOVER50 fusionner = hoverable._states[state].fusionner51 old_color_painter = None52 if hasattr(fusionner, "painter"):53 if hasattr(fusionner.painter, "color"):54 old_color_painter = fusionner.painter.color55 fusionner.painter.color = color_bulk56 illuminer = is_illuminated(hoverable, state)57 if illuminer:58 old_color_target = fusionner.painter.color_target59 old_color_bulk = fusionner.painter.color_bulk60 fusionner.painter.color_target = color_text61 fusionner.painter.color_bulk = color_text62 img = fusionner.get_hover_fusion()63 if old_color_painter:64 fusionner.painter.color = old_color_painter65 if illuminer:66 fusionner.painter.color_target = old_color_target67 fusionner.painter.color_bulk = old_color_bulk68 return img69def is_illuminated(hoverable, state):70 fusionner = hoverable._states[state].fusionner71 if hasattr(fusionner, "painter"):72 if isinstance(fusionner.painter, Illuminer):73 return True74 return False75def get_img_highlighted(hoverable, state, color=None):76 if is_illuminated(hoverable, state):77 return get_illuminated_title(hoverable, state, color)78 else:79 return get_highlighted_title(hoverable, state, color)80def get_img_painter(hoverable, state, color=None):81 color = style.COLOR_TXT_HOVER if color is None else color82 fusionner = hoverable._states[state].fusionner83 if hasattr(fusionner, "painter"):84 fusionner.painter.hovered=True85 illuminer = is_illuminated(hoverable, state)86 if illuminer:87 old_color_target = fusionner.painter.color_target88 old_color_bulk = fusionner.painter.color_bulk89 fusionner.painter.color_target = color90 fusionner.painter.color_bulk = color91 img = fusionner.get_hover_fusion()92 if illuminer:93 fusionner.painter.color_target = old_color_target94 fusionner.painter.color_bulk = old_color_bulk95 if hasattr(fusionner, "painter"):96 fusionner.painter.hovered=False97 return img98def get_img_redraw(hoverable, state, params):99 paint_params = params["params"]100 paint_params["size"] = hoverable.get_ghost_size()101 painter = functions.obtain_valid_painter(params["painter"],102 **paint_params)...

Full Screen

Full Screen

illuminer.py

Source:illuminer.py Github

copy

Full Screen

1from thorpy.painting.painters.basicframe import BasicFrame2from thorpy.miscgui import constants, functions, style3from thorpy.painting.graphics import illuminate_alphacolor_except4class IlluminerAlphaExcept(BasicFrame):5 """Illuminer that also set alpha values, in addition to colors.6 All pixels with RGB value <colorkey> will be taken into account for fading,7 while all other pixels will be considered as light source.8 """9 def __init__(self, size=style.SIZE, colorkey=constants.WHITE, clip=None,10 color_target=style.DEF_COLOR, color_bulk=None, subrect=None,11 pressed=False, hovered=False, factor=1., fadout=10., bulk_alpha=255):12 BasicFrame.__init__(self,13 size=size,14 color=colorkey,15 clip=clip,16 pressed=pressed,17 hovered=hovered)18 self.color_target = color_target19 self.color_bulk = color_bulk20 self.subrect = subrect21 self.factor = factor22 self.fadout = fadout23 self.bulk_alpha = bulk_alpha24 def get_fusion(self, title, center_title):25 """Fusion the painter.img and the title.img and returns this fusion"""26 if center_title is True: # center the title on the element rect27 title.center_on(self.size)28 elif center_title is not False: # center_title is the topleft argument29 title._pos = center_title30 else:31 title._pos = (0, 0)32 painter_img = self.get_surface()33 title.blit_on(painter_img)34 functions.debug_msg("Building illuminer of size " + str(self.size))35 return illuminate_alphacolor_except(painter_img, self.color,36 self.color_target, self.color_bulk,37 self.subrect, self.factor,38 self.fadout, self.bulk_alpha)39class IlluminerAlphaText(IlluminerAlphaExcept):40 """Text-specialized Illuminer that also set alpha values, in addition to41 colors.42 All pixels with RGB value <colorkey> will be taken into account for fading,43 while all other pixels will be considered as light source.44 """45 def get_fusion(self, title, center_title):46 """Fusion the painter.img and the title.img and returns this fusion"""47 if title._writer.color == self.color:48 functions.debug_msg("Colorkey is the same as writer's color while\49 generating " + title._text)50 if center_title is True: # center the title on the element rect51 title.center_on(self.size)52 elif center_title is not False: # center_title is the topleft argument53 title._pos = center_title54 else:55 title._pos = (0, 0)56 painter_img = self.get_surface()57 old_aa = title._writer.aa58 old_imgs = title._imgs59 if old_aa:60 title._writer.aa = False61 title.refresh_imgs()62 title.blit_on(painter_img)63 if old_aa:64 title._writer.aa = True65 title._imgs = old_imgs66 functions.debug_msg("Building illuminer of size " + str(self.size))67 return illuminate_alphacolor_except(painter_img, self.color,68 self.color_target, self.color_bulk,69 self.subrect, self.factor,...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful