本文整理匯總了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)
示例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
示例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())
示例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()
示例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)
示例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
示例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)
示例8: toolbar
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolBar [as 別名]
def toolbar(self):
""" :rtype: QToolBar """
return self._toolbar
示例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()
示例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