Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/graphics
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2008-04-18 22:50:46 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2008-04-18 22:50:46 (GMT)
commit8783d1113d945b25d5deedae574be52dcf4d34e5 (patch)
tree3b41bddaeca5ad780c8650904acd91482f67955d /sugar/graphics
parent97d9d21311e53a0167fcb7cd6903487fea37595e (diff)
pylint combobox, iconentry and radiotoolbutton
Diffstat (limited to 'sugar/graphics')
-rw-r--r--sugar/graphics/combobox.py22
-rw-r--r--sugar/graphics/iconentry.py2
-rw-r--r--sugar/graphics/radiotoolbutton.py22
3 files changed, 21 insertions, 25 deletions
diff --git a/sugar/graphics/combobox.py b/sugar/graphics/combobox.py
index 5584267..2924fb3 100644
--- a/sugar/graphics/combobox.py
+++ b/sugar/graphics/combobox.py
@@ -14,9 +14,6 @@
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-import sys
-import os
-import logging
import gobject
import gtk
@@ -44,17 +41,17 @@ class ComboBox(gtk.ComboBox):
def do_get_property(self, pspec):
if pspec.name == 'value':
- row = self.get_active_item()
- if not row:
+ row = self.get_active_item()
+ if not row:
return None
- return row[0]
+ return row[0]
else:
return gtk.ComboBox.do_get_property(self, pspec)
def _get_real_name_from_theme(self, name, size):
icon_theme = gtk.icon_theme_get_default()
width, height = gtk.icon_size_lookup(size)
- info = icon_theme.lookup_icon(name, width, 0)
+ info = icon_theme.lookup_icon(name, max(width, height), 0)
if not info:
raise ValueError("Icon '" + name + "' not found.")
fname = info.get_filename()
@@ -66,8 +63,9 @@ class ComboBox(gtk.ComboBox):
self._icon_renderer = gtk.CellRendererPixbuf()
settings = self.get_settings()
- w, h = gtk.icon_size_lookup_for_settings(settings, gtk.ICON_SIZE_MENU)
- self._icon_renderer.props.stock_size = w
+ w, h = gtk.icon_size_lookup_for_settings(
+ settings, gtk.ICON_SIZE_MENU)
+ self._icon_renderer.props.stock_size = max(w, h)
self.pack_start(self._icon_renderer, False)
self.add_attribute(self._icon_renderer, 'pixbuf', 2)
@@ -87,7 +85,8 @@ class ComboBox(gtk.ComboBox):
if icon_name:
file_name = self._get_real_name_from_theme(icon_name, size)
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(file_name, width, height)
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
+ file_name, width, height)
else:
pixbuf = None
@@ -110,5 +109,4 @@ class ComboBox(gtk.ComboBox):
self._model.clear()
def _is_separator(self, model, row):
- action_id, text, icon_name, is_separator = model[row]
- return is_separator
+ return model[row][3]
diff --git a/sugar/graphics/iconentry.py b/sugar/graphics/iconentry.py
index a1fed31..df38b9e 100644
--- a/sugar/graphics/iconentry.py
+++ b/sugar/graphics/iconentry.py
@@ -21,7 +21,6 @@ from sugar import _sugarext
from sugar.graphics import style
from sugar.graphics.icon import _SVGLoader
-import sugar.profile
ICON_ENTRY_PRIMARY = _sugarext.ICON_ENTRY_PRIMARY
ICON_ENTRY_SECONDARY = _sugarext.ICON_ENTRY_SECONDARY
@@ -44,7 +43,6 @@ class IconEntry(_sugarext.IconEntry):
if icon_info.get_filename().endswith('.svg'):
loader = _SVGLoader()
- color = sugar.profile.get_color()
entities = {'fill_color': style.COLOR_TOOLBAR_GREY.get_svg(),
'stroke_color': style.COLOR_TOOLBAR_GREY.get_svg()}
handle = loader.load(icon_info.get_filename(), entities, None)
diff --git a/sugar/graphics/radiotoolbutton.py b/sugar/graphics/radiotoolbutton.py
index 8cccefc..3fc815b 100644
--- a/sugar/graphics/radiotoolbutton.py
+++ b/sugar/graphics/radiotoolbutton.py
@@ -16,8 +16,6 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-import logging
-
import gtk
import gobject
@@ -85,20 +83,22 @@ class RadioToolButton(gtk.RadioToolButton):
self._palette = palette
self._palette.props.invoker = ToolInvoker(self)
- palette = gobject.property(type=object, setter=set_palette, getter=get_palette)
+ palette = gobject.property(
+ type=object, setter=set_palette, getter=get_palette)
def do_expose_event(self, event):
+ child = self.get_child()
+ allocation = self.get_allocation()
+
if self._palette and self._palette.is_up():
invoker = self._palette.props.invoker
invoker.draw_rectangle(event, self._palette)
- elif self.child.state == gtk.STATE_PRELIGHT:
- self.child.style.paint_box(event.window, gtk.STATE_PRELIGHT,
- gtk.SHADOW_NONE, event.area,
- self.child, "toolbutton-prelight",
- self.allocation.x,
- self.allocation.y,
- self.allocation.width,
- self.allocation.height)
+ elif child.state == gtk.STATE_PRELIGHT:
+ child.style.paint_box(event.window, gtk.STATE_PRELIGHT,
+ gtk.SHADOW_NONE, event.area,
+ child, "toolbutton-prelight",
+ allocation.x, allocation.y,
+ allocation.width, allocation.height)
gtk.RadioToolButton.do_expose_event(self, event)