B
bg_ie
Hi,
At my work we have a framework writen in python which allows us to
test our equipment. This framework is quite large and uses a Singelton
called frameworkExec which we pass around between objects in order to
share functionailty. For example, frameWorkExec stores an instance of
the BatteryManagement module which I use to set the voltage during
certain tests.
I've just writen a gui using wx which I wish to use to calibrate our
voltage supply. I launch this app at the moment within python win as
follows -
app = VoltageCalibrationApp(0)
app.MainLoop()
class VoltageCalibrationApp(wx.App):
def OnInit(self):
voltageCalibration = {}
voltageCalibration[0.0] = 1.2
voltageCalibration[9.0] = 10.1
voltageCalibration[22.0] = 22.7
voltageCalibration[24.0] = 24.8
voltageCalibration[30.0] = 31.1
voltageCalibration[35.0] = 36.9
frame = VoltageCalibrationFrame(None, -1, 'Voltage Calibration',
voltageCalibration)
frame.Show(True)
frame.Centre()
return True
I hope that by adding the code above into the framework, I will be
able to call this app as part of the framework before the execution of
certain tests, as follows -
app = VoltageCalibrationApp(0)
app.MainLoop()
test1.run()
test2.run()
As you can see in the VoltageCalibrationApp class, I am currently
hardcoding voltageCalibration. Rather than doing this, I wish to store
them in our singleton which is available at the scope at which I
create my VoltageCalibrationApp instance. But I can't figure our a way
of referencing my singleton with the OnInit function. Normally, you
would pass the reference via __init__
How can I do this?
Thanks,
Barry.
At my work we have a framework writen in python which allows us to
test our equipment. This framework is quite large and uses a Singelton
called frameworkExec which we pass around between objects in order to
share functionailty. For example, frameWorkExec stores an instance of
the BatteryManagement module which I use to set the voltage during
certain tests.
I've just writen a gui using wx which I wish to use to calibrate our
voltage supply. I launch this app at the moment within python win as
follows -
app = VoltageCalibrationApp(0)
app.MainLoop()
class VoltageCalibrationApp(wx.App):
def OnInit(self):
voltageCalibration = {}
voltageCalibration[0.0] = 1.2
voltageCalibration[9.0] = 10.1
voltageCalibration[22.0] = 22.7
voltageCalibration[24.0] = 24.8
voltageCalibration[30.0] = 31.1
voltageCalibration[35.0] = 36.9
frame = VoltageCalibrationFrame(None, -1, 'Voltage Calibration',
voltageCalibration)
frame.Show(True)
frame.Centre()
return True
I hope that by adding the code above into the framework, I will be
able to call this app as part of the framework before the execution of
certain tests, as follows -
app = VoltageCalibrationApp(0)
app.MainLoop()
test1.run()
test2.run()
As you can see in the VoltageCalibrationApp class, I am currently
hardcoding voltageCalibration. Rather than doing this, I wish to store
them in our singleton which is available at the scope at which I
create my VoltageCalibrationApp instance. But I can't figure our a way
of referencing my singleton with the OnInit function. Normally, you
would pass the reference via __init__
How can I do this?
Thanks,
Barry.