pylint icon, a few false positive left

This commit is contained in:
Marco Pesenti Gritti 2008-04-19 00:37:19 +02:00
parent 03e515b463
commit 97d9d21311

View File

@ -15,10 +15,8 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA. # Boston, MA 02111-1307, USA.
import os
import re import re
import math import math
import time
import logging import logging
import gobject import gobject
@ -26,9 +24,7 @@ import gtk
import hippo import hippo
import cairo import cairo
from sugar.graphics.style import Color
from sugar.graphics.xocolor import XoColor from sugar.graphics.xocolor import XoColor
from sugar.graphics import style
from sugar.graphics.palette import Palette, CanvasInvoker from sugar.graphics.palette import Palette, CanvasInvoker
from sugar.util import LRU from sugar.util import LRU
@ -79,6 +75,7 @@ class _IconBuffer(object):
def __init__(self): def __init__(self):
self.icon_name = None self.icon_name = None
self.icon_size = None
self.file_name = None self.file_name = None
self.fill_color = None self.fill_color = None
self.stroke_color = None self.stroke_color = None
@ -362,10 +359,11 @@ class Icon(gtk.Image):
if self.get_direction() != gtk.TEXT_DIR_LTR: if self.get_direction() != gtk.TEXT_DIR_LTR:
xalign = 1.0 - xalign xalign = 1.0 - xalign
x = math.floor(self.allocation.x + xpad + allocation = self.get_allocation()
(self.allocation.width - requisition[0]) * xalign) x = math.floor(allocation.x + xpad +
y = math.floor(self.allocation.y + ypad + (allocation.width - requisition[0]) * xalign)
(self.allocation.height - requisition[1]) * yalign) y = math.floor(allocation.y + ypad +
(allocation.height - requisition[1]) * yalign)
cr = self.window.cairo_create() cr = self.window.cairo_create()
cr.set_source_surface(surface, x, y) cr.set_source_surface(surface, x, y)
@ -464,7 +462,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
self._buffer.height = value self._buffer.height = value
self.emit_request_changed() self.emit_request_changed()
elif pspec.name == 'scale': 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: if self._buffer.scale != value:
self._buffer.scale = value self._buffer.scale = value
self.emit_request_changed() self.emit_request_changed()
@ -546,13 +545,13 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
palette = property(get_palette, set_palette) palette = property(get_palette, set_palette)
def get_icon_state(base_name, perc): def get_icon_state(base_name, perc):
step = 5 step = 5
strength = round(perc / step) * step strength = round(perc / step) * step
icon_theme = gtk.icon_theme_get_default() icon_theme = gtk.icon_theme_get_default()
while strength <= 100: while strength <= 100:
icon_name = '%s-%03d' % (base_name, strength) icon_name = '%s-%03d' % (base_name, strength)
if icon_theme.has_icon(icon_name): if icon_theme.has_icon(icon_name):
return icon_name return icon_name
strength = strength + step strength = strength + step