13 'The x coordinate of a SVG image',
17 gobject.PARAM_READWRITE),
21 'The y coordinate of a SVG image',
25 gobject.PARAM_READWRITE),
29 'The width of the SVG Image',
33 gobject.PARAM_READWRITE),
37 'The width of the SVG Image',
41 gobject.PARAM_READWRITE),
44 def __init__(self, x, y, rsvg_handle, **kwargs):
45 super(SvgItem, self).
__init__(**kwargs)
46 assert isinstance(rsvg_handle, rsvg.Handle)
52 self.
width = self.handle.props.width
53 self.
height = self.handle.props.height
64 elif pspec.name ==
'y':
70 elif pspec.name ==
'width':
77 elif pspec.name ==
'height':
85 raise AttributeError,
'unknown property %s' % pspec.name
89 self.
width = self.handle.props.width
90 self.
height = self.handle.props.height
97 self.
height = self.handle.props.height*self.
sy
102 self.
width = self.handle.props.width*self.
sx
110 if pspec.name ==
'x':
113 elif pspec.name ==
'y':
116 elif pspec.name ==
'width':
117 self.
width = self.handle.props.width
118 self.
height = self.handle.props.height
122 elif pspec.name ==
'height':
126 raise AttributeError,
'unknown property %s' % pspec.name
129 cr.translate(self.
x, self.
y)
130 cr.scale(self.
sx, self.
sy)
131 self.handle.render_cairo(cr)
140 if ((x < self.
x)
or (x > self.
x + self.
width))
or ((y < self.
y)
or (y > self.
y + self.
height)):
150 return _rsvg_cache[base_file_name]
152 full_path = os.path.join(os.path.dirname(__file__),
'resource', base_file_name)
153 rsvg_handle = rsvg.Handle(full_path)
154 _rsvg_cache[base_file_name] = rsvg_handle
def rsvg_handle_factory(base_file_name)
def do_get_property(self, pspec)
def do_simple_update(self, cr)
def do_simple_paint(self, cr, bounds)
def do_simple_is_item_at(self, x, y, cr, is_pointer_event)
def do_set_property(self, pspec, value)
def __init__(self, x, y, rsvg_handle, kwargs)