I am making a simple plotting application in PySide.
The main window has a chart
widget which contains my plot figure
.
There are various other widgets and dialogs which need to access the chart
widget to alter properties of the figure
(appearance, plot data etc...).
At the moment, my widgets require the instance of chart
to be passed into them when initialised...this is a terrible way of allowing everything to talk to chart
as there are chains of this reference being passed around.
Is there a way to make the chart
widget 'global' /accessible from any widget?
I have thought about creating a singleton of chart
outside of the main window - any reasons why this would be a bad idea?