| 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.Shapes import ShapeRenderItem |
|---|
| 28 |
|
|---|
| 29 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 30 |
#~ Definitions |
|---|
| 31 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 32 |
|
|---|
| 33 |
class EllipseRenderItem(ShapeRenderItem): |
|---|
| 34 |
def DisplayOn(self, renderer): |
|---|
| 35 |
renderer.DisplayEllipse(self) |
|---|
| 36 |
|
|---|
| 37 |
def InterpretSettings(self, settings): |
|---|
| 38 |
ShapeRenderItem.InterpretSettings(self, settings) |
|---|
| 39 |
self.cx = settings.get('cx', 0.) |
|---|
| 40 |
self.cy = settings.get('cy', 0.) |
|---|
| 41 |
self.rx = settings.get('rx', 0.) |
|---|
| 42 |
self.ry = settings.get('ry', 0.) |
|---|
| 43 |
|
|---|
| 44 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 45 |
|
|---|
| 46 |
def GetCX(self): |
|---|
| 47 |
return self._cx |
|---|
| 48 |
def SetCX(self, value): |
|---|
| 49 |
self._cx = self._asCoord(value) |
|---|
| 50 |
cx = property(GetCX, SetCX) |
|---|
| 51 |
|
|---|
| 52 |
def GetCY(self): |
|---|
| 53 |
return self._cy |
|---|
| 54 |
def SetCY(self, value): |
|---|
| 55 |
self._cy = self._asCoord(value) |
|---|
| 56 |
cy = property(GetCY, SetCY) |
|---|
| 57 |
|
|---|
| 58 |
def GetRadius(self): |
|---|
| 59 |
raise ValueError, 'Ellipse "radius" can only be set, not read' |
|---|
| 60 |
def SetRadius(self, value): |
|---|
| 61 |
self.SetRX(value) |
|---|
| 62 |
self.SetRY(value) |
|---|
| 63 |
#r = radius = property(GetRadius, SetRadius) |
|---|
| 64 |
|
|---|
| 65 |
def GetRX(self, useRYifempty=True): |
|---|
| 66 |
try: |
|---|
| 67 |
return self._rx |
|---|
| 68 |
except AttributeError: |
|---|
| 69 |
if useRYifempty: |
|---|
| 70 |
return self.GetRY(self, useRXifempty=False) |
|---|
| 71 |
def SetRX(self, value): |
|---|
| 72 |
rx = self._asCoord(value) |
|---|
| 73 |
if rx < 0: |
|---|
| 74 |
raise ValueError, '"rx" attribute can not be negative"' |
|---|
| 75 |
self._rx = rx |
|---|
| 76 |
rx = property(GetRX, SetRX) |
|---|
| 77 |
|
|---|
| 78 |
def GetRY(self, useRXifempty=True): |
|---|
| 79 |
try: |
|---|
| 80 |
return self._ry |
|---|
| 81 |
except AttributeError: |
|---|
| 82 |
if useRXifempty: |
|---|
| 83 |
return self.GetRY(self, useRYifempty=False) |
|---|
| 84 |
def SetRY(self, value): |
|---|
| 85 |
ry = self._asCoord(value) |
|---|
| 86 |
if ry < 0: |
|---|
| 87 |
raise ValueError, '"ry" attribute can not be negative"' |
|---|
| 88 |
self._ry = ry |
|---|
| 89 |
ry = property(GetRY, SetRY) |
|---|
| 90 |
|
|---|
| 91 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 92 |
|
|---|
| 93 |
class ellipse(SVGSkinObject): |
|---|
| 94 |
RenderItemFactory = EllipseRenderItem |
|---|
| 95 |
|
|---|