From aa5e93aa9edae28f9f922cbedb608a158d54d219 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Tue, 06 Oct 2009 12:12:48 +0000 Subject: More pylint cleanup --- diff --git a/memorizetoolbar.py b/memorizetoolbar.py index 1be4743..782f818 100644 --- a/memorizetoolbar.py +++ b/memorizetoolbar.py @@ -84,7 +84,8 @@ class MemorizeToolbar(gtk.Toolbar): self._sizes = ['4 X 4', '5 X 5', '6 X 6'] for i, f in enumerate(self._sizes): self._size_combo.combo.append_item(i, f) - self.size_handle_id = self._size_combo.combo.connect('changed', self._game_size_cb) + self.size_handle_id = self._size_combo.combo.connect( \ + 'changed', self._game_size_cb) self._add_widget(self._size_combo) self._size_combo.combo.set_active(0) @@ -121,7 +122,8 @@ class MemorizeToolbar(gtk.Toolbar): try: result = chooser.run() if result == gtk.RESPONSE_ACCEPT: - logging.debug('ObjectChooser: %r' % chooser.get_selected_object()) + logging.debug('ObjectChooser: %r', + chooser.get_selected_object()) jobject = chooser.get_selected_object() if not jobject or not jobject.file_path: return @@ -135,7 +137,8 @@ class MemorizeToolbar(gtk.Toolbar): color = jobject.metadata['icon-color'] else: color = profile.get_color().to_string() - self.emit('game_changed', jobject.file_path, 4, 'file', title, color) + self.emit('game_changed', jobject.file_path, 4, + 'file', title, color) if self.jobject != None: self.jobject.destroy() @@ -146,8 +149,11 @@ class MemorizeToolbar(gtk.Toolbar): self.emit('game_changed', None, game_size, 'size', None, None) def _game_changed_cb(self, combobox): - if combobox.get_active() == 0: return - title = game_name = self.standard_game_names[self._game_combo.combo.get_active()] + if combobox.get_active() == 0: + return + current_game = self._game_combo.combo.get_active() + game_name = self.standard_game_names[current_game] + title = game_name game_size = int(self._sizes[self._size_combo.combo.get_active()][0]) if game_name in self.translated_game_names: diff --git a/messenger.py b/messenger.py index 3748880..658ee08 100644 --- a/messenger.py +++ b/messenger.py @@ -20,7 +20,7 @@ _logger = logging.getLogger('memorize-activity') import tempfile from os import environ, chmod -from os.path import join, getsize, isfile, dirname, basename +from os.path import join, getsize, dirname, basename from dbus.service import method, signal from dbus.gobject_service import ExportedGObject from sugar.datastore import datastore @@ -75,19 +75,20 @@ class Messenger(ExportedGObject): data = self.game.model.data path = data['game_file'] if self.game.model.data['mode'] == 'file': - title = data.get('title', 'Received game') - color = data.get('color', '#ff00ff,#00ff00') - self.file_sender(sender, path, title, color) - + title = data.get('title', 'Received game') + color = data.get('color', '#ff00ff,#00ff00') + self.file_sender(sender, path, title, color) + remote_object = self._tube.get_object(sender, PATH) remote_object.load_game(self.ordered_bus_names, self.game.get_grid(), self.game.collect_data(), - self.game.players.index(self.game.current_player), + self.game.players.index(self.game.current_player), #self.game.waiting_players, path) - @method(dbus_interface=IFACE, in_signature='asaa{ss}a{ss}ns', out_signature='', byte_arrays=True) + @method(dbus_interface=IFACE, in_signature='asaa{ss}a{ss}ns', + out_signature='', byte_arrays=True) def load_game(self, bus_names, grid, data, current_player, path): self.ordered_bus_names = bus_names self.player_id = bus_names.index(self._tube.get_unique_name()) @@ -105,8 +106,6 @@ class Messenger(ExportedGObject): self._change_game_handler() self._file_part_handler() - # Change game method - def change_game(self, sender, mode, grid, data, waiting_list, zip): path = self.game.model.data['game_file'] @@ -134,7 +133,8 @@ class Messenger(ExportedGObject): return if mode == 'demo': game_name = basename(data.get('game_file', 'debug-demo')) - game_file = join(dirname(__file__), 'demos', game_name).encode('ascii') + game_file = join(dirname(__file__), 'demos', + game_name).encode('ascii') self.game.model.read(game_file) if mode == 'file': self.game.model.read(self.files[path]) @@ -151,14 +151,16 @@ class Messenger(ExportedGObject): size = getsize(filename) f = open(filename, 'rb') part_size = 8192 - num_parts = (size / part_size) +1 + num_parts = (size / part_size) + 1 for part in range(num_parts): bytes = f.read(part_size) - self._file_part_signal(target, filename, part+1, num_parts, bytes, title, color) + self._file_part_signal(target, filename, part + 1, + num_parts, bytes, title, color) f.close() @signal(dbus_interface=IFACE, signature='ssuuayss') - def _file_part_signal(self, target, filename, part, numparts, bytes, title, color): + def _file_part_signal(self, target, filename, part, numparts, + bytes, title, color): pass def _file_part_handler(self): @@ -169,7 +171,8 @@ class Messenger(ExportedGObject): sender_keyword='sender', byte_arrays=True) - def _file_part_receiver(self, target, filename, part, numparts, bytes, title=None, color=None, sender=None): + def _file_part_receiver(self, target, filename, part, numparts, + bytes, title=None, color=None, sender=None): # ignore my own signal if sender == self._tube.get_unique_name(): return @@ -181,7 +184,7 @@ class Messenger(ExportedGObject): if part == 1: tmp_root = join(environ['SUGAR_ACTIVITY_ROOT'], 'instance') temp_dir = tempfile.mkdtemp(dir=tmp_root) - chmod(temp_dir,0777) + chmod(temp_dir, 0777) self.temp_file = join(temp_dir, 'game.zip') self.files[filename] = self.temp_file self.f = open(self.temp_file, 'a+b') @@ -189,8 +192,9 @@ class Messenger(ExportedGObject): self.f.write(bytes) percentage = int(float(part) / float(numparts) * 100.0) - self.game.set_load_mode(_('Receiving game') + ': ' + str(percentage) + '% ' + _('done') + '.') - + self.game.set_load_mode(_('Receiving game') + ': ' + + str(percentage) + '% ' + _('done') + '.') + # last chunk if part == numparts: self.f.close() @@ -203,7 +207,7 @@ class Messenger(ExportedGObject): gameObject.file_path = self.temp_file datastore.write(gameObject) #gameObject.destroy() - + # flip card methods @@ -226,4 +230,3 @@ class Messenger(ExportedGObject): if sender == self._tube.get_unique_name(): return self.game.card_flipped(None, card_number, True) - diff --git a/model.py b/model.py index fd05b29..dd4afdb 100644 --- a/model.py +++ b/model.py @@ -17,7 +17,7 @@ import libxml2 from os import environ, makedirs, chmod -from os.path import join, basename, dirname, isdir, split, normpath +from os.path import join, basename, isdir, split, normpath import logging import random import gobject @@ -136,7 +136,7 @@ class Model(object): def read(self, game_file): tmp_root = join(environ['SUGAR_ACTIVITY_ROOT'], 'instance') temp_folder = tempfile.mkdtemp(dir=tmp_root) - chmod(temp_folder,0777) + chmod(temp_folder, 0777) self.data['key'] = basename(game_file) self.data['game_file'] = game_file self.data['path'] = temp_folder @@ -158,7 +158,8 @@ class Model(object): ''' reads the configuration from an xml file ''' try: - xml_file = join(environ['SUGAR_ACTIVITY_ROOT'], self.data['path'], 'game.xml') + xml_file = join(environ['SUGAR_ACTIVITY_ROOT'], + self.data['path'], 'game.xml') doc = libxml2.parseFile(xml_file) if doc.validateDtd(self.ctxt, self.dtd): @@ -167,7 +168,7 @@ class Model(object): res = xpa.xpathEval("//*") # write their content to the data structure - self.idpair = 0 + idpair = 0 for elem in res: attributes = elem.get_properties() pair = Pair() @@ -176,31 +177,32 @@ class Model(object): if(attribute.name == 'text'): pass else: - pair.set_property(attribute.name, attribute.content) - self.pairs[str(self.idpair)] = pair - self.idpair+=1 + pair.set_property(attribute.name, + attribute.content) + self.pairs[str(idpair)] = pair + idpair += 1 elif(elem.name == 'memorize'): for attribute in attributes: if(attribute.name == 'text'): pass - elif(attribute.name == 'name'): + elif(attribute.name == 'name'): self.data['name'] = attribute.content - elif(attribute.name == 'scoresnd'): - self.data['scoresnd'] = attribute.content - elif(attribute.name == 'winsnd'): - self.data['winsnd'] = attribute.content - elif(attribute.name == 'divided'): + elif(attribute.name == 'scoresnd'): + self.data['scoresnd'] = attribute.content + elif(attribute.name == 'winsnd'): + self.data['winsnd'] = attribute.content + elif(attribute.name == 'divided'): self.data['divided'] = attribute.content - elif(attribute.name == 'face'): + elif(attribute.name == 'face'): self.data['face'] = attribute.content - elif(attribute.name == 'face1'): + elif(attribute.name == 'face1'): self.data['face1'] = attribute.content - elif(attribute.name == 'face2'): + elif(attribute.name == 'face2'): self.data['face2'] = attribute.content - elif(attribute.name == 'align'): + elif(attribute.name == 'align'): self.data['align'] = attribute.content - elif(attribute.name == 'equal_pairs'): - self.data['equal_pairs'] = attribute.content + elif(attribute.name == 'equal_pairs'): + self.data['equal_pairs'] = attribute.content xpa.xpathFreeContext() else: _logger.error('Read: Error in validation of the file') @@ -280,15 +282,15 @@ class Model(object): and shuffles the grid so they always appear in a different place ''' - psize=(size*size/2) - _logger.debug('Size requested: %d' %psize) + psize = (size * size / 2) + _logger.debug('Size requested: %d', psize) self.grid = [] temp1 = [] temp2 = [] - i=0 + i = 0 - # shuffle the pairs first to avoid only taking the first ones when there are more - # pairs in the config file then the grid is using + # shuffle the pairs first to avoid only taking the first ones + # when there are more pairs in the config file then the grid is using keys = self.pairs.keys() random.shuffle(keys) @@ -321,13 +323,14 @@ class Model(object): if self.pairs[key].props.bspeak != None: elem['speak'] = self.pairs[key].props.bspeak temp2.append(elem) - i+=1 + i += 1 else: break numpairs = len(self.pairs) if numpairs < psize: - _logger.debug('Defgrid: We did not have enough pairs. requested=%s had=%s' %(psize, numpairs)) + _logger.debug('Defgrid: Not enough pairs, requested=%s had=%s' + % (psize, numpairs)) self.data['size'] = str(size) if self.data['divided'] == '1': @@ -338,8 +341,9 @@ class Model(object): temp1.extend(temp2) random.shuffle(temp1) self.grid = temp1 - _logger.debug('Defgrid: grid( size=%s ): %s' %(self.data['size'], self.grid)) - _logger.debug('Defgrid: data: %s' %self.data) + _logger.debug('Defgrid: grid( size=%s ): %s' + % (self.data['size'], self.grid)) + _logger.debug('Defgrid: data: %s', self.data) def set_data_grid(self, data, grid): self.data = data diff --git a/playerscoreboard.py b/playerscoreboard.py index af0ef0b..832c4d9 100644 --- a/playerscoreboard.py +++ b/playerscoreboard.py @@ -15,9 +15,8 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -import gtk, pygtk +import gtk -import pango import svglabel import logging from os.path import join, dirname @@ -47,7 +46,8 @@ class PlayerScoreboard(gtk.EventBox): # Set table self.table = gtk.Table(2, 2, False) - self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.current_color)) + self.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(self.current_color)) self.table.set_row_spacings(theme.PAD/2) self.table.set_col_spacings(theme.PAD/2) self.table.set_border_width(theme.PAD) @@ -60,16 +60,15 @@ class PlayerScoreboard(gtk.EventBox): self.scores = [] self.current_x = 0 self.current_y = 0 - status = False # Set buddy icon self.xo_buddy = join(dirname(__file__), 'images', 'stock-buddy.svg') self.icon = svglabel.SvgLabel(self.xo_buddy, fill_color, stroke_color, False, self.current_color, theme.BODY_WIDTH, theme.BODY_HEIGHT) - + # Set waiting buddy icon - self.waiting_icon = svglabel.SvgLabel(self.xo_buddy, self.default_color, - '#ffffff', False, self.current_color, + self.waiting_icon = svglabel.SvgLabel(self.xo_buddy, \ + self.default_color, '#ffffff', False, self.current_color, theme.BODY_WIDTH, theme.BODY_HEIGHT) # Set nick label @@ -87,37 +86,40 @@ class PlayerScoreboard(gtk.EventBox): self.table.attach(self.nick, 1, 2, 0, 1) self.table.attach(self.score_table, 1, 2, 1, 2) - if score <> 0: - for i in range(score): + if score != 0: + for i_ in range(score): self.increase_score() def _allocate_cb(self, widget, allocation): - self._score_width = allocation.width - theme.BODY_WIDTH - theme.PAD*2 - theme.PAD/2 - self._score_cols = self._score_width / (theme.SCORE_SIZE+theme.PAD/2) + self._score_width = allocation.width - theme.BODY_WIDTH \ + - theme.PAD * 2 - theme.PAD / 2 + self._score_cols = self._score_width / \ + (theme.SCORE_SIZE + theme.PAD / 2) self.change_game(self._game_size) def change_game(self, size): self._game_size = size - if self._score_cols == 0: return + if self._score_cols == 0: + return rows = int(math.ceil(float(size/2) / self._score_cols)) self.score_table.resize(rows, self._score_cols) self.score_table.set_size_request(-1, - (theme.SCORE_SIZE+theme.PAD/2) * (rows) - theme.PAD/2) + (theme.SCORE_SIZE + theme.PAD / 2) * (rows) - theme.PAD / 2) def increase_score(self): if len(self.scores) == 0: # Cache the score icon score_label = Score(self.fill_color, self.stroke_color) - self.score_pixbuf_unsel = score_label.get_pixbuf() - self.score_pixbuf_sel = score_label.get_pixbuf_sel() + score_pixbuf_unsel = score_label.get_pixbuf() + score_pixbuf_sel = score_label.get_pixbuf_sel() new_score = Score(self.fill_color, self.stroke_color, - self.score_pixbuf_sel, self.score_pixbuf_unsel, self.status) + score_pixbuf_sel, score_pixbuf_unsel, self.status) self.scores.append(new_score) new_score.show() - self.score_table.attach(new_score, self.current_x , self.current_x+1, - self.current_y, self.current_y+1, gtk.SHRINK, gtk.SHRINK) + self.score_table.attach(new_score, self.current_x , self.current_x + 1, + self.current_y, self.current_y + 1, gtk.SHRINK, gtk.SHRINK) self.current_x += 1 if self.current_x == self._score_cols: self.current_x = 0 @@ -130,7 +132,8 @@ class PlayerScoreboard(gtk.EventBox): self.current_color = self.selected_color else: self.current_color = self.default_color - self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.current_color)) + self.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(self.current_color)) self.icon.set_background(self.current_color) for score in self.scores: score.set_selected(sel) @@ -161,4 +164,3 @@ class PlayerScoreboard(gtk.EventBox): def set_message(self, msg): self.msg.set_text(msg) - diff --git a/score.py b/score.py index 81b015e..947c1e9 100644 --- a/score.py +++ b/score.py @@ -15,11 +15,8 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -import rsvg -import re import svglabel import gtk -import gobject import os import theme @@ -30,15 +27,21 @@ class Score(svglabel.SvgLabel): default_color = "#4c4d4f" status = False - def __init__(self, fill_color, stroke_color, pixbuf= None, pixbuf_sel = None, status= False): + def __init__(self, fill_color, stroke_color, pixbuf=None, + pixbuf_sel=None, status=False): filename = os.path.join(os.path.dirname(__file__), "images/score.svg") self.pixbuf_un = pixbuf self.pixbuf_sel = pixbuf_sel self.status = status if self.pixbuf_un == None: - self.pixbuf_un = svglabel.SvgLabel(filename, fill_color, stroke_color, False, self.default_color).get_pixbuf() + self.pixbuf_un = svglabel.SvgLabel(filename, fill_color, + stroke_color, False, + self.default_color).get_pixbuf() if self.pixbuf_sel == None: - self.pixbuf_sel = svglabel.SvgLabel(filename, fill_color, stroke_color, False, self.selected_color).get_pixbuf() + label = svglabel.SvgLabel(filename, fill_color, stroke_color, + False, self.selected_color) + self.pixbuf_sel = label.get_pixbuf() + if status: self.pixbuf = self.pixbuf_sel else: @@ -53,10 +56,12 @@ class Score(svglabel.SvgLabel): self.status = status if status: self.pixbuf = self.pixbuf_sel - self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.selected_color)) + self.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(self.selected_color)) else: self.pixbuf = self.pixbuf_un - self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.default_color)) + self.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(self.default_color)) self.queue_draw() def get_pixbuf_un(self): @@ -64,4 +69,3 @@ class Score(svglabel.SvgLabel): def get_pixbuf_sel(self): return self.pixbuf_sel - diff --git a/scoreboard.py b/scoreboard.py index 59c0102..e11d3dd 100644 --- a/scoreboard.py +++ b/scoreboard.py @@ -54,7 +54,7 @@ class Scoreboard(gtk.EventBox): stroke_color, fill_color = buddy.props.color.split(',') player = PlayerScoreboard(nick, fill_color, stroke_color, score) player.show() - self.players[buddy]=player + self.players[buddy] = player self.vbox.pack_start(player, False, False) if score == -1: player.set_wait_mode(True) @@ -65,7 +65,7 @@ class Scoreboard(gtk.EventBox): del self.players[buddy] ### fix for self.players[id] def set_selected(self, widget, buddy): - if self.current_buddy <> None: + if self.current_buddy is not None: old = self.players[self.current_buddy] old.set_selected(False) self.current_buddy = buddy diff --git a/svgcard.py b/svgcard.py index 727cb05..5090f84 100644 --- a/svgcard.py +++ b/svgcard.py @@ -39,22 +39,27 @@ class SvgCard(gtk.EventBox): # Default properties default_props = {} - default_props['back'] = {'fill_color':'#b2b3b7', 'stroke_color':'#b2b3b7', 'opacity':'1'} - default_props['back_h'] = {'fill_color':'#b2b3b7', 'stroke_color':'#ffffff', 'opacity':'1'} + default_props['back'] = {'fill_color':'#b2b3b7', 'stroke_color':'#b2b3b7', + 'opacity':'1'} + default_props['back_h'] = {'fill_color':'#b2b3b7', + 'stroke_color':'#ffffff', 'opacity':'1'} default_props['back_text'] = {'text_color':'#c7c8cc'} - default_props['front'] = {'fill_color':'#4c4d4f', 'stroke_color':'#ffffff', 'opacity':'1'} - default_props['front_h'] = {'fill_color':'#555555', 'stroke_color':'#888888', 'opacity':'1'} + default_props['front'] = {'fill_color':'#4c4d4f', 'stroke_color':'#ffffff', + 'opacity':'1'} + default_props['front_h'] = {'fill_color':'#555555', + 'stroke_color':'#888888', 'opacity':'1'} default_props['front_text'] = {'text_color':'#ffffff'} cache = {} - def __init__(self, id, pprops, jpeg, size, align, bg_color='#000000'): + def __init__(self, identifier, pprops, jpeg, size, + align, bg_color='#000000'): gtk.EventBox.__init__(self) self.bg_color = bg_color self.flipped = False self.flipped_once = False - self.id = id + self.id = identifier self.jpeg = jpeg self.show_jpeg = False self.show_text = False @@ -66,7 +71,8 @@ class SvgCard(gtk.EventBox): self.set_size_request(size, size) # Views properties - views = ['back', 'back_h', 'back_text', 'front', 'front_h', 'front_text'] + views = ['back', 'back_h', 'back_text', 'front', + 'front_h', 'front_text'] self.pprops = pprops self.props = {} for view in views: @@ -126,34 +132,37 @@ class SvgCard(gtk.EventBox): return False def _read_icon_data(self, view): - dict = self.props[view] - set = str(self.size)+dict.get('fill_color')+dict.get('stroke_color') - if self.cache.has_key(set): - return self.cache[set] + icon_data = self.props[view] + key = str(self.size) + icon_data.get('fill_color') + \ + icon_data.get('stroke_color') + if self.cache.has_key(key): + return self.cache[key] icon_file = open(self.border_svg, 'r') data = icon_file.read() icon_file.close() # Replace borders parameters - entity = '' % dict.get('fill_color', '') + entity = '' % icon_data.get('fill_color', '') data = re.sub('', entity, data) - entity = '' % dict.get('stroke_color', '') + entity = '' % \ + icon_data.get('stroke_color', '') data = re.sub('', entity, data) - entity = '' % dict.get('opacity', '') + entity = '' % icon_data.get('opacity', '') data = re.sub('', entity, data) data = re.sub('size_card1', str(self.size), data) data = re.sub('size_card2', str(self.size-6), data) data = re.sub('size_card3', str(self.size-17), data) pixbuf = rsvg.Handle(data=data).get_pixbuf() - self.cache[set] = pixbuf + self.cache[key] = pixbuf return pixbuf def set_border(self, stroke_color, fill_color): - self.props['front'].update({'fill_color':fill_color, 'stroke_color':stroke_color}) + self.props['front'].update({'fill_color' : fill_color, + 'stroke_color' : stroke_color}) self.queue_draw() while gtk.events_pending(): gtk.main_iteration() @@ -197,16 +206,19 @@ class SvgCard(gtk.EventBox): return if not self.flipped_once: - if self.jpeg <> None: + if self.jpeg is not None: pixbuf_t = gtk.gdk.pixbuf_new_from_file(self.jpeg) - if pixbuf_t.get_width() != self.size-22 or pixbuf_t.get_height() != self.size-22: - self.jpeg = pixbuf_t.scale_simple(self.size-22, self.size-22, gtk.gdk.INTERP_BILINEAR) + if pixbuf_t.get_width() != self.size - 22 \ + or pixbuf_t.get_height() != self.size - 22: + self.jpeg = pixbuf_t.scale_simple(self.size - 22, + self.size - 22, + gtk.gdk.INTERP_BILINEAR) del pixbuf_t else: self.jpeg = pixbuf_t self.flipped_once = True - if self.jpeg <> None: + if self.jpeg is not None: self.show_jpeg = True text = self.props.get('front_text', {}).get('card_text', '') if text != None and len(text) > 0: @@ -264,8 +276,10 @@ class SvgCard(gtk.EventBox): def reset(self): if self.flipped: - fill_color = self.default_props.get('front_border').get('fill_color') - stroke_color = self.default_propsfront_text.get('front_border').get('stroke_color') + front_border = self.default_props.get('front_border') + fill_color = front_border.get('fill_color') + front_text = self.default_propsfront_text + stroke_color = front_text.get('front_border').get('stroke_color') self.set_border(fill_color, stroke_color) self.flop() @@ -279,7 +293,7 @@ class SvgCard(gtk.EventBox): for size in range(80, 66, -8) + range(66, 44, -6) + \ range(44, 24, -4) + range(24, 15, -2) + range(15, 7, -1): - card_size = self.size - theme.SVG_PAD*2 + card_size = self.size - theme.SVG_PAD * 2 layout = self.create_pango_layout(text) layout.set_width(PIXELS_PANGO(card_size)) layout.set_wrap(pango.WRAP_WORD) @@ -302,7 +316,8 @@ class SvgCard(gtk.EventBox): def set_background(self, color): self.bg_color = color - self.draw.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.bg_color)) + self.draw.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(self.bg_color)) def change_text(self, newtext): self.text_layouts[self.flipped] = None -- cgit v0.9.1