Package fife :: Package extensions :: Package pychan :: Package widgets' :: Module icon
[hide private]
[frames] | no frames]

Source Code for Module fife.extensions.pychan.widgets'.icon

  1  # -*- coding: utf-8 -*- 
  2   
  3  # #################################################################### 
  4  #  Copyright (C) 2005-2011 by the FIFE team 
  5  #  http://www.fifengine.net 
  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, 40 parent = None, 41 name = None, 42 size = None, 43 min_size = None, 44 max_size = None, 45 helptext = None, 46 position = None, 47 style = None, 48 hexpand = None, 49 vexpand = None, 50 font = None, 51 base_color = None, 52 background_color = None, 53 foreground_color = None, 54 selection_color = None, 55 border_size = None, 56 position_technique = None, 57 is_focusable = None, 58 comment = None, 59 image = None):
60 61 self.real_widget = fife.Icon(None) 62 super(Icon,self).__init__(parent=parent, 63 name=name, 64 size=size, 65 min_size=min_size, 66 max_size=max_size, 67 helptext=helptext, 68 position=position, 69 style=style, 70 hexpand=hexpand, 71 vexpand=vexpand, 72 font=font, 73 base_color=base_color, 74 background_color=background_color, 75 foreground_color=foreground_color, 76 selection_color=selection_color, 77 border_size=border_size, 78 position_technique=position_technique, 79 is_focusable=is_focusable, 80 comment=comment) 81 self.image = image
82
83 - def clone(self, prefix):
84 iconClone = Icon(None, 85 self._createNameWithPrefix(prefix), 86 self.size, 87 self.min_size, 88 self.max_size, 89 self.helptext, 90 self.position, 91 self.style, 92 self.hexpand, 93 self.vexpand, 94 self.font, 95 self.base_color, 96 self.background_color, 97 self.foreground_color, 98 self.selection_color, 99 self.border_size, 100 self.position_technique, 101 self.is_focusable, 102 self.comment, 103 self.image) 104 105 106 return iconClone
107 108 _image = ImageProperty("Image") 109
110 - def _setImage(self,source):
111 self._image = source
112
113 - def _getImage(self):
114 return self._image
115 image = property(_getImage,_setImage)
116