1 from gi.repository
import GObject, GooCanvas
40 'The x coordinate of a SVG image',
44 GObject.PARAM_READWRITE),
48 'The y coordinate of a SVG image',
52 GObject.PARAM_READWRITE),
56 'The width of the SVG Image',
60 GObject.PARAM_READWRITE),
64 'The width of the SVG Image',
68 GObject.PARAM_READWRITE),
71 def __init__(self, x, y, rsvg_handle, **kwargs):
74 @param self this object
75 @param x The x coordinate of a SVG image
76 @param y The y coordinate of a SVG image
77 @param rsvg_handle SVG handle
78 @param kwargs key-value arguments
80 super(SvgItem, self).
__init__(**kwargs)
81 assert isinstance(rsvg_handle, rsvg.Handle)
95 @param self this object
96 @param pspec property name
97 @param value property value
98 @return exception if unknown property
100 if pspec.name ==
'x':
106 elif pspec.name ==
'y':
112 elif pspec.name ==
'width':
119 elif pspec.name ==
'height':
127 raise AttributeError(
'unknown property %s' % pspec.name)
131 Size Changed function
132 @param self this object
133 @return exception if unknown property
143 self.
sysy = self.
sxsx
148 self.
sxsx = self.
sysy
159 @param self this object
160 @param pspec property name
161 @return property value or exception if unknown property
163 if pspec.name ==
'x':
166 elif pspec.name ==
'y':
169 elif pspec.name ==
'width':
173 return self.
widthwidth
175 elif pspec.name ==
'height':
179 raise AttributeError(
'unknown property %s' % pspec.name)
183 Simple Paint function
184 @param self this object
189 cr.translate(self.
xx, self.
yy)
190 cr.scale(self.
sxsx, self.
sysy)
191 self.
handlehandle.render_cairo(cr)
195 Simple Update function
196 @param self this object
207 Simple Is Item At function
208 @param self this object
209 @param x the X position
210 @param y the Y position
212 @param is_pointer_event is the event a pointer event
213 @return true if at or false if not
215 if ((x < self.
xx)
or (x > self.
xx + self.
widthwidth))
or ((y < self.
yy)
or (y > self.
yy + self.
heightheight)):
225 return _rsvg_cache[base_file_name]
227 full_path = os.path.join(os.path.dirname(__file__),
'resource', base_file_name)
228 rsvg_handle = rsvg.Handle(full_path)
229 _rsvg_cache[base_file_name] = rsvg_handle
def do_simple_update(self, cr)
Simple Update function.
custom_height
custom height
def do_simple_is_item_at(self, x, y, cr, is_pointer_event)
Simple Is Item At function.
def _size_changed(self)
Size Changed function.
def do_get_property(self, pspec)
Get Property.
def do_simple_paint(self, cr, bounds)
Simple Paint function.
def __init__(self, x, y, rsvg_handle, **kwargs)
Initializer.
def do_set_property(self, pspec, value)
Set Property.
def rsvg_handle_factory(base_file_name)