root/src/buildingDescription.py @ 285

Revision 285, 1.6 KB (checked in by mmorton, 2 years ago)

build menus working in full, build button broken

Line 
1'''
2Created on Mar 23, 2012
3
4@author: TechTrek
5'''
6
7from window import Window
8from rectangle import Rectangle
9from text import Text
10from image import Image
11from description import Description
12from detailedDescription import DetailedDescription
13from simpleButton import SimpleButton
14from globals import *
15
16class BuildDescription(DetailedDescription):
17    def __init__(self, pos, visible, description):
18        if description == None:
19            print "description is none"
20        if description.title == None:
21            print "title is none"
22        DetailedDescription.__init__(self, pos, visible, False)
23        self.text.append(Text((self.pos[0] + 5, self.pos[1] + 5), description.title, MD_TEXT, WHITE))
24        self.text.append(Text((self.pos[0] + 5, self.pos[1] + 20), description.text, MD_TEXT, WHITE))
25        self.images.append(Image((self.pos[0] + 390, self.pos[1] + 5), ICON_SIZE, ICON_SIZE, description.icon))
26
27        self.subwindows.append(SimpleButton((self.pos[0] + 215, self.pos[1] + 45), True, "Build"))
28        self.subwindows.append(SimpleButton((self.pos[0] + 215, self.pos[1] + 60), True, "Cancel"))
29
30    def setYesResponse(self,response):
31        self.subwindows[0].addResponse((response[0],))
32       
33    def setNoResponse(self,response):
34        self.subwindows[1].addResponse(response)
35   
36    def toggle(self):
37        print "toggling"
38        self.visible = not self.visible
39        for window in self.subwindows:
40            window.toggle()
41       
42    def openWindow(self):
43        self.visible = True
44        for window in self.subwindows:
45            window.openWindow()
Note: See TracBrowser for help on using the browser.