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
76 super(SvgItem, self).
__init__(**kwargs)
77 assert isinstance(rsvg_handle, rsvg.Handle)
91 @param self this object
92 @param pspec property name
93 @param value property value
94 @return exception if unknown property
102 elif pspec.name ==
'y':
108 elif pspec.name ==
'width':
115 elif pspec.name ==
'height':
123 raise AttributeError(
'unknown property %s' % pspec.name)
127 Size Changed function
128 @param self this object
129 @return exception if unknown property
139 self.
sysy = self.
sxsx
144 self.
sxsx = self.
sysy
155 @param self this object
156 @param pspec property name
157 @return property value or exception if unknown property
159 if pspec.name ==
'x':
162 elif pspec.name ==
'y':
165 elif pspec.name ==
'width':
169 return self.
widthwidth
171 elif pspec.name ==
'height':
175 raise AttributeError(
'unknown property %s' % pspec.name)
179 Simple Paint function
180 @param self this object
185 cr.translate(self.
xx, self.
yy)
186 cr.scale(self.
sxsx, self.
sysy)
187 self.
handlehandle.render_cairo(cr)
191 Simple Update function
192 @param self this object
203 Simple Is Item At function
204 @param self this object
205 @param x the X position
206 @param y the Y position
208 @param is_pointer_event is the event a pointer event
209 @return true if at or false if not
211 if ((x < self.
xx)
or (x > self.
xx + self.
widthwidth))
or ((y < self.
yy)
or (y > self.
yy + self.
heightheight)):
221 return _rsvg_cache[base_file_name]
223 full_path = os.path.join(os.path.dirname(__file__),
'resource', base_file_name)
224 rsvg_handle = rsvg.Handle(full_path)
225 _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)
def do_set_property(self, pspec, value)
Set Property.
def rsvg_handle_factory(base_file_name)