本文整理汇总了Python中horizons.gui.tabs.TabWidget.show方法的典型用法代码示例。如果您正苦于以下问题:Python TabWidget.show方法的具体用法?Python TabWidget.show怎么用?Python TabWidget.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizons.gui.tabs.TabWidget
的用法示例。
在下文中一共展示了TabWidget.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IngameGui
# 需要导入模块: from horizons.gui.tabs import TabWidget [as 别名]
# 或者: from horizons.gui.tabs.TabWidget import show [as 别名]
class IngameGui(LivingObject):
minimap = livingProperty()
keylistener = livingProperty()
message_widget = livingProperty()
def __init__(self, session):
self.session = session
self.cursor = None
self.coordinates_tooltip = None
self.keylistener = IngameKeyListener(self.session)
# used by NavigationTool
LastActivePlayerSettlementManager.create_instance(self.session)
# Mocks needed to act like the real IngameGui
self.show_menu = lambda x: 0
self.hide_menu = lambda: 0
# a logbook Dummy is necessary for message_widget to work
self.logbook = DummyLogbook()
self.mainhud = load_uh_widget('minimap.xml')
self.mainhud.position_technique = "right+0:top+0"
icon = self.mainhud.findChild(name="minimap")
self.minimap = Minimap(icon,
targetrenderer=horizons.globals.fife.targetrenderer,
imagemanager=horizons.globals.fife.imagemanager,
session=self.session,
view=self.session.view)
self.mainhud.mapEvents({
'zoomIn': self.session.view.zoom_in,
'zoomOut': self.session.view.zoom_out,
'rotateRight': Callback.ChainedCallbacks(self.session.view.rotate_right, self.minimap.rotate_right),
'rotateLeft': Callback.ChainedCallbacks(self.session.view.rotate_left, self.minimap.rotate_left),
'gameMenuButton': self.toggle_pause,
})
self.mainhud.show()
ZoomChanged.subscribe(self._update_zoom)
# Hide unnecessary buttons in hud
for widget in ("build", "speedUp", "speedDown", "destroy_tool", "diplomacyButton", "logbook"):
self.mainhud.findChild(name=widget).hide()
self.windows = WindowManager()
self.message_widget = MessageWidget(self.session)
self.pausemenu = PauseMenu(self.session, self, self.windows, in_editor_mode=True)
self.help_dialog = HelpDialog(self.windows)
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 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"""
#.........这里部分代码省略.........
示例2: IngameGui
# 需要导入模块: from horizons.gui.tabs import TabWidget [as 别名]
# 或者: from horizons.gui.tabs.TabWidget import show [as 别名]
class IngameGui(LivingObject):
minimap = livingProperty()
keylistener = livingProperty()
def __init__(self, session, main_gui):
self.session = session
self.main_gui = main_gui
self.cursor = None
self.coordinates_tooltip = None
self.keylistener = IngameKeyListener(self.session)
# used by NavigationTool
LastActivePlayerSettlementManager.create_instance(self.session)
# Mocks needed to act like the real IngameGui
self.show_menu = Dummy
self.hide_menu = Dummy
self.mainhud = load_uh_widget('minimap.xml')
self.mainhud.position_technique = "right+0:top+0"
icon = self.mainhud.findChild(name="minimap")
self.minimap = Minimap(icon,
targetrenderer=horizons.globals.fife.targetrenderer,
imagemanager=horizons.globals.fife.imagemanager,
session=self.session,
view=self.session.view)
self.mainhud.mapEvents({
'zoomIn': self.session.view.zoom_in,
'zoomOut': self.session.view.zoom_out,
'rotateRight': Callback.ChainedCallbacks(self.session.view.rotate_right, self.minimap.rotate_right),
'rotateLeft': Callback.ChainedCallbacks(self.session.view.rotate_left, self.minimap.rotate_left),
'gameMenuButton': self.toggle_pause,
})
self.mainhud.show()
self.session.view.add_change_listener(self._update_zoom)
# Hide unnecessary buttons in hud
for widget in ("build", "speedUp", "speedDown", "destroy_tool", "diplomacyButton", "logbook"):
self.mainhud.findChild(name=widget).hide()
self.save_map_dialog = SaveMapDialog(self.main_gui, self, self.session)
self.pausemenu = PauseMenu(self.session, self.main_gui, self, in_editor_mode=True)
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 toggle_pause(self):
self.pausemenu.toggle()
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."""
self.save_map_dialog.show()
def on_escape(self):
pass
def on_key_press(self, action, evt):
_Actions = KeyConfig._Actions
if action == _Actions.ESCAPE:
return self.on_escape()
def set_cursor(self, which='default', *args, **kwargs):
"""Sets the mousetool (i.e. cursor).
This is done here for encapsulation and control over destructors.
#.........这里部分代码省略.........