本文整理汇总了Python中PySide.QtGui.QTabWidget.tabText方法的典型用法代码示例。如果您正苦于以下问题:Python QTabWidget.tabText方法的具体用法?Python QTabWidget.tabText怎么用?Python QTabWidget.tabText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTabWidget
的用法示例。
在下文中一共展示了QTabWidget.tabText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AboutDialog
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import tabText [as 别名]
#.........这里部分代码省略.........
font-weight: bold;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
border: 1px solid #000000;
/* border-bottom-color: #C2C7CB; */ /* same as the pane color */
border-top-left-radius: 4px;
border-top-right-radius: 4px;
min-width: 40ex;
min-height: 5ex;
padding: 3px;
}
QTabBar::tab:selected {
margin-top: 0px;
font-size: 16px;
font-weight: bold;
background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,
stop: 0 #0C6AB0, stop: 0.15 #55C4E6,
stop: 0.15 #55C4E6, stop: 0.5 #FFFFFF,
stop: 0.5 #FFFFFF, stop: 0.85 #55C4E6,
stop: 0.85 #55C4E6, stop: 1.0 #0C6AB0);
border: 1px solid #000000;
}
QTabBar::tab:!selected:hover {
margin-top: 2px; /* make non-selected tabs look smaller */
font-size: 14px;
font-weight: bold;
background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,
stop: 0 #888888, stop: 0.15 #BBBBBB,
stop: 0.15 #BBBBBB, stop: 0.5 #FFFFFF,
stop: 0.5 #FFFFFF, stop: 0.85 #BBBBBB,
stop: 0.85 #BBBBBB, stop: 1.0 #888888);
border: 1px solid #000000;
}
QTabBar::tab:selected {
border-color: #000000;
border-bottom-color: #000000; /* same as pane color */
}
"""
self.notebook.setStyleSheet(notebookStyleSheet)
self.notebook.currentChanged.connect(self.CurrentTabChanged)
buttonbox = QDialogButtonBox(Qt.Horizontal, self)
button = QPushButton(self)
button.setText(self.tr("Oh, Yeah!"))
button.setWhatsThis(self.tr('This is the Oh, Yeah! button!') + '\n' + self.tr('Oh, Yeah!'))
buttonbox.addButton(button, QDialogButtonBox.AcceptRole)
buttonbox.setCenterButtons(True)
buttonbox.accepted.connect(self.accept)
hbLayout1 = QHBoxLayout()
hbLayout2 = QHBoxLayout()
vbLayout = QVBoxLayout()
hbLayout1.addStretch()
hbLayout1.addWidget(self.imgLbl)
hbLayout1.addStretch()
hbLayout2.addStretch()
hbLayout2.addWidget(self.notebook)
hbLayout2.addStretch()
vbLayout.addLayout(hbLayout1)
vbLayout.addLayout(hbLayout2)
vbLayout.addWidget(buttonbox)
self.setLayout(vbLayout)
self.setWindowTitle(self.tr('About Embroidermodder Version 2.0'))
QApplication.restoreOverrideCursor() # TODO/???/PORT# don't mess with the window resize cursors.
# def __del__(self):
# """Class destructor"""
# QApplication.restoreOverrideCursor()
def CurrentTabChanged(self):
tt = self.notebook.tabText(self.notebook.currentIndex())
if tt == self.tr('About'):
self.imgLbl.paintThisText = 'About'
elif tt == self.tr('Supporters'):
self.imgLbl.paintThisText = 'Kickstarter'
self.imgLbl.repaint()
def paintEvent(self, event):
"""
Handles the ``paintEvent`` event for :class:`AboutDialog`.
:param `event`: a `QPaintEvent` event to be processed.
"""
rect = self.rect()
painter = QPainter(self)
painter.setRenderHint(painter.SmoothPixmapTransform)
# Always fill with a solid color first
painter.fillRect(rect, Qt.white)
# Then overlay the texture
painter.fillRect(rect, self.bgBrush)
示例2: Jaime
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import tabText [as 别名]
#.........这里部分代码省略.........
self.config.read(config_file)
def loadParam(self,name,value):
name = name.strip()
# print 'get param [%s]' % name
if not self.config.has_section('PARAMS'):
# print 'cree la seccion'
self.config.add_section('PARAMS')
self.config.set('PARAMS',name.strip(),value)
# print 'seteo %s a %s ' % (name,value)
def getParam(self,name,default=None):
name = name.strip()
# print 'get param [%s]' % name
if self.config.has_section('PARAMS') and \
self.config.has_option('PARAMS',name):
# print 'get param 1 %s' % name
return self.config.get('PARAMS',name)
if default != None:
return default
return None
def toggleDelegationPolicy(self, delegate=None):
if self.page.linkDelegationPolicy() == QWebPage.DontDelegateLinks or \
( isinstance(delegate,bool) and delegate ):
self.logger.info('cambio a delegate links')
self.page.setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
elif self.page.linkDelegationPolicy() == QWebPage.DelegateAllLinks or \
( isinstance(delegate,bool) and not delegate ):
self.logger.info('cambio a dont delegate links')
self.page.setLinkDelegationPolicy(QWebPage.DontDelegateLinks)
else:
self.logger.warn("Can't set delegation policy")
def setGraph(self,filename):
self.graph_file = filename
def start(self):
self.logger.info('---------------------------- Jaime start work ---------------------------------')
self.logger.info('Graph file = %s' % self.graph_file)
if self.config.has_section('PARAMS') :
self.logger.info('[PARAMS]')
for name,value in self.config.items('PARAMS'):
self.logger.info(' %s = %s' % (name,value))
self.page.setNetworkAccessManager(self.network_manager)
self.page.loadFinished.connect(self.navigator.processPageLoadFinished)
self.page.loadStarted.connect(self.navigator.processLoadStarted)
self.page.linkClicked.connect(self.openLinkOnTab)
self.close_tab_timer.timeout.connect(self.closeOpenTab)
self.graph_parser.loadGraph(self.graph_file)
if not self.navigator.takeEntryPoint():
self.finishWork()
self.tabs_widget.show()
# self.tabs_widget.showMaximized()
def finishWork(self):
self.logger.info('Jaime termina su funcionamiento')
QApplication.closeAllWindows()
def openLinkOnTab(self,link):
l = len(self.tabs)
new_tab_key = 'newTab_%s' % time.time()
self.tabs[new_tab_key] = QWebView()
self.tabs[new_tab_key].load(link)
self.tabs_widget.insertTab(self.tabs_widget.count(),self.tabs[new_tab_key],new_tab_key)
if self.close_tab_timer.timerId() == -1 :
self.logger.info('starteo el close_tab_timer')
self.close_tab_timer.start()
def closeOpenTab(self):
if len(self.tabs) == 1 and self.close_tab_timer.timerId() != -1 :
self.logger.info('stopeo el close_tab_timer')
self.close_tab_timer.stop()
return
ks = self.tabs.keys()
ks.remove('mainTab')
ks.sort()
last_key = ks[0]
index = None
for i in range(len(self.tabs)):
if self.tabs_widget.tabText(i) == last_key:
index = i
break
if index:
del self.tabs[last_key]
self.tabs_widget.removeTab(index)
else:
# print 'stopeo el close_tab_timer'
self.logger.error('no se encontro tab para remover con nombre %s' % last_key)