comparison gui/popups.py @ 0:7a89ea5404b1

Initial commit of parpg-core.
author M. George Hansen <technopolitica@gmail.com>
date Sat, 14 May 2011 01:12:35 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:7a89ea5404b1
1 #/usr/bin/python
2
3 # This file is part of PARPG.
4
5 # PARPG is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9
10 # PARPG is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with PARPG. If not, see <http://www.gnu.org/licenses/>.
17
18 from fife.extensions import pychan
19
20 class ExaminePopup():
21 """Create a popup for when you click examine on an object"""
22 def __init__(self, engine, object_title, desc):
23 """Initialize the popup
24 @type engine: fife.Engine
25 @param engine: an instance of the fife engine
26 @type object_title: string
27 @param object_title: The title for the window, probably should just
28 be the name of the object
29 @type desc: string
30 @param desc: The description of the object
31 @return: None"""
32 self.engine = engine
33
34 self.examine_window = pychan.widgets.\
35 Window(title=unicode(object_title),
36 position_technique="center:center",
37 min_size=(175,175))
38
39 self.scroll = pychan.widgets.ScrollArea(name='scroll', size=(150,150))
40 self.description = pychan.widgets.Label(name='descText',
41 text=unicode(desc),
42 wrap_text=True)
43 self.description.max_width = 170
44 self.scroll.addChild(self.description)
45 self.examine_window.addChild(self.scroll)
46
47 self.close_button = pychan.widgets.Button(name='closeButton',
48 text=unicode('Close'))
49 self.examine_window.addChild(self.close_button)
50
51 self.examine_window.mapEvents({'closeButton':self.examine_window.hide})
52
53 def closePopUp(self):
54 # TODO: missing function information
55 if self.examine_window.isVisible():
56 self.examine_window.hide()
57
58 def showPopUp(self):
59 # TODO: missing function information
60 self.examine_window.show()