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


Python QtGui.QToolBar方法代码示例

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


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

示例1: unloadContent

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def unloadContent(self):
        '''
        Remove all items in the container.
        '''
        for k,v in self._contentGroups.iteritems():            
            if isinstance(self._container,QToolBar) or isinstance(self._container,QMenu):  
                #If there is a parent then delete the widget
                if v!= None:
                    v[1].setParent(None)
                else:   
                    if isinstance(k,ContentGroup):   
                        k = k.containerItem()                   
                        
                    self._container.removeAction(k)
                
        #Remove separator
        if self._separatorAction != None:
            self._container.removeAction(self._separatorAction) 
开发者ID:gltn,项目名称:stdm,代码行数:20,代码来源:container_loader.py

示例2: _create_toolbar

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def _create_toolbar(self):
        toolbar = QToolBar()
        toolbar.setFloatable(False)
        toolbar.setMovable(False)

        self.layout_combo = LayoutCombo()
        toolbar.addWidget(self.layout_combo)
        self.layout_combo.layout_changed.connect(self._plot_layout_changed)

        self._settings_button = QToolButton()
        self._settings_button.setToolTip("Toggle settings visibility")
        self._settings_button.setIcon(resource_icon("cog.png"))
        self._settings_button.setCheckable(True)
        self._settings_button.toggled.connect(self._show_settings)
        toolbar.addWidget(self._settings_button)

        def toggle_on_close(event):
            self._settings_button.setChecked(False)
            event.accept()

        self._settings_window.closeEvent = toggle_on_close

        return toolbar 
开发者ID:equinor,项目名称:segyviewer,代码行数:25,代码来源:segywidgetcollection.py

示例3: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def __init__(self, trace, parent=None):
        QtGui.QToolBar.__init__(self, parent=parent)
        vtrace.Notifier.__init__(self)
        self.trace = trace

        self.setObjectName('VtraceToolbar')

        self.attach_action = self.addAction('Attach')
        self.attach_action.setStatusTip('Attach to a process')
        self.attach_action.triggered.connect(self.actAttach)

        self.detach_action = self.addAction('Detach')
        self.detach_action.setStatusTip('Detach from current process')
        self.detach_action.triggered.connect(self.actDetach)

        self.continue_action = self.addAction('Continue')
        self.continue_action.setStatusTip('Continue current process')
        self.continue_action.triggered.connect(self.actContinue)

        self.break_action = self.addAction('Break')
        self.break_action.setStatusTip('Break current process')
        self.break_action.triggered.connect(self.actBreak)

        self.stepi_action = self.addAction('Stepi')
        self.stepi_action.setStatusTip('Single step the current process')
        self.stepi_action.triggered.connect(self.actStepi)

        trace.registerNotifier(vtrace.NOTIFY_ALL, self)
        self._updateActions(trace.isAttached(), trace.isRunning()) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:31,代码来源:qt.py

示例4: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def __init__(self, fig, width=1, debug=False):
        # Setup data range variables for scrolling
        self.debug = debug
        if self.debug:
            pprint('ScrollingToolQT init\n')
        self.fig = fig

        # Data range inferred from initial x-axis range
        self.data_xmin, self.data_xmax = fig.axes[0].get_xlim()
        self.xmin = self.data_xmin
        self.width = width    # axis units (e.g. 1 second)

        # Some handy shortcuts
        self.ax = self.fig.axes[0]
        self.draw = self.fig.canvas.draw
        # self.draw_idle = self.fig.canvas.draw_idle

        # Retrive the QMainWindow used by current figure and add a toolbar
        # to host the new widgets
        QMainWin = fig.canvas.parent()
        toolbar = QtGui.QToolBar(QMainWin)
        QMainWin.addToolBar(QtCore.Qt.BottomToolBarArea, toolbar)

        # Create the slider and spinbox for x-axis scrolling in toolbar
        self.set_slider(toolbar)
        self.set_spinbox(toolbar)

        # Set the initial x-axis range coherently with slider and spinbox
        self.update_xlim() 
开发者ID:tritemio,项目名称:FRETBursts,代码行数:31,代码来源:scroll_gui.py

示例5: create_toolbar

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def create_toolbar(self):
        settingsAction = QtGui.QAction("&Set Cluster Parameters", self)
        settingsAction.setShortcut("Ctrl+Q")
        settingsAction.triggered.connect(didPressSettingsMenuItem)

        settingsMenu = QtGui.QMenu(self)
        settingsMenu.addAction(settingsAction)

        toolBar = QtGui.QToolBar()
        settingsButton = QtGui.QToolButton()
        settingsButton.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
        settingsButton.setText("Settings")
        settingsButton.setMenu(settingsMenu)
        toolBar.addWidget(settingsButton)
        self.layout.addWidget(toolBar) 
开发者ID:oduwa,项目名称:Pic-Numero,代码行数:17,代码来源:gui.py

示例6: _addItemtoContainer

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def _addItemtoContainer(self,content):
        '''
        Adds items to specific container
        '''                                 
        if isinstance(self._container,QToolBar) or isinstance(self._container,QMenu):
            if self._actionReference != None:
                self._container.insertAction(self._actionReference, content)
            else:                        
                self._container.addAction(content) 
                
        elif isinstance(self._container,QListWidget):
            self._container.insertItem(self._iter,content)
            self._iter += 1 
开发者ID:gltn,项目名称:stdm,代码行数:15,代码来源:container_loader.py

示例7: _insertWidgettoContainer

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def _insertWidgettoContainer(self, widget):
        '''
        This method inserts the parent widget to the container for those actions
        that have parents defined. But it ensures that only one instance of the parent widget
        is inserted.
        '''  
        objName = widget.objectName()
        #Determine if the widget is already in the container
        if getIndex(self._widgets,objName) == -1:
            if isinstance(self._container,QToolBar):
                self._container.insertWidget(self._actionReference,widget)
            elif isinstance(self._container,QMenu):
                self._container.insertMenu(self._actionReference,widget)
                
            self._widgets.append(objName) 
开发者ID:gltn,项目名称:stdm,代码行数:17,代码来源:container_loader.py

示例8: toolbar

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def toolbar(self):
        """ :rtype: QToolBar """
        return self._toolbar 
开发者ID:equinor,项目名称:segyviewer,代码行数:5,代码来源:segyviewwidget.py

示例9: loadContent

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def loadContent(self):
        """
        Add defined items in the specified container.
        """
        #If the user does not belong to any STDM group then the system will raise an error so gracefully terminate
        from stdm.security.exception import SecurityException

        userRoles = self._authorizer.userRoles
        
        if len(userRoles) == 0:
            msg = QApplication.translate("ModuleLoader","'%s' must be a member of at least one STDM role in order to access the modules.\nPlease contact " \
                                              "the system administrator for more information."%(self._userName,))
            raise SecurityException(msg)
        
        for k,v in self._contentGroups.iteritems():
            #Generic content items
            if not isinstance(k,ContentGroup):
                self._addItemtoContainer(k)
                
            else:
                #Assert permissions then add to container
                allowedContent = k.checkContentAccess()
                
                if len(allowedContent) > 0:   
                    if v is None:
                        #if there is no parent then add directly to container after asserting permissions
                        self._addItemtoContainer(k.containerItem())
                    else:
                        v[0].addAction(k.containerItem())
                        self._insertWidgettoContainer(v[1])
                    
                    '''
                    Raise signal to indicate that an STDMAction has been added to the container
                    self.contentAdded.emit(k)
                    '''
                
        #Add separator
        if isinstance(self._container,QToolBar) or isinstance(self._container,QMenu):            
            self._separatorAction = self._container.insertSeparator(self._actionReference)

        #Remove consecutive separators
        self._rem_consecutive_separators()
            
        #Emit signal on finishing to load content
        self.finished.emit() 
开发者ID:gltn,项目名称:stdm,代码行数:47,代码来源:container_loader.py

示例10: _create_toolbar

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QToolBar [as 别名]
def _create_toolbar(self, color_maps):
        toolbar = QToolBar()
        toolbar.setFloatable(False)
        toolbar.setMovable(False)

        self._layout_combo = LayoutCombo()
        self._layout_combo_action = QWidgetAction(self._layout_combo)
        self._layout_combo_action.setDefaultWidget(self._layout_combo)
        toolbar.addAction(self._layout_combo_action)
        self._layout_combo.layout_changed.connect(self._slice_view_widget.set_plot_layout)

        # self._colormap_combo = ColormapCombo(['seismic', 'spectral', 'RdGy', 'hot', 'jet', 'gray'])
        self._colormap_combo = ColormapCombo(color_maps)
        self._colormap_combo.currentIndexChanged[int].connect(self._colormap_changed)
        toolbar.addWidget(self._colormap_combo)

        self._save_button = QToolButton()
        self._save_button.setToolTip("Save as image")
        self._save_button.setIcon(resource_icon("table_export.png"))
        self._save_button.clicked.connect(self._save_figure)
        toolbar.addWidget(self._save_button)

        self._settings_button = QToolButton()
        self._settings_button.setToolTip("Toggle settings visibility")
        self._settings_button.setIcon(resource_icon("cog.png"))
        self._settings_button.setCheckable(True)
        self._settings_button.toggled.connect(self._show_settings)
        toolbar.addWidget(self._settings_button)

        self._help_button = QToolButton()
        self._help_button.setToolTip("View help")
        self._help_button.setIcon(resource_icon("help.png"))
        self._help_button.setCheckable(True)
        self._help_button.toggled.connect(self._show_help)
        toolbar.addWidget(self._help_button)

        def toggle_on_close(event):
            self._settings_button.setChecked(False)
            event.accept()

        def toggle_on_close_help(event):
            self._help_button.setChecked(False)
            event.accept()

        self._settings_window.closeEvent = toggle_on_close
        self._help_window.closeEvent = toggle_on_close_help

        self._colormap_combo.setCurrentIndex(45)
        self.set_default_layout()

        return toolbar 
开发者ID:equinor,项目名称:segyviewer,代码行数:53,代码来源:segyviewwidget.py


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