本文整理汇总了Python中PySide.QtGui.QTabWidget类的典型用法代码示例。如果您正苦于以下问题:Python QTabWidget类的具体用法?Python QTabWidget怎么用?Python QTabWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QTabWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TabDialog
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)
示例2: __init__
def __init__(self, parent=None):
'''
Constructor
'''
QDialog.__init__(self, parent)
self._ui = Ui_CreditsDialog()
self._ui.setupUi(self)
creditsTab = QTabWidget()
creditSections = info.CREDITS.keys()
for creditSection in creditSections:
creditTab = QWidget()
creditsTab.addTab(creditTab, creditSection)
vbox = QVBoxLayout(creditTab)
creditList = ""
for person in info.CREDITS[creditSection]:
creditList += ("\n%s [%s]" % (person['name'], person['email']))
creditLabel = QLabel()
creditLabel.setStyleSheet("QLabel { background-color : white}")
creditLabel.setText(creditList)
creditLabel.setAlignment(Qt.AlignTop | Qt.AlignLeft)
vbox.addWidget(creditLabel)
vbox = QVBoxLayout()
vbox.setContentsMargins(0, 0, 0, 0)
vbox.addWidget(creditsTab)
self._ui.frame_CreditsTab.setLayout(vbox)
示例3: Form
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)
示例4: setup_ui
def setup_ui(self):
""" Construct the UI for the dialog.
"""
tab_widget = QTabWidget()
general_widget = QWidget()
general_layout = QVBoxLayout()
general_layout.addWidget(self.setup_general_server_group())
general_widget.setLayout(general_layout)
tab_widget.addTab(general_widget, 'General')
advanced_widget = QWidget()
advanced_layout = QVBoxLayout()
warning_label = QLabel('Caution: Changing these settings can potentially break the application.')
warning_label.setStyleSheet('QLabel { color: red; }')
advanced_layout.addWidget(warning_label)
advanced_layout.addWidget(self.setup_advanced_server_group())
advanced_layout.addWidget(self.setup_advanced_storage_group())
advanced_widget.setLayout(advanced_layout)
tab_widget.addTab(advanced_widget, 'Advanced')
layout = QVBoxLayout()
layout.addWidget(tab_widget)
self.setLayout(layout)
示例5: __init__
def __init__(self, parent=None):
QTabWidget.__init__(self, parent)
self.setTabsClosable(True)
self.setMovable(True)
self.LastFile = None
# to see if is new or opened
# self.setCornerWidget(parent, QtCore.Qt.TopRightCorner)
#self.tabNavigator = TabNavigator()
self._already_open = []
示例6: addTab
def addTab(self, name ):
newWidget = QWidget()
layout = QVBoxLayout( newWidget )
labelEmpty = QLabel(); labelEmpty.setMinimumHeight(5)
buttonDelete = QPushButton( "Delete Tab" )
layout.addWidget( labelEmpty )
layout.addWidget( buttonDelete )
QTabWidget.addTab( self, newWidget, name )
QtCore.QObject.connect( buttonDelete, QtCore.SIGNAL( 'clicked()' ), self.deleteTab )
示例7: MainWindow
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setupUi()
def setupUi(self):
self.setWindowTitle('Tab Test')
self.tabs = QTabWidget(self)
self.setCentralWidget(self.tabs)
# QMainWindow inherits QWidget, thus it can simply be added as child
# widget
tab = ToolbarTabWidget()
self.tabs.addTab(tab, 'spam')
示例8: Console
class Console():
def __init__(self, targetLayoutContainer):
self.textarea = QTextEdit()
self.commits = QListWidget()
self.commits.addAction(QAction('Rollback to this revision', self.commits, triggered=self.rollback))
self.commits.setContextMenuPolicy(Qt.ActionsContextMenu)
self.widget = QTabWidget()
self.widget.addTab(self.textarea, 'Log')
self.widget.addTab(self.commits, 'Commits')
targetLayoutContainer.addWidget(self.widget)
def color(self, module, function, color, *args):
print module, function, args
prettyString = '<font color="' + color + '"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
self.textarea.append(''.join(prettyString))
def info(self, module, function, *args):
print module, function, args
prettyString = '<font color="black"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
self.textarea.append(''.join(prettyString))
def error(self, module, function, *args):
print module, function, args
prettyString = '<font color="red"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
self.textarea.append(''.join(prettyString))
def warn(self, module, function, *args):
print module, function, args
prettyString = '<font color="#BE9900"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
self.textarea.append(''.join(prettyString))
def set_commits(self, commits):
self.commits.clear()
for commit in commits:
self.commits.addItem(commit)
def clear(self):
self.textarea.clear()
def rollback(self):
targetCommit = self.commits.currentItem().text().split(' ')[0]
if QMessageBox.warning(None, 'Rollback to commit?', 'All commits after ' + targetCommit + ' will be lost, proceed?', QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes:
rollback(targetCommit)
示例9: MultiRenderPropWidget
class MultiRenderPropWidget(QWidget):
"""
MultiRenderPropWidget is a widget that is displayed under the multi render
widget. It contains tabs with some controls for interaction and
visualization of the combined / multi-volume render widget.
"""
def __init__(self, multiRenderController, parent=None):
super(MultiRenderPropWidget, self).__init__(parent=parent)
# Two tabs: Visualization and Data info
self.mixParamWidget = RenderParameterWidget(multiRenderController)
self.transformParamWidget = TransformationParameterWidget()
self.registrationHistoryWidget = TransformationHistoryWidget()
self.slicesTabWidget = RenderSlicerParamWidget(multiRenderController)
# Create the tab widget
self.tabWidget = QTabWidget()
self.tabWidget.addTab(self.mixParamWidget, "Mix")
self.tabWidget.addTab(self.transformParamWidget, "Transformation")
self.tabWidget.addTab(self.registrationHistoryWidget, "History")
self.tabWidget.addTab(self.slicesTabWidget, "Slices")
layout = QVBoxLayout()
self.setLayout(layout)
layout.addWidget(self.tabWidget)
self.registrationHistoryWidget.setMultiRenderWidget(multiRenderController.multiRenderWidget)
示例10: ManagerWindow
class ManagerWindow(QMainWindow):
"""
This is the Add-on Manager's custom window. Not much else to say, really.
"""
def __init__(self, parent=None):
super(ManagerWindow, self).__init__(parent)
# Set the window title and size.
self.setWindowTitle(self.tr("Add-on Manager"))
self.setMinimumSize(400, 300)
# Build the main widget.
self.tabs = QTabWidget(self)
self.setCentralWidget(self.tabs)
# Load up all our tabs.
for addon_type in sorted(addons.manager._types.keys()):
tab = AddonTypeTab(addon_type)
self.tabs.addTab(tab, tab.windowIcon(), tab.windowTitle())
# Let plugins get in on this.
plugins.run_signal('opened_addon_manager', self)
# Icons and Style!
#style.enable_aero(self)
self.reload_icons()
style.style_reloaded.connect(self.reload_icons)
def reload_icons(self):
""" Reload all of our icons. Which is... one icon. """
self.setWindowIcon(style.icon('addon-manager'))
def showRaise(self):
""" Show and raise the window. """
self.show()
self.raise_()
self.setFocus()
##### The Close Event #####################################################
def closeEvent(self, event):
""" Disconnect any signals and remove our reference. """
global _manager_window
if _manager_window is self:
_manager_window = None
style.style_reloaded.disconnect(self.reload_icons)
plugins.run_signal('closed_addon_manager', self)
示例11: __init__
def __init__(self, renderController, parent=None):
super(RenderPropWidget, self).__init__(parent=parent)
# Three tabs: Visualization, data info and slices
self.visParamTabWidget = RenderParameterWidget(renderController)
self.dataInfoTabWidget = RenderInfoWidget()
self.slicesTabWidget = RenderSlicerParamWidget(renderController)
# Create the load dataset widget
self.loadDataWidget = QWidget()
self.loadDataButton = QPushButton()
self.loadDataButton.setText("Load a dataset")
layout = QVBoxLayout()
layout.setAlignment(Qt.AlignTop)
layout.addWidget(self.loadDataButton)
self.loadDataWidget.setLayout(layout)
# Create the tab widget
self.tabWidget = QTabWidget()
self.tabWidget.addTab(self.visParamTabWidget, "Visualization")
self.tabWidget.addTab(self.dataInfoTabWidget, "Data info")
self.tabWidget.addTab(self.slicesTabWidget, "Slices")
layout = QVBoxLayout()
layout.addWidget(self.loadDataWidget)
self.setLayout(layout)
示例12: __init__
def __init__(self, compatibilityManager, filePath):
editors.UndoStackTabbedEditor.__init__(self, compatibilityManager, filePath)
QTabWidget.__init__(self)
self.setTabPosition(QTabWidget.South)
self.setTabShape(QTabWidget.Triangular)
self.currentChanged.connect(self.slot_currentChanged)
# will be -1, that means no tabs are selected
self.currentTabIndex = self.currentIndex()
# when canceling tab transfer we have to switch back and avoid unnecessary deactivate/activate cycle
self.ignoreCurrentChanged = False
# to avoid unnecessary undo command pushes we ignore currentChanged if we are
# inside ModeChangeCommand.undo or redo
self.ignoreCurrentChangedForUndo = False
示例13: __init__
def __init__(self):
super(STMainWindow, self).__init__()
self.createActions()
self.createMenus()
layout = QVBoxLayout()
self.tabs = QTabWidget()
self.tabs.setTabPosition(QTabWidget.West)
self.tabs.currentChanged[int].connect(self.tabChanged)
self.sessiontab = sweattrails.qt.sessiontab.SessionTab(self)
self.tabs.addTab(self.sessiontab, "Sessions")
self.tabs.addTab(sweattrails.qt.fitnesstab.FitnessTab(self),
"Fitness")
self.tabs.addTab(sweattrails.qt.profiletab.ProfileTab(self),
"Profile")
self.usertab = sweattrails.qt.usertab.UserTab(self)
self.tabs.addTab(self.usertab, "Users")
self.usertab.hide()
layout.addWidget(self.tabs)
w = QWidget(self)
w.setLayout(layout)
self.setCentralWidget(w)
self.statusmessage = QLabel()
self.statusmessage.setMinimumWidth(200)
self.statusBar().addPermanentWidget(self.statusmessage)
self.progressbar = QProgressBar()
self.progressbar.setMinimumWidth(100)
self.progressbar.setMinimum(0)
self.progressbar.setMaximum(100)
self.statusBar().addPermanentWidget(self.progressbar)
self.setWindowTitle("SweatTrails")
self.setWindowIconText("SweatTrails")
icon = QPixmap("image/sweatdrops.png")
self.setWindowIcon(QIcon(icon))
QCoreApplication.instance().refresh.connect(self.userSet)
示例14: __init__
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)
示例15: createView
def createView(self):
"""This required function creates the main view container for
this module, in this case a QTabWidget to hold all the table
views. The rest of the GUI is handled by the superclass.
"""
self.tabs = QTabWidget()
return self.tabs