本文整理汇总了Python中PySide.QtGui.QToolBar方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QToolBar方法的具体用法?Python QtGui.QToolBar怎么用?Python QtGui.QToolBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QToolBar方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QToolBar [as 别名]
def __init__(self, fig):
# Setup data range variables for scrolling
self.fig = fig
self.xmin, self.xmax = fig.plotItem.vb.childrenBounds()[0]
self.step = 1 # axis units
self.scale = 1e3 # conversion betweeen scrolling units and axis units
# Retrive the QMainWindow used by current figure and add a toolbar
# to host the new widgets
self.win = QtGui.QMainWindow()
self.win.show()
self.win.resize(800,600)
self.win.setCentralWidget(fig)
self.toolbar = QtGui.QToolBar()
self.win.addToolBar(QtCore.Qt.BottomToolBarArea, self.toolbar)
# Create the slider and spinbox for x-axis scrolling in toolbar
self.set_slider(self.toolbar)
self.set_spinbox(self.toolbar)
# Set the initial xlimits coherently with values in slider and spinbox
self.set_xlim = self.fig.setXRange
self.set_xlim(0, self.step)
示例2: FSGetToolbarItem
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QToolBar [as 别名]
def FSGetToolbarItem(tname, iname):
mw = QtGui.qApp.activeWindow()
tb = None
for c in mw.children():
if isinstance(c, QtGui.QToolBar) and c.windowTitle() == tname:
tb = c
break
if tb == None:
return None
for c in tb.children():
if isinstance(c, QtGui.QToolButton) and c.text() == iname:
return c
return None
# fastener chach - prevent recreation of same fasteners
示例3: toggleToolbars
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QToolBar [as 别名]
def toggleToolbars(mcs):
hgrp = mcs.getToolbarParams()
show = False
for toolbar in mcs._HiddenToolbars:
if not hgrp.GetBool(toolbar,True):
show = True
break
mw = FreeCADGui.getMainWindow()
for toolbar in mcs._HiddenToolbars:
if show != hgrp.GetBool(toolbar,True):
hgrp.SetBool(toolbar,show)
tb = mw.findChild(QtGui.QToolBar,toolbar)
if not tb:
logger.error('cannot find toolbar "{}"',toolbar)
tb.setVisible(show)
示例4: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QToolBar [as 别名]
def __init__(self, fig, scroll_step=10):
# Setup data range variables for scrolling
self.fig = fig
self.scroll_step = scroll_step
self.xmin, self.xmax = fig.axes[0].get_xlim()
self.width = 1 # axis units
self.pos = 0 # axis units
self.scale = 1e3 # conversion betweeen scrolling units and axis units
# Save some MPL shortcuts
self.draw = self.fig.canvas.draw
self.draw_idle = self.fig.canvas.draw_idle
self.ax = self.fig.axes[0]
# 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 xlimits coherently with values in slider and spinbox
self.ax.set_xlim(self.pos,self.pos+self.width)
self.draw()
示例5: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QToolBar [as 别名]
def __init__(self, fig, scroll_step=10):
# Setup data range variables for scrolling
self.fig = fig
self.scroll_step = scroll_step
self.xmin, self.xmax = fig.axes[0].get_xlim()
self.width = 1 # axis units
self.pos = 0 # axis units
self.scale = 1e3 # conversion betweeen scrolling units and axis units
# Save some MPL shortcuts
self.draw = self.fig.canvas.draw
self.draw_idle = self.fig.canvas.draw_idle
self.ax = self.fig.axes[0]
self.set_xlim = self.ax.set_xlim
# 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 xlimits coherently with values in slider and spinbox
self.set_xlim(0, self.width)
self.draw()
示例6: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QToolBar [as 别名]
def __init__(self, fig, line, ydata, dx, scroll_step=10):
# Setup data range variables for scrolling
self.fig, self.line, self. ydata, self.dx = fig, line, ydata, dx
self.scroll_step = scroll_step
self.xmin, self.xmax = 0, dx*ydata.size
self.plot_width = 1 # axis units
self.scale = 1e3 # conversion betweeen scrolling units and axis units
self.disp_points = self.plot_width/self.dx
# Save some MPL shortcuts
self.draw = self.fig.canvas.draw
self.draw_idle = self.fig.canvas.draw_idle
self.ax = self.fig.axes[0]
self.set_xlim = self.ax.set_xlim
# 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 xlimits coherently with values in slider and spinbox
self.set_xlim(0, self.plot_width)
self.ax.set_ylim(ydata.min(), ydata.max())
# Setup the initial plot
self.line.set_data(np.arange(self.disp_points)*dx,
ydata[:self.disp_points])
text0 = self.ax.text(0.01,0.02, "T = ", transform=fig.transFigure)
self.text = self.ax.text(0.05,0.02, "0", transform=fig.transFigure)
self.draw()
示例7: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.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()
示例8: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QToolBar [as 别名]
def __init__(self, *args, **kwargs):
QtGui.QToolBar.__init__(self)
Custom.__init__(self, *args, **kwargs)