From 8634a7d222b5982f81d1b8f740f788fcbdf6518d Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sat, 10 Sep 2016 20:08:16 +0200 Subject: [PATCH] PEP8 fixes. --- tabakrolletjie/scenes/help.py | 36 +++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/tabakrolletjie/scenes/help.py b/tabakrolletjie/scenes/help.py index f9b35e5..b30b151 100644 --- a/tabakrolletjie/scenes/help.py +++ b/tabakrolletjie/scenes/help.py @@ -15,16 +15,19 @@ from ..transforms import Multiply, NullTransform, ColourWedges class HelpItem(object): FONT = loader.load_font(FONTS['sans'], size=14) - + def __init__(self, imgparts, label, transform=NullTransform()): self._img_size = int(imgparts[0]) - self._img = loader.load_image(*imgparts, transform=transform).convert_alpha() + self._img = loader.load_image( + *imgparts, transform=transform).convert_alpha() maxwidth = SCREEN_SIZE[0] / 2 - self._img_size - + wrap_width = int(2.25 * maxwidth / self.FONT.get_height()) - self._text = [self.FONT.render(text, True, COLOURS["white"]) for text in wrap(label, wrap_width)] + self._text = [ + self.FONT.render(text, True, COLOURS["white"]) + for text in wrap(label, wrap_width)] def render(self, surface, height, x_offset=0): surface.blit(self._img, (x_offset, height), None) @@ -37,17 +40,19 @@ class HelpScene(BaseScene): def enter(self, gamestate): self._space = pymunk.Space() - + font_title = loader.load_font(FONTS['bold'], size=32) - self._title = font_title.render("Help! What's going on?!", True, COLOURS["white"]) - + self._title = font_title.render( + "Help! What's going on?!", True, COLOURS["white"]) + self._tools = self.create_tools(gamestate) self._items = self.create_items(gamestate) def create_tools(self, gamestate): tools = [] tools.append(ImageButton( - '32', 'exit.png', name='exit', pos=(SCREEN_SIZE[0] - 50, SCREEN_SIZE[1] - 40))) + '32', 'exit.png', name='exit', + pos=(SCREEN_SIZE[0] - 50, SCREEN_SIZE[1] - 40))) return tools def create_items(self, gamestate): @@ -59,19 +64,21 @@ class HelpScene(BaseScene): HelpItem(("48", "spotlight.png"), "This is a spotlight. Unlike a lamp, it has a rotating beam. Lights can be multicoloured, like this one. You can toggle lights on and off at night to conserve power, and toggle the colour of multicoloured lights.", transform=ColourWedges(colours=("red", "green"))), HelpItem(("32", "night.png"), "When you have finished planting seeds and placing lights, you can prepare for Boyd's night-time onslaught by clicking this button."), HelpItem(("32", "pause.png"), "You can pause the game during the night if you need to make a more detailed analysis of why you're losing horribly."), - #HelpItem(("", ""), ""), - #HelpItem(("", ""), ""), ] # Special mould assembly - items[1]._img.blit(loader.load_image("32", "mouldB.png").convert_alpha(), (30, 30), None) - items[1]._img.blit(loader.load_image("32", "eyeballA.png").convert_alpha(), (10, 10), None) + items[1]._img.blit( + loader.load_image("32", "mouldB.png").convert_alpha(), + (30, 30), None) + items[1]._img.blit( + loader.load_image("32", "eyeballA.png").convert_alpha(), + (10, 10), None) return items def render(self, surface, gamestate): surface.fill(COLOURS["blue"]) - + pos = ((surface.get_width() - self._title.get_width()) / 2, 5) surface.blit(self._title, pos, None) @@ -80,7 +87,8 @@ class HelpScene(BaseScene): for item in self._items: item.render(surface, height, x_offset) - height += max(item._img_size, item.FONT.get_height() * len(item._text)) + height += max( + item._img_size, item.FONT.get_height() * len(item._text)) height += 5 if height > SCREEN_SIZE[1]: height = 50 -- 2.34.1