Mercurial > fife-parpg
comparison engine/python/fife/extensions/pychan/widgets/icon.py @ 378:64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 11 Jan 2010 23:34:52 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
377:fe6fb0e0ed23 | 378:64738befdf3b |
---|---|
1 # -*- coding: utf-8 -*- | |
2 | |
3 # #################################################################### | |
4 # Copyright (C) 2005-2009 by the FIFE team | |
5 # http://www.fifengine.de | |
6 # This file is part of FIFE. | |
7 # | |
8 # FIFE is free software; you can redistribute it and/or | |
9 # modify it under the terms of the GNU Lesser General Public | |
10 # License as published by the Free Software Foundation; either | |
11 # version 2.1 of the License, or (at your option) any later version. | |
12 # | |
13 # This library is distributed in the hope that it will be useful, | |
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 # Lesser General Public License for more details. | |
17 # | |
18 # You should have received a copy of the GNU Lesser General Public | |
19 # License along with this library; if not, write to the | |
20 # Free Software Foundation, Inc., | |
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
22 # #################################################################### | |
23 | |
24 from common import * | |
25 from widget import Widget | |
26 from fife.extensions.pychan.properties import ImageProperty | |
27 | |
28 class Icon(Widget): | |
29 """ | |
30 An image icon. | |
31 | |
32 New Attributes | |
33 ============== | |
34 | |
35 - image: String or GuiImage: The source location of the Image or a direct GuiImage | |
36 """ | |
37 ATTRIBUTES = Widget.ATTRIBUTES + [Attr('image')] | |
38 | |
39 def __init__(self,image="",**kwargs): | |
40 self.real_widget = fife.Icon(None) | |
41 super(Icon,self).__init__(**kwargs) | |
42 self.image = image | |
43 | |
44 _image = ImageProperty("Image") | |
45 | |
46 def _setImage(self,source): | |
47 self._image = source | |
48 # This is a bit odd. | |
49 # ... not sure whether to leave the sizes alone, but that might | |
50 # break layouts. yikes. | |
51 self.min_size = self.real_widget.getWidth(),self.real_widget.getHeight() | |
52 self.max_size = self.min_size | |
53 self.size = self.min_size | |
54 #print self._image, self.min_size, self.max_size | |
55 | |
56 def _getImage(self): | |
57 return self._image | |
58 image = property(_getImage,_setImage) |