From 97d9d21311e53a0167fcb7cd6903487fea37595e Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 18 Apr 2008 22:37:19 +0000 Subject: pylint icon, a few false positive left --- diff --git a/sugar/graphics/icon.py b/sugar/graphics/icon.py index 213b3bc..93c8bf7 100644 --- a/sugar/graphics/icon.py +++ b/sugar/graphics/icon.py @@ -15,10 +15,8 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -import os import re import math -import time import logging import gobject @@ -26,9 +24,7 @@ import gtk import hippo import cairo -from sugar.graphics.style import Color from sugar.graphics.xocolor import XoColor -from sugar.graphics import style from sugar.graphics.palette import Palette, CanvasInvoker from sugar.util import LRU @@ -79,6 +75,7 @@ class _IconBuffer(object): def __init__(self): self.icon_name = None + self.icon_size = None self.file_name = None self.fill_color = None self.stroke_color = None @@ -362,10 +359,11 @@ class Icon(gtk.Image): if self.get_direction() != gtk.TEXT_DIR_LTR: xalign = 1.0 - xalign - x = math.floor(self.allocation.x + xpad + - (self.allocation.width - requisition[0]) * xalign) - y = math.floor(self.allocation.y + ypad + - (self.allocation.height - requisition[1]) * yalign) + allocation = self.get_allocation() + x = math.floor(allocation.x + xpad + + (allocation.width - requisition[0]) * xalign) + y = math.floor(allocation.y + ypad + + (allocation.height - requisition[1]) * yalign) cr = self.window.cairo_create() cr.set_source_surface(surface, x, y) @@ -464,7 +462,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): self._buffer.height = value self.emit_request_changed() elif pspec.name == 'scale': - logging.warning('CanvasIcon: the scale parameter is currently unsupported') + logging.warning( + 'CanvasIcon: the scale parameter is currently unsupported') if self._buffer.scale != value: self._buffer.scale = value self.emit_request_changed() @@ -546,13 +545,13 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): palette = property(get_palette, set_palette) def get_icon_state(base_name, perc): - step = 5 - strength = round(perc / step) * step - icon_theme = gtk.icon_theme_get_default() + step = 5 + strength = round(perc / step) * step + icon_theme = gtk.icon_theme_get_default() - while strength <= 100: - icon_name = '%s-%03d' % (base_name, strength) - if icon_theme.has_icon(icon_name): - return icon_name + while strength <= 100: + icon_name = '%s-%03d' % (base_name, strength) + if icon_theme.has_icon(icon_name): + return icon_name - strength = strength + step + strength = strength + step -- cgit v0.9.1