本文整理汇总了Python中PySide.QtGui.QTabWidget.insertTab方法的典型用法代码示例。如果您正苦于以下问题:Python QTabWidget.insertTab方法的具体用法?Python QTabWidget.insertTab怎么用?Python QTabWidget.insertTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTabWidget
的用法示例。
在下文中一共展示了QTabWidget.insertTab方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Form
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import insertTab [as 别名]
class Form(QDialog):
def __init__(self, parent=None):
super(Form, self).__init__()
self.tab = QTabWidget()
# Add demo data for tab 1
x = np.random.normal(size=1000)
y = np.random.normal(size=1000)
plot1 = PlotWidget()
plot1.plot(x, y, pen=None, symbol='o')
self.tab.insertTab(0, plot1, "random")
# Add demo data for tab 2
x = np.linspace(0, 6*np.pi, 1000)
y = np.sin(x)
plot2 = PlotWidget()
plot2.plot(x, y)
self.tab.insertTab(1, plot2, "sinus")
self.main_window = QMainWindow()
self.main_window.setCentralWidget(self.tab)
self.main_window.show()
# Force the window to stay on top
self.setWindowFlags(Qt.WindowStaysOnTopHint)
示例2: TabView
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import insertTab [as 别名]
class TabView():
def __init__(self, targetLayoutContainer):
self.tabs = QTabWidget()
targetLayoutContainer.addWidget(self.tabs, 10)
def set_logger(self, logger):
self.logger = logger
def show_page(self, page):
print 'page is ' + page.item.name
widget = QWidget()
layout = QHBoxLayout()
widget.setLayout(layout)
pageWidget = pages.get_page_widget(page, layout, self)
self.tabs.insertTab(0, widget, page.label)
self.tabs.setCurrentIndex(0)
def save_page(self, page):
self.logger.info(__name__, 'save_page', page.description())
controller.save_page(page)
def clear(self):
self.tabs.clear()
print 'cleared'
示例3: TabDialog
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import insertTab [as 别名]
class TabDialog(QDialog):
"""This dialog contains tabs with options for everything related
to the module. Inheriting modules can add their own tabs
to this dialog by overriding buildTagDialog in ModuleFrame. They
should all super in order to keep the original tabs.
Example: a module might create a tab that determines what
the default aggregation method is for dropped data
"""
def __init__(self, parent, title=""):
"""Construct a TabDialog with the ModuleFrame parent and the
given title.
"""
super(TabDialog, self).__init__(parent)
self.setWindowTitle(title)
self.tabs = QTabWidget(self)
self.setModal(True)
# Need a layout to get resizing to work
layout = QGridLayout()
layout.addWidget(self.tabs, 0, 0)
self.setLayout(layout)
def addTab(self, tab, name, index=0):
"""Add the given tab to the TabDialog under the given name
at the given index. The index 0 means the tab will be
the active one when the TabDialog is raised.
"""
viewArea = QScrollArea()
viewArea.setWidget(tab)
viewArea.setWidgetResizable(True)
self.tabs.insertTab(index, viewArea, name)
self.tabs.setCurrentIndex(0)
示例4: window
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import insertTab [as 别名]
#.........这里部分代码省略.........
new_tab.setObjectName('webView')
inspector = QWebInspector(self)
inspector.setObjectName('webInspector')
inspector.hide()
page_layout = QVBoxLayout()
page_layout.setSpacing(0)
page_layout.setContentsMargins(0, 0, 0, 0)
page_layout.addWidget(new_tab)
page_layout.addWidget(inspector)
page_widget = QFrame()
page_widget.setObjectName('pageWidget')
page_widget.setLayout(page_layout)
complete_tab_layout = QHBoxLayout()
complete_tab_layout.setSpacing(0)
complete_tab_layout.setContentsMargins(0, 0, 0, 0)
complete_tab_layout.addWidget(tasklist)
complete_tab_layout.addWidget(page_widget)
complete_tab_widget = QFrame()
complete_tab_widget.setLayout(complete_tab_layout)
#for page in tab['history']:
# new_tab.load(QUrl(page['url']))
#print tab['current_history']
#for item in new_tab.history().items():
# print item
#new_tab.history().goToItem(new_tab.history().itemAt(tab['current_history']))
new_tab.load(QUrl(tab['history'][tab['current_history']]['url']))
tab['current_history']
self.tabs.setUpdatesEnabled(False)
if self.new_tab_behavior == "insert":
self.tabs.insertTab(self.tabs.currentIndex()+1, complete_tab_widget,
unicode(new_tab.title()))
elif self.new_tab_behavior == "append":
self.tabs.appendTab(complete_tab_widget, unicode(new_tab.title()))
self.tabs.setUpdatesEnabled(True)
new_tab.titleChanged.connect(self.change_tab)
new_tab.urlChanged.connect(self.change_tab)
new_tab.loadStarted.connect(self.load_start)
new_tab.loadFinished.connect(self.load_finish)
new_tab.loadProgress.connect(self.pbar.setValue)
new_tab.page().linkHovered.connect(self.linkHover)
inspector.setPage(new_tab.page())
for index, tab in enumerate(saved_tabs['tabs']):
self.tabs.setTabText(index, tab['history'][tab['current_history']]['title'])
self.tabs.setCurrentIndex(saved_tabs['current_tab'])
else:
self.new_tab()
tabs_layout = QVBoxLayout()
tabs_layout.setSpacing(0)
tabs_layout.setContentsMargins(0, 0, 0, 0)
tabs_layout.addWidget(self.tabs)
self.tabs_widget = QFrame()
self.tabs_widget.setObjectName("TabLine")
self.tabs_widget.setStyleSheet(self.style_sheet)
self.tabs_widget.setLayout(tabs_layout)
self.tabs_widget.setVisible(True)
# Webkit settings
gsettings = self.tabs.currentWidget().findChild(QFrame, unicode('pageWidget')).findChild(QWebView, unicode('webView')).settings().globalSettings()
示例5: Jaime
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import insertTab [as 别名]
class Jaime(QObject,Singleton):
instance = None
logger = None
def __init__(self):
if Jaime.instance:
raise Exception("Can't call to constructor with another instance created")
self.tabs_widget = QTabWidget()
self.view = QWebView()
self.page = QWebPage()
self.config = SafeConfigParser()
Logger.getLoggerFor(self.__class__)
self.tabs_widget.insertTab(0,self.view,'label')
self.tabs = {}
self.graph_file = None
self.close_tab_timer = QTimer()
self.close_tab_timer.setSingleShot(False)
#cada 30 segundos se cierra un tab
self.close_tab_timer.setInterval(10000)
self.view.setPage(self.page)
self.tabs['mainTab'] = self.view
self.network_manager = CustomNetworkAccessManager.getInstance()
self.navigator = Navigator.getInstance()
self.route_node = YahooRouteNode.getInstance()
self.graph_parser = GraphParser.getInstance()
self.page.setNetworkAccessManager(self.network_manager)
def loadConfig(self,config_file):
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):
#.........这里部分代码省略.........