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


Python QTabWidget.removeTab方法代码示例

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


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

示例1: MultiRenderPropWidget

# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import removeTab [as 别名]
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, "Visualization")
		self.tabWidget.addTab(self.registrationHistoryWidget, "History")
		self.tabWidget.addTab(self.slicesTabWidget, "Slices")

		self.currentTabIndex = 0
		self.tabWidget.currentChanged.connect(self.tabIndexChanged)

		layout = QVBoxLayout()
		self.setLayout(layout)
		layout.addWidget(self.tabWidget)

		self.registrationHistoryWidget.setMultiRenderWidget(multiRenderController.multiRenderWidget)

	def setTransformTool(self, transformTool):
		if self.tabWidget.indexOf(self.transformParamWidget) < 0:
			self.tabWidget.addTab(self.transformParamWidget, "Transformation")
		
		self.tabWidget.setCurrentWidget(self.transformParamWidget)
		self.transformParamWidget.setTransformationTool(transformTool)

	def transformToolFinished(self):
		index = self.tabWidget.indexOf(self.transformParamWidget)
		if index >= 0:
			# Restore the last tab index that wasn't the transform tab
			self.tabWidget.setCurrentIndex(self.currentTabIndex)
			self.tabWidget.removeTab(index)

	@Slot(int)
	def tabIndexChanged(self, index):
		transformIndex = self.tabWidget.indexOf(self.transformParamWidget)
		if index != transformIndex:
			self.currentTabIndex = index
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:51,代码来源:MultiRenderPropWidget.py

示例2: window

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

#.........这里部分代码省略.........
        gsettings.setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
        gsettings.setAttribute(QWebSettings.AcceleratedCompositingEnabled,
            True)
        # Performace settings
        gsettings.setAttribute(QWebSettings.DnsPrefetchEnabled, True)
        gsettings.setAttribute(QWebSettings.AcceleratedCompositingEnabled, True)
        gsettings.setAttribute(QWebSettings.DnsPrefetchEnabled, True)
        # Other settings
        gsettings.setAttribute(QWebSettings.PrivateBrowsingEnabled, False)

        # Create a vertical layout and add widgets
        vlayout = QVBoxLayout()
        vlayout.setSpacing(0)
        vlayout.setContentsMargins(0, 0, 0, 0)
        # toolbar.addWidget(self.input_widget)
        vlayout.addWidget(self.input_widget)
        vlayout.addWidget(self.bookmarks_widget)
        vlayout.addWidget(self.tabs_widget)

        # create a widget to hold the vertical layout
        wrapper_widget = QWidget()
        wrapper_widget.setLayout(vlayout)
        self.setCentralWidget(wrapper_widget)

        self.bbutton.clicked.connect(self.tabs.currentWidget().findChild(QFrame, unicode('pageWidget')).findChild(QWebView, unicode('webView')).back)
        self.fbutton.clicked.connect(self.tabs.currentWidget().findChild(QFrame, unicode('pageWidget')).findChild(QWebView, unicode('webView')).forward)
        self.hbutton.clicked.connect(self.goHome)
        self.edit.returnPressed.connect(self.set_url)
        # Add button signal to "go" slot
        self.rbutton.clicked.connect(self.tabs.currentWidget().findChild(QFrame, unicode('pageWidget')).findChild(QWebView, unicode('webView')).reload)
        self.dbutton.clicked.connect(self.bookmark)
        self.tbutton.clicked.connect(self.toggleTaskBar)
        self.nbutton.clicked.connect(self.new_tab)
        self.tabs.tabCloseRequested.connect(self.tabs.removeTab)
        self.tabs.currentChanged.connect(self.change_tab)

        widgets = (input_layout.itemAt(i).widget() for i in range(
            input_layout.count()))
        for widget in widgets:
            if isinstance(widget, QPushButton):
                widget.setFixedSize(33, 21)
                widget.setFont(QFont("Helvetica Neue", 12, QFont.Normal))
                widget.pressed.connect(self.press_button)
                widget.released.connect(self.release_button)

        # make a ctrl+q quit
        sequence = QKeySequence(Qt.CTRL + Qt.Key_Q)
        QShortcut(sequence, self, SLOT("close()"))

        # make an accelerator to toggle fullscreen
        sequence = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_F)
        QShortcut(sequence, self, self.toggle_fullscreen)

        # make an accelerator to toggle input visibility
        sequence = QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_L)
        QShortcut(sequence, self, self.toggle_input)

        # make an accelerator to focus adress-bar
        sequence = QKeySequence(Qt.CTRL + Qt.Key_L)
        QShortcut(sequence, self, self.focus_adress)

        # make an accelerator to reload page
        sequence = QKeySequence(Qt.CTRL + Qt.Key_R)
        QShortcut(sequence, self, self.tabs.currentWidget().findChild(QFrame, unicode('pageWidget')).findChild(QWebView, unicode('webView')).reload)

        # make an accelerator to create new tab
开发者ID:eivind88,项目名称:raskolnikov-browser,代码行数:70,代码来源:main.py

示例3: LimitsWidget

# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import removeTab [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
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:63,代码来源:limit.py

示例4: DetectorsWidget

# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import removeTab [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
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:67,代码来源:detector.py

示例5: Jaime

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

#.........这里部分代码省略.........
        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):
        self.logger.info('Jaime termina su funcionamiento')                    
        QApplication.closeAllWindows()
    
    def openLinkOnTab(self,link):        
        l = len(self.tabs)
        new_tab_key = 'newTab_%s' % time.time()
        self.tabs[new_tab_key] =  QWebView()
        self.tabs[new_tab_key].load(link)
        self.tabs_widget.insertTab(self.tabs_widget.count(),self.tabs[new_tab_key],new_tab_key)        
        if self.close_tab_timer.timerId() == -1  :
            self.logger.info('starteo el close_tab_timer')
            self.close_tab_timer.start()
        
    def closeOpenTab(self):
        if len(self.tabs) == 1  and self.close_tab_timer.timerId() != -1  :
            self.logger.info('stopeo el close_tab_timer')
            self.close_tab_timer.stop()
            return
        
        ks = self.tabs.keys()
        ks.remove('mainTab')
        ks.sort()
        last_key = ks[0]
        index = None
        for i in range(len(self.tabs)):
            if self.tabs_widget.tabText(i) == last_key:
                index = i
                break
        if index: 
            del self.tabs[last_key]
            self.tabs_widget.removeTab(index)
        else:
#             print 'stopeo el close_tab_timer'
            self.logger.error('no se encontro tab para remover con nombre %s' % last_key)
开发者ID:juanchitot,项目名称:jaimeboot,代码行数:104,代码来源:jaime.py

示例6: RenderPropWidget

# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import removeTab [as 别名]
class RenderPropWidget(QWidget):
	"""
	RenderPropWidget is a widget that is displayed under the render widgets. It
	contains a tabwidget in which information of the data can be displayed and
	in which visualization parameters can be shown. One of the tabs is a
	RenderParameterWidget object.
	"""
	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.slicesTabWidget, "Slices")
		self.tabWidget.addTab(self.dataInfoTabWidget, "Data info")

		self.currentTabIndex = 0
		self.extraTabWidget = None
		self.tabWidget.currentChanged.connect(self.tabIndexChanged)

		layout = QVBoxLayout()
		layout.addWidget(self.loadDataWidget)
		self.setLayout(layout)

	def setFileChangedSignal(self, signal):
		"""
		:param signal: Signal that is connected to some file-loading slots.
		:type signal: SIGNAL
		"""
		self.signal = signal
		self.signal.connect(self.setFile)
		self.signal.connect(self.dataInfoTabWidget.setFile)

	def setLoadDataSlot(self, slot):
		"""
		The button is connected to the given slot. The slot action should load
		a dataset from disk.

		:type slot: Slot
		"""
		self.loadDataButton.clicked.connect(slot)

	@Slot(basestring)
	def setFile(self, fileName):
		"""
		When a file is loaded, the 'load data' button is removed from the widget
		and the actual tabs with parameters are put on screen.
		"""
		layout = self.layout()
		if fileName is None:
			if layout.indexOf(self.tabWidget) != -1:
				# Remove the parameter widgets
				layout.removeWidget(self.tabWidget)
				self.tabWidget.setParent(None)
				# Show the load data button
				layout.addWidget(self.loadDataWidget)
				self.setLayout(layout)
		else:
			if layout.indexOf(self.loadDataWidget) != -1:
				# Remove the load data button
				layout.removeWidget(self.loadDataWidget)
				self.loadDataWidget.setParent(None)
				# Add the parameter widgets
				layout.addWidget(self.tabWidget)
				self.setLayout(layout)

	@Slot(int)
	def tabIndexChanged(self, index):
		transformIndex = self.tabWidget.indexOf(self.extraTabWidget)
		if index != transformIndex:
			self.currentTabIndex = index

	def addTabWidget(self, widget, name):
		self.extraTabWidget = widget
		self.tabWidget.addTab(widget, name)
		self.tabWidget.setCurrentWidget(self.extraTabWidget)

	def removeTabWidget(self):
		if self.extraTabWidget is None:
			return

		index = self.tabWidget.indexOf(self.extraTabWidget)
		if index >= 0:
			# Restore the last tab index that wasn't the transform tab
			self.tabWidget.setCurrentIndex(self.currentTabIndex)
#.........这里部分代码省略.........
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:103,代码来源:RenderPropWidget.py


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