本文整理汇总了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)