diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2011-03-15 14:47:01 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2011-03-15 14:47:01 (GMT) |
commit | cb564e644950b866a83834cb055dced8b7ea22bf (patch) | |
tree | cfb11dee2818bfe9efaa04e89f21bf1268edac49 | |
parent | dc3616f4dad25a010424ef3c31b2640ffa5c375a (diff) |
Add icon viewer
-rw-r--r-- | icon.py | 5 | ||||
-rw-r--r-- | icon_viewer.py | 22 |
2 files changed, 25 insertions, 2 deletions
@@ -61,7 +61,8 @@ class _SVGLoader(object): logging.error( 'Icon %s, entity %s is invalid.', file_name, entity) - import rsvg # XXX this is very slow! why? + # XXX this is very slow! why? + import rsvg return rsvg.Handle(data=icon) @@ -246,7 +247,7 @@ class _IconBuffer(object): # -- 2007-12-14 Benjamin Berg pixbuf = widget.style.render_icon(icon_source, widget.get_direction(), gtk.STATE_INSENSITIVE, -1, widget, - "sugar-icon") + 'sugar-icon') return pixbuf diff --git a/icon_viewer.py b/icon_viewer.py new file mode 100644 index 0000000..ef94ec6 --- /dev/null +++ b/icon_viewer.py @@ -0,0 +1,22 @@ +import cairo +import gtk +import sys + +from icon import Icon +from xocolor import XoColor + +def main(): + if len(sys.argv) == 1: + print "Use icon_viewer icon_file.svg" + return + icon_file_name = sys.argv[1] + win = gtk.Window() + win.connect('destroy', gtk.main_quit) + win.set_default_size(450, 550) + test_icon = Icon(file=icon_file_name, pixel_size=100, xo_color=XoColor('#FF8F00,#FF2B34')) + win.add(test_icon) + win.show_all() + gtk.main() + +if __name__ == '__main__': + main() |