Browse files

Merge branch 'development' of git://github.com/unknown-horizons/unkno…

…wn-horizons into development
  • Loading branch information...
2 parents 74b26f1 + 959c757 commit c8e6ee1c807298e1d27fb6afb2c28939674e3f2b @totycro totycro committed Apr 9, 2012
View
32 content/gui/xml/mainmenu/singleplayer/random_map_archive.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<Container name="random_map_archive" size="569,350" position_technique="automatic"
+ background_image="content/gui/images/background/notice350.png">
+
+ <Label name="headline" text="Random map archive" position="15,15" />
+
+ <ScrollArea min_size="270,130" max_size="270,130" position="15,40">
+ <ListBox name="map_list" />
+ </ScrollArea>
+
+ <VBox position="315,160" min_size="250,190" max_size="250,190">
+ <Icon name="current_map_preview_minimap" size="120,120" max_size="120,120" is_focusable="0" />
+ <Label name="current_map_preview_status" is_focusable="0" />
+ </VBox>
+
+ <VBox name="current_map_settings" padding="4" position="300,35" max_size="260,300" min_size="260,300">
+ <Label name="current_map_name" is_focusable="0" />
+ <Label name="current_seed_string_lbl" min_size="150,20" text="" />
+ <Label name="current_map_size_lbl" min_size="150,20" text="" />
+ <Label name="current_water_percent_lbl" min_size="150,20" text="" />
+ <Label name="current_max_island_size_lbl" min_size="150,20" text="" />
+ <Label name="current_preferred_island_size_lbl" min_size="150,20" text="" />
+ <Label name="current_island_size_deviation_lbl" min_size="150,20" text="" />
+ </VBox>
+
+ <!--
+ <Button name="load" text="Load / Reload" />
+ <Label name="hintlbl" wrap_text="1" max_size="200,80" min_size="200,80"
+ text="Select a scenario and click on 'Load / Reload' to update the messages in the captain's log" />
+ -->
+ <OkButton position="510,290" />
+</Container>
View
2 content/gui/xml/mainmenu/singleplayer/sp_random.xml
@@ -41,6 +41,8 @@
<HBox>
<Icon name="map_preview_minimap" size="120,120" max_size="120,120" is_focusable="0"/>
<VBox>
+ <Button name="open_random_map_archive" text="Load from map archive" is_focusable="0"
+ comment="Right now, Buttons do not support text wrapping, so better try to keep this line short."/>
<Spacer/>
<Label name="map_preview_status_label" is_focusable="0"/>
</VBox>
View
11 horizons/gui/modules/singleplayermenu.py
@@ -35,6 +35,7 @@
from horizons.savegamemanager import SavegameManager
from horizons.gui.modules import AIDataSelection, PlayerDataSelection
from horizons.constants import AI
+from horizons.gui.widgets import OkButton
from horizons.gui.widgets.minimap import Minimap
from horizons.world import World
from horizons.util import SavegameAccessor, WorldObject, Rect
@@ -103,6 +104,7 @@ def _select_single(self, show):
self._setup_random_map_selection(right_side)
self._setup_game_settings_selection()
self._on_random_map_parameter_changed()
+ self.active_right_side.findChild(name="open_random_map_archive").capture(self._open_random_map_archive)
elif show == 'free_maps':
self.current.files, maps_display = SavegameManager.get_maps()
@@ -476,6 +478,15 @@ def on_resource_density_slider_change():
on_resource_density_slider_change()
+ def _open_random_map_archive(self):
+ popup = self.widgets['random_map_archive']
+ # ok should be triggered on enter, therefore we need to focus the button
+ # pychan will only allow it after the widgets is shown
+ #ExtScheduler().add_new_object(lambda : popup.findChild(name=OkButton.DEFAULT_NAME).requestFocus(), self, run_in=0)
+ popup.mapEvents({OkButton.DEFAULT_NAME : popup.hide})
+ popup.show()
+
+
def _get_natural_resource_multiplier(self):
return self.resource_densities[int(self.widgets['game_settings'].findChild(name = 'resource_density_slider').value)]

0 comments on commit c8e6ee1

Please sign in to comment.