Mercurial > fife-parpg
comparison engine/python/fife/extensions/pychan/widgets/__init__.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 | c770794d0a4a |
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 ### 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, ClickLabel | |
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 | |
48 # Global Widget Class registry | |
49 | |
50 WIDGETS = { | |
51 # Containers | |
52 "Container" : Container, | |
53 "Window" : Window, | |
54 "VBox" : VBox, | |
55 "HBox" : HBox, | |
56 "ScrollArea" :ScrollArea, | |
57 | |
58 # Simple Widgets | |
59 "Icon" : Icon, | |
60 "Label" : Label, | |
61 "ClickLabel" : ClickLabel, | |
62 | |
63 # Button Widgets | |
64 "Button" : Button, | |
65 "CheckBox" : CheckBox, | |
66 "RadioButton" : RadioButton, | |
67 "ImageButton" : ImageButton, | |
68 "ToggleButton" : ToggleButton, | |
69 | |
70 #Complexer Widgets / Text io | |
71 "TextField" : TextField, | |
72 "TextBox" : TextBox, | |
73 "ListBox" : ListBox, | |
74 "DropDown" : DropDown, | |
75 "Slider" : Slider | |
76 } | |
77 | |
78 def registerWidget(cls): | |
79 """ | |
80 Register a new Widget class for pychan. | |
81 """ | |
82 global WIDGETS | |
83 name = cls.__name__ | |
84 if name in WIDGETS: | |
85 raise InitializationError("Widget class name '%s' already registered." % name) | |
86 WIDGETS[name] = cls |