|
25 | 25 | from plotpy.interfaces import IPanel |
26 | 26 | from plotpy.interfaces import items as itf |
27 | 27 | from plotpy.panels.base import PanelWidget |
| 28 | +from plotpy.plot import BasePlot, PlotManager |
28 | 29 | from plotpy.styles.base import ItemParameters |
29 | 30 |
|
30 | 31 | if TYPE_CHECKING: |
31 | 32 | from qtpy.QtGui import QContextMenuEvent, QIcon |
32 | 33 | from qtpy.QtWidgets import QListWidgetItem, QWidget |
33 | 34 |
|
34 | | - from plotpy.plot import BasePlot, PlotManager |
35 | | - |
36 | 35 |
|
37 | 36 | class ItemListWidget(QW.QListWidget): |
38 | 37 | """ |
@@ -73,6 +72,7 @@ def register_panel(self, manager: PlotManager) -> None: |
73 | 72 | for plot in self.manager.get_plots(): |
74 | 73 | plot.SIG_ITEMS_CHANGED.connect(self.items_changed) |
75 | 74 | plot.SIG_ACTIVE_ITEM_CHANGED.connect(self.active_item_changed) |
| 75 | + plot.SIG_ITEM_PARAMETERS_CHANGED.connect(self.item_parameters_changed) |
76 | 76 | self.plot = self.manager.get_plot() |
77 | 77 |
|
78 | 78 | def contextMenuEvent(self, event: QContextMenuEvent) -> None: |
@@ -230,6 +230,17 @@ def active_item_changed(self, plot: BasePlot) -> None: |
230 | 230 | self.refresh_actions() |
231 | 231 | self.blockSignals(_block) |
232 | 232 |
|
| 233 | + def item_parameters_changed(self, item: itf.IBasePlotItem) -> None: |
| 234 | + """Item parameters have changed |
| 235 | +
|
| 236 | + Args: |
| 237 | + item: item |
| 238 | + """ |
| 239 | + if not isinstance(item, BasePlot): |
| 240 | + plot = item.plot() |
| 241 | + if plot is not None: |
| 242 | + self.items_changed(plot) |
| 243 | + |
233 | 244 | def current_row_changed(self, index: int) -> None: |
234 | 245 | """QListWidget current row has changed |
235 | 246 |
|
|
0 commit comments