From: Simon Cross Date: Sun, 11 May 2014 20:33:46 +0000 (+0200) Subject: PEP8 fixes. X-Git-Tag: 0.1~387 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=3f055c8710c26d79bb8c6d18956c454188a5057b;p=naja.git PEP8 fixes. --- diff --git a/naja/widgets/text.py b/naja/widgets/text.py index 8b1e3c6..9ecd0db 100644 --- a/naja/widgets/text.py +++ b/naja/widgets/text.py @@ -27,6 +27,7 @@ class TextWidget(Widget): def draw(self, surface): surface.blit(self.surface, self.rect) + class TextBoxWidget(TextWidget): def __init__(self, *args, **kwargs): self.padding = kwargs.pop('padding', 5) @@ -37,7 +38,7 @@ class TextBoxWidget(TextWidget): (0, 0, 0))) self.box_width = kwargs.pop('box_width', 0) - super(TextBoxWidget,self).__init__(*args, **kwargs) + super(TextBoxWidget, self).__init__(*args, **kwargs) def prepare(self): self.font = resources.get_font(self.fontname, self.fontsize) @@ -50,7 +51,7 @@ class TextBoxWidget(TextWidget): current_line_rendered = None for word in line.split(' '): if len(current_line) > 0: - current_line += ' '+ word + current_line += ' ' + word else: current_line = word line = self.font.render(current_line, True, self.colour) @@ -61,24 +62,26 @@ class TextBoxWidget(TextWidget): elif current_line_rendered is not None: line_rect = current_line_rendered.get_rect() self.lines.append(pygame.transform.scale( - current_line_rendered,(line_rect.width * 2, - line_rect.height * 2))) + current_line_rendered, (line_rect.width * 2, + line_rect.height * 2))) current_line = word - current_line_rendered = self.font.render(word, True, self.colour) + current_line_rendered = self.font.render( + word, True, self.colour) else: - raise Exception('Line too long. Please resize or rephrase') + raise Exception( + 'Line too long. Please resize or rephrase') if current_line_rendered is not None: line_rect = current_line_rendered.get_rect() self.lines.append(pygame.transform.scale( - current_line_rendered,(line_rect.width * 2, - line_rect.height * 2))) + current_line_rendered, (line_rect.width * 2, + line_rect.height * 2))) else: line = self.font.render(line, True, self.colour) line_rect = line.get_rect() width = max(width, line.get_rect().width) height += line.get_rect().height - self.lines.append(pygame.transform.scale(line, (line_rect.width * 2, - line_rect.height * 2))) + self.lines.append(pygame.transform.scale( + line, (line_rect.width * 2, line_rect.height * 2))) width += 2 + self.padding height += 2 + self.padding @@ -94,4 +97,3 @@ class TextBoxWidget(TextWidget): self.text_rect = surface.get_rect() if not self.size: self.rect.size = self.text_rect.size -