本文整理汇总了Python中horizons.gui.mousetools.SelectionTool.on_escape方法的典型用法代码示例。如果您正苦于以下问题:Python SelectionTool.on_escape方法的具体用法?Python SelectionTool.on_escape怎么用?Python SelectionTool.on_escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizons.gui.mousetools.SelectionTool
的用法示例。
在下文中一共展示了SelectionTool.on_escape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IngameGui
# 需要导入模块: from horizons.gui.mousetools import SelectionTool [as 别名]
# 或者: from horizons.gui.mousetools.SelectionTool import on_escape [as 别名]
#.........这里部分代码省略.........
})
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 handle_selection_group(self, num, ctrl_pressed):
# Someday, maybe cool stuff will be possible here.
# That day is not today, I'm afraid.
pass
def toggle_pause(self):
self.windows.toggle(self.pausemenu)
def toggle_help(self):
self.windows.toggle(self.help_dialog)
def load(self, savegame):
self.minimap.draw()
self.cursor = SelectionTool(self.session)
def setup(self):
"""Called after the world editor was initialized."""
self._settings_tab = TabWidget(self, tabs=[SettingsTab(self.session.world_editor, self)])
self._settings_tab.show()
def minimap_to_front(self):
"""Make sure the full right top gui is visible and not covered by some dialog"""
self.mainhud.hide()
self.mainhud.show()
def show_save_map_dialog(self):
"""Shows a dialog where the user can set the name of the saved map."""
window = SelectSavegameDialog('editor-save', self.windows)
savegamename = self.windows.open(window)
if savegamename is None:
return False # user aborted dialog
success = self.session.save(savegamename)
if success:
self.message_widget.add('SAVED_GAME')
def on_escape(self):
pass
def on_key_press(self, action, evt):
_Actions = KeyConfig._Actions
if action == _Actions.QUICKSAVE:
self.session.quicksave()
if action == _Actions.ESCAPE:
if self.windows.visible:
self.windows.on_escape()
elif hasattr(self.cursor, 'on_escape'):
self.cursor.on_escape()
else:
self.toggle_pause()
elif action == _Actions.HELP:
self.toggle_help()
else:
return False
return True
def set_cursor(self, which='default', *args, **kwargs):
"""Sets the mousetool (i.e. cursor).
This is done here for encapsulation and control over destructors.
Further arguments are passed to the mouse tool constructor.
"""
self.cursor.remove()
klass = {
'default': SelectionTool,
'tile_layer': TileLayingTool
}[which]
self.cursor = klass(self.session, *args, **kwargs)
def _update_zoom(self, message):
"""Enable/disable zoom buttons"""
in_icon = self.mainhud.findChild(name='zoomIn')
out_icon = self.mainhud.findChild(name='zoomOut')
if message.zoom == VIEW.ZOOM_MIN:
out_icon.set_inactive()
else:
out_icon.set_active()
if message.zoom == VIEW.ZOOM_MAX:
in_icon.set_inactive()
else:
in_icon.set_active()