Show
Ignore:
Timestamp:
03/25/2012 12:55:42 AM (2 years ago)
Author:
mmorton
Message:

build menus working in full, build button broken

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/buildingDescription.py

    r249 r285  
    66 
    77from window import Window 
    8 from rectanlge import Rectangle 
     8from rectangle import Rectangle 
    99from text import Text 
    1010from image import Image 
     
    1212from detailedDescription import DetailedDescription 
    1313from simpleButton import SimpleButton 
     14from globals import * 
    1415 
    1516class BuildDescription(DetailedDescription): 
    1617    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" 
    1722        DetailedDescription.__init__(self, pos, visible, False) 
    1823        self.text.append(Text((self.pos[0] + 5, self.pos[1] + 5), description.title, MD_TEXT, WHITE)) 
    1924        self.text.append(Text((self.pos[0] + 5, self.pos[1] + 20), description.text, MD_TEXT, WHITE)) 
    20         self.image.append(Image((self.pos[0] + 390, self.pos[1] + 5), ICON_SIZE, ICON_SIZE, description.icon)) 
     25        self.images.append(Image((self.pos[0] + 390, self.pos[1] + 5), ICON_SIZE, ICON_SIZE, description.icon)) 
    2126 
    2227        self.subwindows.append(SimpleButton((self.pos[0] + 215, self.pos[1] + 45), True, "Build")) 
    2328        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()