本文整理汇总了Python中PySide.QtGui.QTabWidget.clear方法的典型用法代码示例。如果您正苦于以下问题:Python QTabWidget.clear方法的具体用法?Python QTabWidget.clear怎么用?Python QTabWidget.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTabWidget
的用法示例。
在下文中一共展示了QTabWidget.clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TabView
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import clear [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'
示例2: SessionDetails
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import clear [as 别名]
class SessionDetails(QWidget):
def __init__(self, parent = None):
super(SessionDetails, self).__init__(parent)
self.tabs = QTabWidget(self)
layout = QVBoxLayout(self)
layout.addWidget(self.tabs)
self.setMinimumSize(600, 600)
def setSession(self, session):
self.tabs.clear()
self.tabs.addTab(IntervalPage(session, self), str(session.start_time))
def setTab(self, tab):
t = self.tabs.currentWidget()
t.setTab(tab)
def addInterval(self, interval):
self.tabs.addTab(IntervalPage(interval, self), str(interval.timestamp))
示例3: TableFrame
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import clear [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)
示例4: LimitsWidget
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import clear [as 别名]
class LimitsWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
# Variables
self._tabs = {}
self._widgets = {}
self._readonly = False
# Widgets
self._wdg_tab = QTabWidget()
# Layouts
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self._wdg_tab)
self.setLayout(layout)
def addLimit(self, limit):
clasz = limit.__class__
if clasz in self._tabs:
raise ValueError('Limit (%s) already added' % clasz.__name__)
wdg_limit = get_widget_class(clasz)()
wdg_limit.setValue(limit)
wdg_limit.setReadOnly(self._readonly)
self._widgets[clasz] = wdg_limit
layout = QVBoxLayout()
layout.addWidget(wdg_limit, 1)
widget = QWidget()
widget.setLayout(layout)
class_name = camelcase_to_words(clasz.__name__)
index = self._wdg_tab.addTab(widget, class_name)
self._tabs[clasz] = index
def addLimits(self, limits):
for limit in limits:
self.addLimit(limit)
def removeLimit(self, limit):
clasz = limit.__class__
index = self._tabs.pop(clasz)
self._wdg_tab.removeTab(index)
del self._widgets[clasz]
def clear(self):
self._wdg_tab.clear()
self._tabs.clear()
self._widgets.clear()
def setReadOnly(self, state):
self._readonly = state
for widget in self._widgets.values():
widget.setReadOnly(state)
def isReadOnly(self):
return self._readonly
示例5: DetectorsWidget
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import clear [as 别名]
class DetectorsWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
# Variables
self._tabs = {}
self._widgets = {}
self._readonly = False
# Widgets
self._wdg_tab = QTabWidget()
# Layouts
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self._wdg_tab)
self.setLayout(layout)
def addDetector(self, key, detector):
if key in self._tabs:
raise ValueError('Detector with key %s already added' % key)
clasz = detector.__class__
wdg_detector = get_widget_class(clasz)()
wdg_detector.setValue(detector)
wdg_detector.setReadOnly(self._readonly)
self._widgets[key] = wdg_detector
lbl_class = QLabel(clasz.__name__)
lbl_class.setAlignment(Qt.AlignRight)
font = lbl_class.font()
font.setItalic(True)
lbl_class.setFont(font)
layout = QVBoxLayout()
layout.addWidget(lbl_class)
layout.addWidget(wdg_detector, 1)
widget = QWidget()
widget.setLayout(layout)
index = self._wdg_tab.addTab(widget, key)
self._tabs[key] = index
def addDetectors(self, detectors):
for key in sorted(detectors.keys()):
self.addDetector(key, detectors[key])
def removeDetector(self, key):
index = self._tabs.pop(key)
self._wdg_tab.removeTab(index)
del self._widgets[key]
def clear(self):
self._wdg_tab.clear()
self._tabs.clear()
self._widgets.clear()
def setReadOnly(self, state):
self._readonly = state
for widget in self._widgets.values():
widget.setReadOnly(state)
def isReadOnly(self):
return self._readonly
示例6: Cherry
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import clear [as 别名]
class Cherry(QMainWindow):
def __init__(self):
super(Cherry, self).__init__()
self.initVars()
self.initUI()
self.initSamplesTab()
self.initConnections()
def initVars(self):
self.path = '~/cherrypicking'
self.ignoreList = ['','Population']
self.markers = []
def initUI(self):
self.setWindowTitle('Cherry Picker')
self.menubar = MenuBar()
self.setMenuBar(self.menubar)
self.statusBar()
self.tabs = QTabWidget()
self.tabs.setTabsClosable(True)
self.setCentralWidget(self.tabs)
self.showMaximized()
def initSamplesTab(self):
self.markers.append(Table('All Samples'))
self.tabs.addTab(self.markers[0],self.markers[0].name)
def initConnections(self):
self.menubar.clearTableAction.triggered.connect(self.new)
self.menubar.openAction.triggered.connect(self.openDialog)
self.menubar.saveAction.triggered.connect(self.saveDialog)
self.menubar.createSamplesAction.triggered.connect(self.createSamples)
self.menubar.createSamplesFromExcelKeaAction.triggered.connect(self.createSamplesFromExcelKea)
self.menubar.exitAction.triggered.connect(self.close)
self.menubar.addMarkerAction.triggered.connect(self.addMarker)
self.menubar.createPlateSheetsAction.triggered.connect(self.createPlateSheets)
self.menubar.importLightcyclerFileAction.triggered.connect(self.importLightcyclerFile)
self.menubar.setIncludesAction.triggered.connect(self.setIncludes)
self.menubar.exportResultsAction.triggered.connect(self.exportResults)
self.tabs.tabCloseRequested.connect(self.tabs.removeTab)
self.tabs.tabCloseRequested.connect(lambda x: self.markers.pop(x))
########################################################################
## Private Methods
def __updateView(self):
for marker in self.markers:
marker.table = marker.table[marker.columns]
marker.setDataFrame(marker.table)
def __clearAll(self):
self.tabs.clear()
self.markers = []
def __findMarker(self,findMarker):
return next((marker for marker in self.markers if marker.name == findMarker), None)
########################################################################
## File Menu Actions
def new(self):
'''Nukes self.markers['All Samples'] and starts again.'''
self.__clearAll()
self.initSamplesTab()
def openDialog(self):
'''Opens a saved .xls file.'''
title = 'Open a saved project file...'
fileName,f = QFileDialog.getOpenFileName(self,title,self.path)
excelFile = ExcelFile(fileName)
self.__clearAll()
[self.markers.append(Table(sheet,excelFile.parse(sheet))) for sheet in excelFile.sheet_names]
[self.tabs.addTab(marker,marker.name) for marker in self.markers]
self.__updateView()
def saveDialog(self):
'''Saves the project as an .xls file.'''
title = 'Save project as...'
fileName,f = QFileDialog.getSaveFileName(self,title,self.path)
writer = ExcelWriter(fileName+'.xls')
for marker in self.markers:
marker.table.to_excel(writer,marker.name)
writer.save()
def createSamples(self):
'''Creates a given number of samples with no names or plant names.'''
samples,ok = CreateSamplesDialog.create(self)
if ok:
columns = ['Origin plate','Origin well','Plant','Sample','From plate','From well',
'Plate','Well','Experiment','Exp well','Result','Continues',]
newSamplesDF = DataFrame(samples,columns=columns)
self.markers[0].table = self.markers[0].table.append(newSamplesDF,ignore_index=True)
self.__updateView()
def createSamplesFromExcelKea(self):
'''Opens a Kea Sample Batch spreadsheet and imports the samples.'''
title = 'Locate Kea sample batch spreadsheet...'
fileName,f = QFileDialog.getOpenFileName(self,title,self.path)
excelFile = ExcelFile(fileName)
#.........这里部分代码省略.........