3939
4040def qwtEnableLegendItems (plot , on ):
4141 if on :
42- plot .SIG_LEGEND_DATA_CHANGED .connect (plot .updateLegendItems )
42+ plot .legendDataChanged .connect (plot .updateLegendItems )
4343 else :
44- plot .SIG_LEGEND_DATA_CHANGED .disconnect (plot .updateLegendItems )
44+ plot .legendDataChanged .disconnect (plot .updateLegendItems )
4545
4646def qwtSetTabOrder (first , second , with_children ):
4747 tab_chain = [first , second ]
@@ -255,10 +255,26 @@ class QwtPlot(QFrame, QwtPlotDict):
255255
256256 :param str title: Title text
257257 :param QWidget parent: Parent widget
258+
259+ .. py:data:: itemAttached
260+
261+ A signal indicating, that an item has been attached/detached
262+
263+ :param plotItem: Plot item
264+ :param on: Attached/Detached
265+
266+ .. py:data:: legendDataChanged
267+
268+ A signal with the attributes how to update
269+ the legend entries for a plot item.
270+
271+ :param itemInfo: Info about a plot item, build from itemToInfo()
272+ :param data: Attributes of the entries (usually <= 1) for the plot item.
273+
258274 """
259275
260- SIG_ITEM_ATTACHED = Signal ("PyQt_PyObject" , bool )
261- SIG_LEGEND_DATA_CHANGED = Signal ("PyQt_PyObject" , "PyQt_PyObject" )
276+ itemAttached = Signal ("PyQt_PyObject" , bool )
277+ legendDataChanged = Signal ("PyQt_PyObject" , "PyQt_PyObject" )
262278
263279 # enum Axis
264280 yLeft , yRight , xBottom , xTop , axisCnt = list (range (5 ))
@@ -1432,8 +1448,7 @@ def insertLegend(self, legend, pos=None, ratio=-1):
14321448 del self .__data .legend
14331449 self .__data .legend = legend
14341450 if self .__data .legend :
1435- self .SIG_LEGEND_DATA_CHANGED .connect (
1436- self .__data .legend .updateLegend )
1451+ self .legendDataChanged .connect (self .__data .legend .updateLegend )
14371452 if self .__data .legend .parent () is not self :
14381453 self .__data .legend .setParent (self )
14391454
@@ -1467,14 +1482,14 @@ def insertLegend(self, legend, pos=None, ratio=-1):
14671482
14681483 def updateLegend (self , plotItem = None ):
14691484 """
1470- If plotItem is None, emit QwtPlot.SIG_LEGEND_DATA_CHANGED for all
1485+ If plotItem is None, emit QwtPlot.legendDataChanged for all
14711486 plot item. Otherwise, emit the signal for passed plot item.
14721487
14731488 :param qwt.plot.QwtPlotItem plotItem: Plot item
14741489
14751490 .. seealso::
14761491
1477- :py:meth:`QwtPlotItem.legendData()`, :py:data:`QwtPlot.SIG_LEGEND_DATA_CHANGED `
1492+ :py:meth:`QwtPlotItem.legendData()`, :py:data:`QwtPlot.legendDataChanged `
14781493 """
14791494 if plotItem is None :
14801495 items = list (self .itemList ())
@@ -1486,7 +1501,7 @@ def updateLegend(self, plotItem=None):
14861501 legendData = []
14871502 if plotItem .testItemAttribute (QwtPlotItem .Legend ):
14881503 legendData = plotItem .legendData ()
1489- self .SIG_LEGEND_DATA_CHANGED .emit (plotItem , legendData )
1504+ self .legendDataChanged .emit (plotItem , legendData )
14901505
14911506 def updateLegendItems (self , plotItem , legendData ):
14921507 """
@@ -1527,13 +1542,13 @@ def attachItem(self, plotItem, on):
15271542 else :
15281543 self .removeItem (plotItem )
15291544
1530- self .SIG_ITEM_ATTACHED .emit (plotItem , on )
1545+ self .itemAttached .emit (plotItem , on )
15311546
15321547 if plotItem .testItemAttribute (QwtPlotItem .Legend ):
15331548 if on :
15341549 self .updateLegend (plotItem )
15351550 else :
1536- self .SIG_LEGEND_DATA_CHANGED .emit (plotItem , [])
1551+ self .legendDataChanged .emit (plotItem , [])
15371552
15381553 self .autoRefresh ()
15391554
0 commit comments