root/trunk/RBRapier/RBRapier/Formats/Attic/SVG.old/SVGSkin/image.py

Revision 656, 2.3 kB (checked in by sholloway, 5 years ago)

*** empty log message ***

Line 
1 #!/usr/bin/env python
2 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 ##~ License
4 ##~
5 ##- The RuneBlade Foundation library is intended to ease some
6 ##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.)
7 ##- applications, while providing the flexibility to modularly change the
8 ##- architecture. Enjoy.
9 ##~
10 ##~ Copyright (C) 2002  TechGame Networks, LLC.
11 ##~
12 ##~ This library is free software; you can redistribute it and/or
13 ##~ modify it under the terms of the BSD style License as found in the
14 ##~ LICENSE file included with this distribution.
15 ##~
16 ##~ TechGame Networks, LLC can be reached at:
17 ##~ 3578 E. Hartsel Drive #211
18 ##~ Colorado Springs, Colorado, USA, 80920
19 ##~
20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 #~ Imports
24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25
26 from SVGSkinObject import SVGSkinObject
27 from RenderItems.Common import TransformableRenderItem
28
29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 #~ Definitions
31 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
33 class ImageRenderItem(TransformableRenderItem):
34     def DisplayOn(self, renderer):
35         renderer.DisplayImage(self)
36
37     def InterpretSettings(self, settings):
38         TransformableRenderItem.InterpretSettings(self, settings)
39
40         self.SetWidth(settings.get('width', '100%'))
41         self.SetHeight(settings.get('height', '100%'))
42
43         xlink = settings[('http://www.w3.org/1999/xlink', 'href')]
44         self.imagereference = xlink
45
46     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47
48     def GetWidth(self):
49         return self._width
50     def SetWidth(self, value):
51         width = self._asCoord(value)
52         if width < 0:
53             raise ValueError, '"width" attribute can not be negative"'
54         self._width = width
55     width = property(GetWidth, SetWidth)
56
57     def GetHeight(self):
58         return self._height
59     def SetHeight(self, value):
60         height = self._asCoord(value)
61         if height < 0:
62             raise ValueError, '"height" attribute can not be negative"'
63         self._height = height
64     height = property(GetHeight, SetHeight)
65
66 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
68 class image(SVGSkinObject):
69     RenderItemFactory = ImageRenderItem
70
Note: See TracBrowser for help on using the browser.