本文整理汇总了Python中PySide.QtGui.QTabWidget.widget方法的典型用法代码示例。如果您正苦于以下问题:Python QTabWidget.widget方法的具体用法?Python QTabWidget.widget怎么用?Python QTabWidget.widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTabWidget
的用法示例。
在下文中一共展示了QTabWidget.widget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: window
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import widget [as 别名]
class window(QMainWindow):
"""Main window."""
def __init__(self, parent=None):
"""Initialize the parent class of this instance."""
super(window, self).__init__(parent)
app.aboutToQuit.connect(self.myExitHandler)
self.style_sheet = self.styleSheet('style')
# app.setStyle(QStyleFactory.create('Macintosh'))
#app.setStyleSheet(self.style_sheet)
self.layout().setSpacing(0)
self.layout().setContentsMargins(0,0,0,0)
app.setOrganizationName("Eivind Arvesen")
app.setOrganizationDomain("https://github.com/eivind88/raskolnikov")
app.setApplicationName("Raskolnikov")
app.setApplicationVersion("0.0.1")
settings = QSettings()
self.data_location = QDesktopServices.DataLocation
self.temp_location = QDesktopServices.TempLocation
self.cache_location = QDesktopServices.CacheLocation
self.startpage = "https://duckduckgo.com/"
self.new_tab_behavior = "insert"
global bookmarks
global saved_tabs
print "Currently saved_tabs:\n", saved_tabs
global menubar
menubar = QMenuBar()
# Initialize a statusbar for the window
self.statusbar = self.statusBar()
self.statusbar.setFont(QFont("Helvetica Neue", 11, QFont.Normal))
self.statusbar.setStyleSheet(self.style_sheet)
self.statusbar.setMinimumHeight(15)
self.pbar = QProgressBar()
self.pbar.setMaximumWidth(100)
self.statusbar.addPermanentWidget(self.pbar)
self.statusbar.hide()
self.setMinimumSize(504, 235)
# self.setWindowModified(True)
# app.alert(self, 0)
self.setWindowTitle("Raskolnikov")
# toolbar = self.addToolBar('Toolbar')
# toolbar.addAction(exitAction)
# self.setUnifiedTitleAndToolBarOnMac(True)
self.setWindowIcon(QIcon(""))
# Create input widgets
self.bbutton = QPushButton(u"<")
self.fbutton = QPushButton(u">")
self.hbutton = QPushButton(u"⌂")
self.edit = QLineEdit("")
self.edit.setFont(QFont("Helvetica Neue", 12, QFont.Normal))
self.edit.setPlaceholderText("Enter URL")
# self.edit.setMinimumSize(400, 24)
self.rbutton = QPushButton(u"↻")
self.dbutton = QPushButton(u"☆")
self.tbutton = QPushButton(u"⁐")
# ↆ ⇧ √ ⌘ ⏎ ⏏ ⚠ ✓ ✕ ✖ ✗ ✘ ::: ❤ ☮ ☢ ☠ ✔ ☑ ♥ ✉ ☣ ☤ ✘ ☒ ♡ ツ ☼ ☁ ❅ ✎
self.nbutton = QPushButton(u"+")
self.nbutton.setObjectName("NewTab")
self.nbutton.setMinimumSize(35, 30)
self.nbutton.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum)
self.edit.setTextMargins(2, 1, 2, 0)
# create a horizontal layout for the input
input_layout = QHBoxLayout()
input_layout.setSpacing(4)
input_layout.setContentsMargins(0, 0, 0, 0)
# add the input widgets to the input layout
input_layout.addWidget(self.bbutton)
input_layout.addWidget(self.fbutton)
input_layout.addWidget(self.hbutton)
input_layout.addWidget(self.edit)
input_layout.addWidget(self.rbutton)
input_layout.addWidget(self.dbutton)
input_layout.addWidget(self.tbutton)
# create a widget to hold the input layout
self.input_widget = QFrame()
self.input_widget.setObjectName("InputWidget")
self.input_widget.setStyleSheet(self.style_sheet)
# set the layout of the widget
self.input_widget.setLayout(input_layout)
self.input_widget.setVisible(True)
# CREATE BOOKMARK-LINE HERE
#.........这里部分代码省略.........
示例2: TableFrame
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import widget [as 别名]
class TableFrame(ModuleFrame):
"""This is the Frame class of the TableModule.
"""
def __init__(self, parent, parent_frame = None, title = None):
"""Like all subclasses of ModuleFrame, the constructor requires:
parent
The GUI parent of this frame.
parent_frame
The ModuleFrame that is logically the parent to this one.
Optionally, a title can be passed, but this is not yet in use.
The Boxfish system handles the creation of ModuleFrames and will
pass these values and only these values to any ModuleFrame.
"""
super(TableFrame, self).__init__(parent, parent_frame, title)
self.selected = []
self.droppedDataSignal.connect(self.droppedData)
self.agent.tableUpdateSignal.connect(self.updateTables)
self.agent.highlightUpdateSignal.connect(self.updateSelection)
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
@Slot(list, str)
def droppedData(self, indexList):
"""Overrides the superclass method to send the agent the dropped
data indices.
"""
self.agent.addDataIndices(indexList)
@Slot(list, list, list, list, list)
def updateTables(self, tables, runs, ids, headers, values):
"""Creates table views.
tables
A list of tables for which we have data.
ids
A list of lists of the corresponding SubDomain ids for
each row of each table's returned values.
headers
A list of lists of the column names that go with the
given values for each table.
values
A list of list of lists, one for each column of each table.
"""
# We need to save tables, id_lists for selection later
self.tables = tables
self.id_lists = ids
if tables is None:
return
self.tabs.clear() # Get rid of old data
# For each table, create a table view and populate it with the
# given values for that table
for table, run, ids_list, header_list, value_lists \
in zip(tables, runs, ids, headers, values):
tableWidget = TableTab(table, run, ids_list, header_list, value_lists)
tableWidget.idsChanged.connect(self.selectionChanged)
self.tabs.addTab(tableWidget, table)
@Slot(list)
def updateSelection(self, table_highlights):
"""Highlight the given table ids.
table_highlights
A list of lists of ids, one per table
"""
for i, ids in enumerate(table_highlights):
table = self.tabs.widget(i)
table.selectRows(ids)
@Slot(str, str, set)
def selectionChanged(self, table, run, ids):
"""Pass along the selection information to the agent."""
self.agent.changeHighlights(table, run, ids)