41 'The x coordinate of a SVG image',
45 gobject.PARAM_READWRITE),
49 'The y coordinate of a SVG image',
53 gobject.PARAM_READWRITE),
57 'The width of the SVG Image',
61 gobject.PARAM_READWRITE),
65 'The width of the SVG Image',
69 gobject.PARAM_READWRITE),
72 def __init__(self, x, y, rsvg_handle, **kwargs):
75 @param self this object
77 super(SvgItem, self).
__init__(**kwargs)
78 assert isinstance(rsvg_handle, rsvg.Handle)
84 self.
width = self.handle.props.width
85 self.
height = self.handle.props.height
92 @param self this object
93 @param pspec property name
94 @param value property value
95 @return exception if unknown property
103 elif pspec.name ==
'y':
109 elif pspec.name ==
'width':
116 elif pspec.name ==
'height':
124 raise AttributeError,
'unknown property %s' % pspec.name
128 Size Changed function
129 @param self this object
130 @return exception if unknown property
133 self.
width = self.handle.props.width
134 self.
height = self.handle.props.height
141 self.
height = self.handle.props.height*self.
sy
146 self.
width = self.handle.props.width*self.
sx
156 @param self this object
157 @param pspec property name
158 @return property value or exception if unknown property
160 if pspec.name ==
'x':
163 elif pspec.name ==
'y':
166 elif pspec.name ==
'width':
167 self.
width = self.handle.props.width
168 self.
height = self.handle.props.height
172 elif pspec.name ==
'height':
176 raise AttributeError,
'unknown property %s' % pspec.name
180 Simple Paint function
181 @param self this object
186 cr.translate(self.
x, self.
y)
187 cr.scale(self.
sx, self.
sy)
188 self.handle.render_cairo(cr)
192 Simple Update function
193 @param self this object
204 Simple Is Item At function
205 @param self this object
206 @param x the X position
207 @param y the Y position
209 @param is_pointer_event is the event a pointer event
210 @return true if at or false if not
212 if ((x < self.
x)
or (x > self.
x + self.
width))
or ((y < self.
y)
or (y > self.
y + self.
height)):
222 return _rsvg_cache[base_file_name]
224 full_path = os.path.join(os.path.dirname(__file__),
'resource', base_file_name)
225 rsvg_handle = rsvg.Handle(full_path)
226 _rsvg_cache[base_file_name] = rsvg_handle
def rsvg_handle_factory(base_file_name)
def do_get_property(self, pspec)
Get Property.
def do_simple_update(self, cr)
Simple Update function.
def do_simple_paint(self, cr, bounds)
Simple Paint function.
def do_simple_is_item_at(self, x, y, cr, is_pointer_event)
Simple Is Item At function.
custom_height
custom height
def do_set_property(self, pspec, value)
Set Property.
def __init__(self, x, y, rsvg_handle, kwargs)
def _size_changed(self)
Size Changed function.