当前位置: 首页>>代码示例>>Python>>正文


Python QTabWidget.setTabsClosable方法代码示例

本文整理汇总了Python中PySide.QtGui.QTabWidget.setTabsClosable方法的典型用法代码示例。如果您正苦于以下问题:Python QTabWidget.setTabsClosable方法的具体用法?Python QTabWidget.setTabsClosable怎么用?Python QTabWidget.setTabsClosable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QTabWidget的用法示例。


在下文中一共展示了QTabWidget.setTabsClosable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: mainWindow

# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import setTabsClosable [as 别名]
class mainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("SimulationZ")
        self.setMinimumSize(700,500)
        self.workspaceLayout = QGridLayout()
        self.workspace = QTabWidget()
        self.workspace.setTabsClosable(True)
        
        self.graphScene = QGraphicsScene()
        self.sceneView = QGraphicsView()
        self.sceneView.setScene(self.graphScene)
        
        self.Editor = Editor(self.sceneView)
        
        self.menuBar = menuBar.menuBar(self)
        self.setMenuBar(self.menuBar)

        self.mainArea = Layout.layout(self.Editor,self.sceneView)
        self.setCentralWidget(self.mainArea)
        
        self.toolBar = self.mainArea.childAt(1,0)
        
    def exitFile(self):     
        if self.i==0:         
            userInfo =QMessageBox.question(self,self.language.Exit,self.language.RUSURE,QMessageBox.Yes | QMessageBox.No)
            if userInfo == QMessageBox.Yes: 
                self.close()
            else:
                pass
        else:
            userInfo =QMessageBox.question(self,self.language.Exit,self.language.OTab,QMessageBox.Yes | QMessageBox.No)
            if userInfo == QMessageBox.Yes: 
                self.close()
            else:
                pass
开发者ID:satishgoda,项目名称:SimulationZ,代码行数:38,代码来源:Main.py

示例2: window

# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import setTabsClosable [as 别名]

#.........这里部分代码省略.........
            link.setDefaultAction(QAction(unicode(i), link))
            link.setObjectName(unicode(i))
            link.setFont(QFont("Helvetica Neue", 11, QFont.Normal))
            link.clicked.connect(self.handleBookmarks)

            self.bookmarks_layout.addWidget(link)

        self.bookmarks_widget = QFrame()
        self.bookmarks_widget.setObjectName("BookmarkWidget")
        self.bookmarks_widget.setStyleSheet(self.style_sheet)
        self.bookmarks_widget.setLayout(self.bookmarks_layout)

        if not bookmarks:
            self.bookmarks_widget.hide()

        # Task list
        self.tasklist = QStandardItemModel()
        #parentItem = self.tasklist.invisibleRootItem()
        #self.tasklist.header().hide()
        self.tasklist.setHorizontalHeaderItem(0, QStandardItem('Tasks'))
        parentItem = QStandardItem("Parent")
        self.tasklist.appendRow(parentItem)
        for i in range(4):
            item = QStandardItem("Item %d" % i)
            parentItem.appendRow(item)
            #parentItem = item

        #self.list.activated[str].connect(self.handleBookmarks)
        #self.list.view().setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum)

        # create tabs
        self.tabs = QTabWidget()
        self.tabs.setDocumentMode(True)
        self.tabs.setTabsClosable(True)
        self.tabs.setMovable(True)
        self.tabs.tabBar().hide()
        self.tabs.setFont(QFont("Helvetica Neue", 11, QFont.Normal))
        self.tabs.setCornerWidget(self.nbutton)
        self.tabs.cornerWidget().setObjectName("CornerWidget")
        self.tabs.cornerWidget().setMinimumSize(10, 24)
        self.tabs.cornerWidget().setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum)

        if saved_tabs:
            for tab in saved_tabs['tabs']:
                tasklist = QTreeView()
                tasklist.hide()
                tasklist.setObjectName('taskList')
                tasklist.setMinimumWidth(100)
                tasklist.setMaximumWidth(250)

                new_tab = QWebView()
                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)
开发者ID:eivind88,项目名称:raskolnikov-browser,代码行数:69,代码来源:main.py

示例3: Cherry

# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import setTabsClosable [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)
#.........这里部分代码省略.........
开发者ID:mcvmcv,项目名称:cherry,代码行数:103,代码来源:cherry.py


注:本文中的PySide.QtGui.QTabWidget.setTabsClosable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。