当前位置: 首页>>代码示例>>Python>>正文


Python TabWidget._show_tab方法代码示例

本文整理汇总了Python中horizons.gui.tabs.TabWidget._show_tab方法的典型用法代码示例。如果您正苦于以下问题:Python TabWidget._show_tab方法的具体用法?Python TabWidget._show_tab怎么用?Python TabWidget._show_tab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在horizons.gui.tabs.TabWidget的用法示例。


在下文中一共展示了TabWidget._show_tab方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: show_menu

# 需要导入模块: from horizons.gui.tabs import TabWidget [as 别名]
# 或者: from horizons.gui.tabs.TabWidget import _show_tab [as 别名]
	def show_menu(self, jump_to_tabclass=None):
		"""Shows tabs from self.__class__.tabs, if there are any.
		@param jump_to_tabclass: open the first tab that is a subclass to this parameter
		"""
		# this local import prevents circular imports
		from horizons.gui.tabs import TabWidget
		tablist = None
		if self.owner == self.session.world.player:
			tablist = self.__class__.tabs
		else: # this is an enemy instance with respect to the local player
			tablist = self.__class__.enemy_tabs

		if tablist:
			tabs = [ tabclass(self) for tabclass in tablist if tabclass.shown_for(self) ]
			tabwidget = TabWidget(self.session.ingame_gui, tabs=tabs)

			if jump_to_tabclass:
				num = None
				for i in xrange( len(tabs) ):
					if isinstance(tabs[i], jump_to_tabclass):
						num = i
						break
				if num is not None:
					tabwidget._show_tab(num)

			self.session.ingame_gui.show_menu( tabwidget )
开发者ID:mihaibivol,项目名称:unknown-horizons,代码行数:28,代码来源:concreteobject.py

示例2: show_menu

# 需要导入模块: from horizons.gui.tabs import TabWidget [as 别名]
# 或者: from horizons.gui.tabs.TabWidget import _show_tab [as 别名]
	def show_menu(self, jump_to_tabclass=None):
		"""Shows tabwidget tabs of this instance.

		Opens the first such tab unless jump_to_tabclass specifies otherwise.
		@param jump_to_tabclass: open the first tab that is a subclass to this parameter
		"""
		from horizons.gui.tabs import TabWidget
		tablist = None
		if self.instance.owner is not None and self.instance.owner.is_local_player:
			tablist = self.tabs
		else: # this is an enemy instance with respect to the local player
			tablist = self.enemy_tabs

		if not tablist:
			return

		tabclasses = [tabclass for tabclass in tablist if tabclass.shown_for(self.instance)]
		try:
			active_tab_index = tabclasses.index(self.active_tab)
		except ValueError:
			active_tab_index = None
		tabs = [tabclass(self.instance) for tabclass in tabclasses]
		tabwidget = TabWidget(self.session.ingame_gui, tabs=tabs, active_tab=active_tab_index)

		if jump_to_tabclass:
			for i, tab in enumerate(tabs):
				if isinstance(tab, jump_to_tabclass):
					tabwidget._show_tab(i)
					break
		self.session.ingame_gui.show_menu(tabwidget)
开发者ID:asarbs,项目名称:unknown-horizons,代码行数:32,代码来源:selectablecomponent.py

示例3: show_menu

# 需要导入模块: from horizons.gui.tabs import TabWidget [as 别名]
# 或者: from horizons.gui.tabs.TabWidget import _show_tab [as 别名]
	def show_menu(self, jump_to_tabclass=None):
		"""Shows tabs from self.__class__.tabs, if there are any.
		@param jump_to_tabclass: open the first tab that is a subclass to this parameter
		"""
		from horizons.gui.tabs import TabWidget
		tablist = None
		if self.instance.owner is not None and self.instance.owner.is_local_player:
			tablist = self.tabs
		else: # this is an enemy instance with respect to the local player
			tablist = self.enemy_tabs

		if tablist:
			tabs = [ tabclass(self.instance) for tabclass in tablist if
			         tabclass.shown_for(self.instance) ]
			tabwidget = TabWidget(self.session.ingame_gui, tabs=tabs)

			if jump_to_tabclass:
				for i, tab in enumerate(tabs):
					if isinstance(tab, jump_to_tabclass):
						tabwidget._show_tab(i)
						break

			self.session.ingame_gui.show_menu( tabwidget )
开发者ID:ephillipe,项目名称:unknown-horizons,代码行数:25,代码来源:selectablecomponent.py


注:本文中的horizons.gui.tabs.TabWidget._show_tab方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。