Package horizons :: Package gui :: Package modules :: Module aidataselection
[hide private]
[frames] | no frames]

Source Code for Module horizons.gui.modules.aidataselection

 1  # ################################################### 
 2  # Copyright (C) 2008-2017 The Unknown Horizons Team 
 3  # team@unknown-horizons.org 
 4  # This file is part of Unknown Horizons. 
 5  # 
 6  # Unknown Horizons is free software; you can redistribute it and/or modify 
 7  # it under the terms of the GNU General Public License as published by 
 8  # the Free Software Foundation; either version 2 of the License, or 
 9  # (at your option) any later version. 
10  # 
11  # This program is distributed in the hope that it will be useful, 
12  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  # GNU General Public License for more details. 
15  # 
16  # You should have received a copy of the GNU General Public License 
17  # along with this program; if not, write to the 
18  # Free Software Foundation, Inc., 
19  # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
20  # ################################################### 
21   
22  import horizons.globals 
23  from horizons.constants import MULTIPLAYER 
24  from horizons.gui.util import load_uh_widget 
25   
26   
27 -class AIDataSelection:
28 """Subwidget for selecting AI settings.""" 29
30 - def __init__(self):
31 self.gui = load_uh_widget('aidataselection.xml') 32 33 self.gui.distributeInitialData({'ai_players': [str(n) for n in range(MULTIPLAYER.MAX_PLAYER_COUNT)]}) 34 self.gui.distributeData({ 35 'ai_players': int(horizons.globals.fife.get_uh_setting("AIPlayers")) 36 })
37
38 - def get_ai_players(self):
39 """Returns the number that was entered by the user""" 40 return self.gui.collectData('ai_players')
41
42 - def show(self):
43 self.gui.show()
44
45 - def hide(self):
46 self.gui.hide()
47
48 - def get_widget(self):
49 return self.gui
50