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

Source Code for Package fife.extensions.pychan.widgets'

 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  ### Widget/Container Base Classes ### 
25   
26  """ 
27  Widget wrappers. 
28   
29  Please look at the documentation of L{Widget} for details. 
30  """ 
31   
32  from widget import Widget 
33   
34  from layout import Spacer 
35  from containers import Container, VBox, HBox, Window 
36  from label import Label 
37  from icon import Icon 
38  from buttons import Button, ToggleButton, ImageButton 
39  from checkbox import CheckBox 
40  from radiobutton import RadioButton 
41  from textfield import TextField 
42  from textbox import TextBox 
43  from listbox import ListBox 
44  from dropdown import DropDown 
45  from scrollarea import ScrollArea 
46  from slider import Slider 
47  from percentagebar import PercentageBar 
48   
49  # Global Widget Class registry 
50   
51  WIDGETS = { 
52          # Containers 
53          "Container" : Container, 
54          "Window" : Window, 
55          "VBox" : VBox, 
56          "HBox" : HBox, 
57          "ScrollArea" :ScrollArea, 
58   
59          # Simple Widgets 
60          "Icon" : Icon, 
61          "Label" : Label, 
62          "PercentageBar" : PercentageBar, 
63   
64          # Button Widgets 
65          "Button" : Button, 
66          "CheckBox" : CheckBox, 
67          "RadioButton" : RadioButton, 
68          "ImageButton" : ImageButton, 
69          "ToggleButton" : ToggleButton, 
70   
71          #Complexer Widgets / Text io 
72          "TextField" : TextField, 
73          "TextBox" : TextBox, 
74          "ListBox" : ListBox, 
75          "DropDown" : DropDown, 
76          "Slider" : Slider 
77  } 
78   
79 -def registerWidget(cls):
80 """ 81 Register a new Widget class for pychan. 82 """ 83 global WIDGETS 84 name = cls.__name__ 85 if name in WIDGETS: 86 raise InitializationError("Widget class name '%s' already registered." % name) 87 WIDGETS[name] = cls
88