def end(self): self.mainhud.mapEvents({ 'zoomIn': None, 'zoomOut': None, 'rotateRight': None, 'rotateLeft': None, 'gameMenuButton': None }) self.mainhud.hide() self.mainhud = None self._settings_tab.hide() self._settings_tab = None self.windows.close_all() self.minimap = None self.keylistener = None LastActivePlayerSettlementManager().remove() LastActivePlayerSettlementManager.destroy_instance() ZoomChanged.unsubscribe(self._update_zoom) if self.cursor: self.cursor.remove() self.cursor.end() self.cursor = None super(IngameGui, self).end()
def end(self): self.mainhud.mapEvents({ 'zoomIn': None, 'zoomOut': None, 'rotateRight': None, 'rotateLeft': None, 'gameMenuButton': None }) self.mainhud.hide() self.mainhud = None self._settings_tab.hide() self._settings_tab = None self.windows.close_all() self.minimap = None self.keylistener = None LastActivePlayerSettlementManager().remove() LastActivePlayerSettlementManager.destroy_instance() ZoomChanged.unsubscribe(self._update_zoom) if self.cursor: self.cursor.remove() self.cursor.end() self.cursor = None super(IngameGui, self).end()
def end(self): self.log.debug("Ending session") self.is_alive = False LastActivePlayerSettlementManager().remove() LastActivePlayerSettlementManager.destroy_instance() self.gui.session = None Scheduler().rem_all_classinst_calls(self) ExtScheduler().rem_all_classinst_calls(self) if horizons.main.fife.get_fife_setting("PlaySounds"): for emitter in horizons.main.fife.sound.emitter['ambient'][:]: emitter.stop() horizons.main.fife.sound.emitter['ambient'].remove(emitter) horizons.main.fife.sound.emitter['effects'].stop() horizons.main.fife.sound.emitter['speech'].stop() if hasattr(self, "cursor"): # the line below would crash uglily on ^C self.cursor.remove() self.cursor = None self.world = None self.keylistener = None self.ingame_gui = None self.view = None self.manager = None self.timer = None self.scenario_eventhandler = None Scheduler.destroy_instance() self.selected_instances = None self.selection_groups = None
def end(self): self.log.debug("Ending session") self.is_alive = False self.gui.session = None # Has to be done here, cause the manager uses Scheduler! self.end_production_finished_icon_manager() Scheduler().rem_all_classinst_calls(self) ExtScheduler().rem_all_classinst_calls(self) if horizons.globals.fife.get_fife_setting("PlaySounds"): for emitter in horizons.globals.fife.sound.emitter['ambient'][:]: emitter.stop() horizons.globals.fife.sound.emitter['ambient'].remove(emitter) horizons.globals.fife.sound.emitter['effects'].stop() horizons.globals.fife.sound.emitter['speech'].stop() if hasattr(self, "cursor"): # the line below would crash uglily on ^C self.cursor.remove() if hasattr(self, 'cursor') and self.cursor is not None: self.cursor.end() # these will call end() if the attribute still exists by the LivingObject magic self.ingame_gui = None # keep this before world LastActivePlayerSettlementManager().remove() # keep after ingame_gui LastActivePlayerSettlementManager.destroy_instance() self.cursor = None self.world.end() # must be called before the world ref is gone self.world = None self.keylistener = None self.view = None self.manager = None self.timer = None self.scenario_eventhandler = None Scheduler().end() Scheduler.destroy_instance() self.selected_instances = None self.selection_groups = None self.status_icon_manager.end() self.status_icon_manager = None horizons.main._modules.session = None self._clear_caches() # subscriptions shouldn't survive listeners (except the main Gui) self.gui.unsubscribe() AutosaveIntervalChanged.unsubscribe(self._on_autosave_interval_changed) MessageBus().reset() self.gui.subscribe()
def end(self): self.log.debug("Ending session") self.is_alive = False self.gui.session = None # Has to be done here, cause the manager uses Scheduler! self.end_production_finished_icon_manager() Scheduler().rem_all_classinst_calls(self) ExtScheduler().rem_all_classinst_calls(self) if horizons.globals.fife.get_fife_setting("PlaySounds"): for emitter in horizons.globals.fife.sound.emitter['ambient'][:]: emitter.stop() horizons.globals.fife.sound.emitter['ambient'].remove(emitter) horizons.globals.fife.sound.emitter['effects'].stop() horizons.globals.fife.sound.emitter['speech'].stop() if hasattr(self, "cursor"): # the line below would crash uglily on ^C self.cursor.remove() if hasattr(self, 'cursor') and self.cursor is not None: self.cursor.end() # these will call end() if the attribute still exists by the LivingObject magic self.ingame_gui = None # keep this before world LastActivePlayerSettlementManager().remove() # keep after ingame_gui LastActivePlayerSettlementManager.destroy_instance() self.cursor = None self.world.end() # must be called before the world ref is gone self.world = None self.keylistener = None self.view = None self.manager = None self.timer = None self.scenario_eventhandler = None Scheduler().end() Scheduler.destroy_instance() self.selected_instances = None self.selection_groups = None self.status_icon_manager.end() self.status_icon_manager = None horizons.main._modules.session = None self._clear_caches() # subscriptions shouldn't survive listeners (except the main Gui) self.gui.unsubscribe() AutosaveIntervalChanged.unsubscribe(self._on_autosave_interval_changed) MessageBus().reset() self.gui.subscribe()
def end(self): self.log.debug("Ending session") self.is_alive = False self.gui.session = None Scheduler().rem_all_classinst_calls(self) ExtScheduler().rem_all_classinst_calls(self) if horizons.main.fife.get_fife_setting("PlaySounds"): for emitter in horizons.main.fife.sound.emitter['ambient'][:]: emitter.stop() horizons.main.fife.sound.emitter['ambient'].remove(emitter) horizons.main.fife.sound.emitter['effects'].stop() horizons.main.fife.sound.emitter['speech'].stop() if hasattr(self, "cursor"): # the line below would crash uglily on ^C self.cursor.remove() if hasattr(self, 'cursor') and self.cursor is not None: self.cursor.end() # these will call end() if the attribute still exists by the LivingObject magic self.ingame_gui = None # keep this before world LastActivePlayerSettlementManager().remove() # keep after ingame_gui LastActivePlayerSettlementManager.destroy_instance() self.cursor = None try: # This is likely to throw when the game state is invalid. # Try to continue cleanup afterwards even if this fails. # NOTE: This is not a proper solution, separating sessions by design (e.g. single processes) would be. self.world.end() # must be called before the world ref is gone except Exception: import traceback traceback.print_exc() print 'Exception on world end(), trying to continue to cleanup' self.world = None self.keylistener = None self.view = None self.manager = None self.timer = None self.scenario_eventhandler = None Scheduler().end() Scheduler.destroy_instance() self.selected_instances = None self.selection_groups = None self.status_icon_manager = None self.message_bus = None horizons.main._modules.session = None self._clear_caches()
def end(self): # unsubscribe early, to avoid messages coming in while we're shutting down SpeedChanged.unsubscribe(self._on_speed_changed) NewDisaster.unsubscribe(self._on_new_disaster) NewSettlement.unsubscribe(self._on_new_settlement) PlayerLevelUpgrade.unsubscribe(self._on_player_level_upgrade) MineEmpty.unsubscribe(self._on_mine_empty) ZoomChanged.unsubscribe(self._update_zoom) GuiAction.unsubscribe(self._on_gui_click_action) GuiHover.unsubscribe(self._on_gui_hover_action) GuiCancelAction.unsubscribe(self._on_gui_cancel_action) self.mainhud.mapEvents({ 'zoomIn' : None, 'zoomOut' : None, 'rotateRight' : None, 'rotateLeft': None, 'destroy_tool' : None, 'build' : None, 'diplomacyButton' : None, 'gameMenuButton' : None }) self.mainhud.hide() self.mainhud = None self.windows.close_all() self.message_widget = None self.minimap = None self.resource_overview.end() self.resource_overview = None self.keylistener = None self.cityinfo.end() self.cityinfo = None self.hide_menu() if self.cursor: self.cursor.remove() self.cursor.end() self.cursor = None LastActivePlayerSettlementManager().remove() LastActivePlayerSettlementManager.destroy_instance() self.production_finished_icon_manager.end() self.production_finished_icon_manager = None self.status_icon_manager.end() self.status_icon_manager = None super(IngameGui, self).end()
def end(self): # unsubscribe early, to avoid messages coming in while we're shutting down SpeedChanged.unsubscribe(self._on_speed_changed) NewDisaster.unsubscribe(self._on_new_disaster) NewSettlement.unsubscribe(self._on_new_settlement) PlayerLevelUpgrade.unsubscribe(self._on_player_level_upgrade) MineEmpty.unsubscribe(self._on_mine_empty) ZoomChanged.unsubscribe(self._update_zoom) GuiAction.unsubscribe(self._on_gui_click_action) GuiHover.unsubscribe(self._on_gui_hover_action) GuiCancelAction.unsubscribe(self._on_gui_cancel_action) self.mainhud.mapEvents({ 'zoomIn': None, 'zoomOut': None, 'rotateRight': None, 'rotateLeft': None, 'destroy_tool': None, 'build': None, 'diplomacyButton': None, 'gameMenuButton': None }) self.mainhud.hide() self.mainhud = None self.windows.close_all() self.message_widget = None self.minimap = None self.resource_overview.end() self.resource_overview = None self.keylistener = None self.cityinfo.end() self.cityinfo = None self.hide_menu() if self.cursor: self.cursor.remove() self.cursor.end() self.cursor = None LastActivePlayerSettlementManager().remove() LastActivePlayerSettlementManager.destroy_instance() self.production_finished_icon_manager.end() self.production_finished_icon_manager = None self.status_icon_manager.end() self.status_icon_manager = None super().end()
def end(self): self.log.debug("Ending session") self.is_alive = False self.gui.session = None Scheduler().rem_all_classinst_calls(self) ExtScheduler().rem_all_classinst_calls(self) if horizons.main.fife.get_fife_setting("PlaySounds"): for emitter in horizons.main.fife.sound.emitter['ambient'][:]: emitter.stop() horizons.main.fife.sound.emitter['ambient'].remove(emitter) horizons.main.fife.sound.emitter['effects'].stop() horizons.main.fife.sound.emitter['speech'].stop() if hasattr(self, "cursor"): # the line below would crash uglily on ^C self.cursor.remove() if hasattr(self, 'cursor') and self.cursor is not None: self.cursor.end() # these will call end() if the attribute still exists by the LivingObject magic self.ingame_gui = None # keep this before world LastActivePlayerSettlementManager().remove() # keep after ingame_gui LastActivePlayerSettlementManager.destroy_instance() self.cursor = None self.world.end() # must be called before the world ref is gone self.world = None self.keylistener = None self.view = None self.manager = None self.timer = None self.scenario_eventhandler = None Scheduler().end() Scheduler.destroy_instance() self.selected_instances = None self.selection_groups = None self.status_icon_manager = None self.message_bus = None horizons.main._modules.session = None self._clear_caches()
def end(self): self.mainhud.mapEvents({ 'zoomIn': None, 'zoomOut': None, 'rotateRight': None, 'rotateLeft': None, 'gameMenuButton': None }) self.minimap = None self.keylistener = None LastActivePlayerSettlementManager().remove() LastActivePlayerSettlementManager.destroy_instance() self.session.view.remove_change_listener(self._update_zoom) if self.cursor: self.cursor.remove() self.cursor.end() self.cursor = None super(IngameGui, self).end()
def end(self): self.mainhud.mapEvents({ 'zoomIn' : None, 'zoomOut' : None, 'rotateRight' : None, 'rotateLeft': None, 'destroy_tool' : None, 'build' : None, 'diplomacyButton' : None, 'gameMenuButton' : None }) self.message_widget = None self.minimap = None self.resource_overview.end() self.resource_overview = None self.keylistener = None self.cityinfo.end() self.cityinfo = None self.hide_menu() SettlerUpdate.unsubscribe(self._on_settler_level_change) SpeedChanged.unsubscribe(self._on_speed_changed) self.session.view.remove_change_listener(self._update_zoom) if self.cursor: self.cursor.remove() self.cursor.end() self.cursor = None LastActivePlayerSettlementManager().remove() LastActivePlayerSettlementManager.destroy_instance() self.production_finished_icon_manager.end() self.production_finished_icon_manager = None self.status_icon_manager.end() self.status_icon_manager = None super(IngameGui, self).end()