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


Python Tc2Config.walkHelpTopics方法代码示例

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


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

示例1: onGlobalObjectInitSettingsFinished

# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import walkHelpTopics [as 别名]
	def onGlobalObjectInitSettingsFinished(self, globalObject):
		self.tree.setUpdatesEnabled(False)

		#
		lastTopic = Tc2Config.settingsValue(self.SettingsKeyHelpTopic, '').toString()
		topicsCollapsed = Tc2Config.settingsValue(self.SettingsKeyTopicsCollapsed, []).toStringList()
		lastTopicItem = None
		firstTopicItem = None
		stack = []
		for level, (topic, topicName) in Tc2Config.walkHelpTopics():
			while len(stack) > level:
				stack.pop(-1)
			if stack:
				item = QtGui.QTreeWidgetItem(stack[-1], [topicName, ])
			else:
				item = QtGui.QTreeWidgetItem(self.tree, [topicName, ])
			item.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(topic))

			#TODO: for some reason items are never expanded. seems to be a bug in Qt4
			#item.setChildIndicatorPolicy(item.DontShowIndicator)
			item.setExpanded(topic not in topicsCollapsed)
			##print topic not in topicsCollapsed, topic
			stack.append(item)
			if topic == lastTopic:
				lastTopicItem = item
			if firstTopicItem is None:
				firstTopicItem = item
		if lastTopicItem is None:
			lastTopicItem = firstTopicItem

		# only select topic when item is visible
		allParentsExpanded = True
		parent = lastTopicItem.parent()
		#print parent
		while parent is not None:
			if not parent.isExpanded():
				allParentsExpanded = False
				break
			parent = parent.parent()
		if allParentsExpanded:
			self.tree.setCurrentItem(lastTopicItem)
		else:
			self.tree.setCurrentItem(firstTopicItem)

		self.tree.setUpdatesEnabled(True)

		self.tree.setAlternatingRowColors(globalObject.settingsGlobal.alternatingRowColors())
		globalObject.settingsGlobal.alternatingRowColorsChanged.connect(self.tree.setAlternatingRowColors)
		self.browserFrame.layout(globalObject.settingsGlobal.toolBarPosition() == Tc2Config.ToolBarPositionTop)
		self.layout()
		self.splitter.restoreState( Tc2Config.settingsValue(self.SettingsKeySplitterState, QtCore.QByteArray()).toByteArray() )
		globalObject.settingsGlobal.toolBarPositionChanged.connect(
				lambda position, frame=self.browserFrame: frame.layout(toolBarTop=position == Tc2Config.ToolBarPositionTop)
				)


		self.toolBar.setZoomSteps(globalObject.settingsGlobal.webViewZoomSteps())
		globalObject.settingsGlobal.webViewZoomStepsChanged.connect(self.toolBar.setZoomSteps)

		zoomFactor = Tc2Config.settingsValue(self.SettingsKeyZoomFactor, Browser.BrowserToolBar.ZoomFactorDefault).toDouble()[0]
		self.toolBar.setZoomFactor(zoomFactor)
开发者ID:Kostafun,项目名称:tablecrab,代码行数:63,代码来源:Tc2GuiHelp.py


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