some attr reorganization
[PyX/mjg.git] / pyx / base.py
blob296cbd393bb909d44dba1c314741643cacb0a1ed
1 #!/usr/bin/env python
2 # -*- coding: ISO-8859-1 -*-
5 # Copyright (C) 2002 Jörg Lehmann <joergl@users.sourceforge.net>
6 # Copyright (C) 2002 André Wobst <wobsta@users.sourceforge.net>
8 # This file is part of PyX (http://pyx.sourceforge.net/).
10 # PyX is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # PyX is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with PyX; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 # Postscript operators
28 class PSOp:
30 """Poscript Operators
32 Everything, you can write in a (E)PS file
34 """
36 def write(self, file):
37 """writing into a file is the only routine, a PSOp has to supply"""
38 raise NotImplementedError, "cannot call virtual method write()"
40 def prolog(self):
41 """return list of prolog items"""
42 return []
45 # PSCmd class
48 class PSCmd(PSOp):
50 """ PSCmd is the base class of all visible elements
52 Visible elements are those, that can be embedded in the Canvas
53 and posses a bbox.
55 """
57 def bbox(self):
58 raise NotImplementedError, "cannot call virtual method bbox()"
61 # attribute classification
64 # XXX is any fillattr also a strokeattr
65 # (could be defined by inheritance here once and for all)
67 class strokeattr(PSOp): pass
69 class fillattr(PSOp): pass
72 # PyX Exception class
75 class PyXExcept(Exception):
77 """base class for all PyX Exceptions"""
79 pass