ocarina/src/extra/gtknodes/image.py

31 lines
695 B
Python

#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$May 18, 2010 5:05:58 PM$"
import gtk
from ct import path
from gtknodes import Node
class Image(Node):
def __init__(self,elm):
Node.__init__(self,elm)
self["src"] = "none"
self["size"] = "button"
self.part = gtk.Image()
self.setattrs()
if self["src"] != "none":
file = path.expand(self["src"])
if path.exists(file) == True:
self.part.set_from_file( file )
else:
func = "self.part.set_from_stock("
func += "gtk.STOCK_"+self["src"].upper()
func += ", gtk.ICON_SIZE_" + self["size"].upper() + ")"
exec func