本文整理汇总了Python中PyMca.QtBlissGraph.QtBlissGraph.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Python QtBlissGraph.setTitle方法的具体用法?Python QtBlissGraph.setTitle怎么用?Python QtBlissGraph.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyMca.QtBlissGraph.QtBlissGraph
的用法示例。
在下文中一共展示了QtBlissGraph.setTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ScanPlotWidget
# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setTitle [as 别名]
class ScanPlotWidget(qt.QWidget):
def __init__(self, parent=None, name="scan_plot_widget"):
qt.QWidget.__init__(self, parent, name)
self.xdata = []
self.ylabel = ""
self.isRealTimePlot = None
self.isConnected = None
self.isScanning = None
self.lblTitle = qt.QLabel(self)
self.graphPanel = qt.QFrame(self)
buttonBox = qt.QHBox(self)
self.lblPosition = qt.QLabel(buttonBox)
self.graph = QtBlissGraph(self.graphPanel)
qt.QObject.connect(
self.graph, qt.PYSIGNAL("QtBlissGraphSignal"), self.handleBlissGraphSignal
)
qt.QObject.disconnect(
self.graph,
qt.SIGNAL("plotMousePressed(const QMouseEvent&)"),
self.graph.onMousePressed,
)
qt.QObject.disconnect(
self.graph,
qt.SIGNAL("plotMouseReleased(const QMouseEvent&)"),
self.graph.onMouseReleased,
)
self.graph.canvas().setMouseTracking(True)
self.graph.enableLegend(False)
self.graph.enableZoom(False)
# self.graph.setAutoLegend(False)
self.lblPosition.setAlignment(qt.Qt.AlignRight)
self.lblTitle.setAlignment(qt.Qt.AlignHCenter)
self.lblTitle.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
self.lblPosition.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
buttonBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
qt.QVBoxLayout(self.graphPanel)
self.graphPanel.layout().addWidget(self.graph)
qt.QVBoxLayout(self)
self.layout().addWidget(self.lblTitle)
self.layout().addWidget(buttonBox)
self.layout().addWidget(self.graphPanel)
self.setPaletteBackgroundColor(qt.Qt.white)
def setRealTimePlot(self, isRealTime):
self.isRealTimePlot = isRealTime
def newScanStarted(self, scanParameters):
self.graph.clearcurves()
self.isScanning = True
self.lblTitle.setText("<nobr><b>%s</b></nobr>" % scanParameters["title"])
self.xdata = []
self.graph.xlabel(scanParameters["xlabel"])
self.ylabel = scanParameters["ylabel"]
ylabels = self.ylabel.split()
self.ydatas = [[] for x in range(len(ylabels))]
for labels, ydata in zip(ylabels, self.ydatas):
self.graph.newcurve(labels, self.xdata, ydata)
self.graph.ylabel(self.ylabel)
self.graph.setx1timescale(False)
self.graph.replot()
self.graph.setTitle("Energy scan started. Waiting values...")
def newScanPoint(self, x, y):
self.xdata.append(x)
for label, ydata, yvalue in zip(
self.ylabel.split(), self.ydatas, str(y).split()
):
ydata.append(float(yvalue))
self.graph.newcurve(label, self.xdata, ydata)
self.graph.setTitle("Energy scan in progress. Please wait...")
self.graph.replot()
def handleBlissGraphSignal(self, signalDict):
if signalDict["event"] == "MouseAt" and self.isScanning:
self.lblPosition.setText(
"(X: %0.2f, Y: %0.2f)" % (signalDict["x"], signalDict["y"])
)
def plotResults(
self,
pk,
fppPeak,
fpPeak,
ip,
fppInfl,
fpInfl,
rm,
chooch_graph_x,
chooch_graph_y1,
chooch_graph_y2,
title,
):
self.graph.clearcurves()
#.........这里部分代码省略.........
示例2: ScanPlotWidget
# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setTitle [as 别名]
class ScanPlotWidget(QtGui.QWidget):
def __init__(self, parent = None, name = "scan_plot_widget"):
QtGui.QWidget.__init__(self, parent)
if name is not None:
self.setObjectName(name)
self.xdata = []
self.ylabel = ""
self.isRealTimePlot = None
self.isConnected = None
self.isScanning = None
self.lblTitle = QtGui.QLabel(self)
#self.graphPanel = qt.QFrame(self)
#buttonBox = qt.QHBox(self)
self.lblPosition = QtGui.QLabel(self)
self.graph = QtBlissGraph(self)
QtCore.QObject.connect(self.graph, QtCore.SIGNAL('QtBlissGraphSignal'), self.handleBlissGraphSignal)
QtCore.QObject.disconnect(self.graph, QtCore.SIGNAL('plotMousePressed(const QMouseEvent&)'), self.graph.onMousePressed)
QtCore.QObject.disconnect(self.graph, QtCore.SIGNAL('plotMouseReleased(const QMouseEvent&)'), self.graph.onMouseReleased)
self.graph.canvas().setMouseTracking(True)
self.graph.enableLegend(False)
self.graph.enableZoom(False)
#self.graph.setAutoLegend(False)
"""self.lblPosition.setAlignment(qt.Qt.AlignRight)
self.lblTitle.setAlignment(qt.Qt.AlignHCenter)
self.lblTitle.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
self.lblPosition.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
buttonBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
qt.QVBoxLayout(self.graphPanel)
self.graphPanel.layout().addWidget(self.graph)
qt.QVBoxLayout(self)
self.layout().addWidget(self.lblTitle)
self.layout().addWidget(buttonBox)
self.layout().addWidget(self.graphPanel)
self.setPaletteBackgroundColor(qt.Qt.white)"""
_main_vlayout = QtGui.QVBoxLayout(self)
_main_vlayout.addWidget(self.lblTitle)
_main_vlayout.addWidget(self.lblPosition)
_main_vlayout.addWidget(self.graph)
_main_vlayout.setSpacing(2)
_main_vlayout.setContentsMargins(0, 0, 0, 0)
def setRealTimePlot(self, isRealTime):
self.isRealTimePlot = isRealTime
def start_new_scan(self, scanParameters):
self.graph.clearcurves()
self.isScanning = True
self.lblTitle.setText('<nobr><b>%s</b></nobr>' % scanParameters['title'])
self.xdata = []
self.graph.xlabel(scanParameters['xlabel'])
self.ylabel = scanParameters['ylabel']
ylabels = self.ylabel.split()
self.ydatas = [[] for x in range(len(ylabels))]
for labels,ydata in zip(ylabels,self.ydatas):
self.graph.newcurve(labels,self.xdata,ydata)
self.graph.ylabel(self.ylabel)
self.graph.setx1timescale(False)
self.graph.replot()
self.graph.setTitle("Energy scan started. Waiting values...")
def add_new_plot_value(self, x, y):
self.xdata.append(x)
for label,ydata,yvalue in zip(self.ylabel.split(),self.ydatas,str(y).split()) :
ydata.append(float(yvalue))
self.graph.newcurve(label,self.xdata,ydata)
self.graph.setTitle("Energy scan in progress. Please wait...")
self.graph.replot()
def handleBlissGraphSignal(self, signalDict):
if signalDict['event'] == 'MouseAt' and self.isScanning:
self.lblPosition.setText("(X: %0.2f, Y: %0.2f)" % (signalDict['x'], signalDict['y']))
def plot_results(self, pk, fppPeak, fpPeak, ip, fppInfl, fpInfl,
rm, chooch_graph_x, chooch_graph_y1, chooch_graph_y2, title):
self.graph.clearcurves()
self.graph.setTitle(title)
self.graph.newcurve("spline", chooch_graph_x, chooch_graph_y1)
self.graph.newcurve("fp", chooch_graph_x, chooch_graph_y2)
self.graph.replot()
self.isScanning = False
def plot_scan_curve(self, scan_data):
self.graph.clearcurves()
self.graph.setTitle("Energy scan finished")
self.lblTitle.setText("")
xdata = [scan_data[el][0] for el in range(len(scan_data))]
ydata = [scan_data[el][1] for el in range(len(scan_data))]
self.graph.newcurve("energy", xdata, ydata)
self.graph.replot()
def clear(self):
#.........这里部分代码省略.........
示例3: EnergyScanBrickPX2
# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setTitle [as 别名]
#.........这里部分代码省略.........
try:
blsample_id = int(sample[0])
except BaseException:
pass
else:
self.blSampleId = blsample_id
break
def setSession(self, session_id, prop_code=None,
prop_number=None, prop_id=None, expiration_time=0):
#print "EnergyScanBrick.setSession",session_id
self.sessionId = session_id
if prop_code is None or prop_number is None:
pass
else:
self.archive_directory = str(prop_code) + str(prop_number)
def setDirectory(self, scan_dir):
self.directoryInput.setText(scan_dir)
def setPrefix(self, scan_prefix):
self.prefixInput.setText(scan_prefix)
def setElement(self, symbol, edge):
logging.getLogger().info("ENERGYSCANBRICK.setElement %s, %s" % (symbol, edge))
if symbol is None:
self.clearEnergies()
self.setEnabled(False)
self.element = None
else:
if self.energyScan is not None and self.energyScan.canScanEnergy():
self.setEnabled(True)
self.element = (symbol, edge)
self.statusBox.setTitle("%s - %s" % (self.element[0], self.element[1]))
def resetEnergies(self):
confirm_dialog = QMessageBox("Confirm reset",
"This will also clear your energies in the Collect tab. Press OK to reset the energies.",
QMessageBox.Warning, QMessageBox.Ok, QMessageBox.Cancel,
QMessageBox.NoButton, self)
s = self.font().pointSize()
f = confirm_dialog.font()
f.setPointSize(s)
confirm_dialog.setFont(f)
confirm_dialog.updateGeometry()
if confirm_dialog.exec_loop() == QMessageBox.Ok:
self.inflectionInput.setText("")
self.peakInput.setText("")
self.remoteInput.setText("")
self.remote2Input.setText("")
self.emit(PYSIGNAL('edgeScanEnergies'), ({},))
def acceptEnergies(self):
if self.peakInput.hasAcceptableInput():
pk = float(self.peakInput.text())
else:
pk = None
if self.inflectionInput.hasAcceptableInput():
ip = float(self.inflectionInput.text())
else:
ip = None
if self.remoteInput.hasAcceptableInput():
rm = float(self.remoteInput.text())
else:
示例4: PymcaPlotWidget
# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setTitle [as 别名]
class PymcaPlotWidget(QWidget):
"""
Descript. :
"""
def __init__(self, parent, realtime_plot = False):
"""
Descript. :
"""
QWidget.__init__(self, parent)
self.axis_x_array = []
self.axis_y_array = []
self.realtime_plot = realtime_plot
self.pymca_graph = Graph(self)
self.pymca_graph.showGrid()
self.info_label = QLabel("", self)
self.info_label.setAlignment(Qt.AlignRight)
_main_vlayout = QVBoxLayout(self)
_main_vlayout.addWidget(self.pymca_graph)
_main_vlayout.addWidget(self.info_label)
_main_vlayout.setSpacing(2)
_main_vlayout.setContentsMargins(2, 2, 2, 2)
self.setSizePolicy(QSizePolicy.Expanding,
QSizePolicy.Expanding)
if qt_variant == 'PyQt5':
pass
else:
QObject.connect(self.pymca_graph,
SIGNAL("QtBlissGraphSignal"),
self.handle_graph_signal)
Qt4_widget_colors.set_widget_color(self, Qt4_widget_colors.WHITE)
def clear(self):
"""
Descript. :
"""
self.pymca_graph.clearcurves()
self.pymca_graph.setTitle("")
self.info_label.setText("")
def plot_energy_scan_curve(self, scan_result, scan_title):
"""Results are converted to two list describing
x and y axes
"""
x_data = [item[0] for item in scan_result]
y_data = [item[1] for item in scan_result]
self.pymca_graph.newcurve("Energy", x_data, y_data)
self.pymca_graph.replot()
self.pymca_graph.setTitle(scan_title)
self.pymca_graph.setx1axislimits(min(x_data), max(x_data))
def start_new_scan(self, scan_info):
"""
Descript. :
"""
self.axis_x_array = []
self.axis_y_array = []
self.pymca_graph.clearcurves()
self.pymca_graph.xlabel(scan_info['xlabel'])
self.ylabel = scan_info['ylabel']
self.pymca_graph.ylabel(self.ylabel)
self.pymca_graph.setx1timescale(False)
self.pymca_graph.replot()
self.pymca_graph.setTitle(scan_info['title'])
def plot_energy_scan_results(self, pk, fppPeak, fpPeak, ip, fppInfl,
fpInfl, rm, chooch_graph_x, chooch_graph_y1, chooch_graph_y2, title):
"""
"""
self.pymca_graph.clearcurves()
self.pymca_graph.setTitle(title)
self.pymca_graph.newcurve("spline", chooch_graph_x, chooch_graph_y1)
self.pymca_graph.newcurve("fp", chooch_graph_x, chooch_graph_y2)
self.pymca_graph.replot()
self.pymca_graph.setx1axislimits(min(chooch_graph_x),
max(chooch_graph_x))
def plot_finished(self):
"""
Descript. :
"""
if self.axis_x_array:
self.pymca_graph.setx1axislimits(min(self.axis_x_array),
max(self.axis_x_array))
self.pymca_graph.replot()
def add_new_plot_value(self, x, y):
"""
Descript. :
"""
if self.realtime_plot:
self.axis_x_array.append(x / 1000.0)
self.axis_y_array.append(y / 1000.0)
#.........这里部分代码省略.........