Adjust named icons terminology a bit
This commit is contained in:
parent
9a8d5ac32a
commit
b8e96d08ae
@ -18,19 +18,19 @@
|
|||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
class Icon(gtk.Image):
|
class Icon(gtk.Image):
|
||||||
def __init__(self, icon_resource, size=gtk.ICON_SIZE_LARGE_TOOLBAR):
|
def __init__(self, name, size=gtk.ICON_SIZE_LARGE_TOOLBAR):
|
||||||
gtk.Image.__init__(self)
|
gtk.Image.__init__(self)
|
||||||
|
|
||||||
icon_theme = gtk.icon_theme_get_for_screen(self.get_screen())
|
icon_theme = gtk.icon_theme_get_for_screen(self.get_screen())
|
||||||
icon_set = gtk.IconSet()
|
icon_set = gtk.IconSet()
|
||||||
|
|
||||||
normal_name = icon_resource
|
normal_name = name
|
||||||
if icon_theme.has_icon(normal_name):
|
if icon_theme.has_icon(normal_name):
|
||||||
source = gtk.IconSource()
|
source = gtk.IconSource()
|
||||||
source.set_icon_name(normal_name)
|
source.set_icon_name(normal_name)
|
||||||
icon_set.add_source(source)
|
icon_set.add_source(source)
|
||||||
|
|
||||||
inactive_name = icon_resource + '-inactive'
|
inactive_name = name + '-inactive'
|
||||||
if icon_theme.has_icon(inactive_name):
|
if icon_theme.has_icon(inactive_name):
|
||||||
source = gtk.IconSource()
|
source = gtk.IconSource()
|
||||||
source.set_icon_name(inactive_name)
|
source.set_icon_name(inactive_name)
|
||||||
|
@ -20,9 +20,9 @@ import gtk
|
|||||||
from sugar.graphics.icon import Icon
|
from sugar.graphics.icon import Icon
|
||||||
|
|
||||||
class ToggleToolButton(gtk.ToggleToolButton):
|
class ToggleToolButton(gtk.ToggleToolButton):
|
||||||
def __init__(self, icon_resource=None):
|
def __init__(self, named_icon=None):
|
||||||
gtk.ToggleToolButton.__init__(self)
|
gtk.ToggleToolButton.__init__(self)
|
||||||
|
|
||||||
icon = Icon(icon_resource)
|
icon = Icon(named_icon)
|
||||||
self.set_icon_widget(icon)
|
self.set_icon_widget(icon)
|
||||||
icon.show()
|
icon.show()
|
||||||
|
@ -20,9 +20,9 @@ import gtk
|
|||||||
from sugar.graphics.icon import Icon
|
from sugar.graphics.icon import Icon
|
||||||
|
|
||||||
class ToolButton(gtk.ToolButton):
|
class ToolButton(gtk.ToolButton):
|
||||||
def __init__(self, icon_resource=None):
|
def __init__(self, named_icon=None):
|
||||||
gtk.ToolButton.__init__(self)
|
gtk.ToolButton.__init__(self)
|
||||||
|
|
||||||
icon = Icon(icon_resource)
|
icon = Icon(named_icon)
|
||||||
self.set_icon_widget(icon)
|
self.set_icon_widget(icon)
|
||||||
icon.show()
|
icon.show()
|
||||||
|
Loading…
Reference in New Issue
Block a user