def __init__(self, *args, **kw): """ Upon initialization, start Timer, define datahandler and show table view per default """ MainForm.__init__(self, *args, **kw) # Initialize the Exposure Meter plots emc = self.ExposureMeterCur self.alignScales(emc) emc.t = arange(-1000.1, 0.0, 1.0) emc.x = zeros(len(emc.t), Float) emc.lastcounts = 0 emc.counter = 0 emc.setTitle("Current Counts") emc.CountPlot = Qwt.QwtPlotCurve("Counts") emc.CountPlot.attach(emc) emc.CountPlot.setPen(QPen(Qt.red)) emc.setAxisTitle(Qwt.QwtPlot.xBottom, " ") emc.setAxisScale(Qwt.QwtPlot.xBottom, -1000, 0, 200) emc.setAxisTitle(Qwt.QwtPlot.yLeft, " ") ema = self.ExposureMeterAcc self.alignScales(ema) ema.t = arange(-1000.1, 0.0, 1.0) ema.x = zeros(len(ema.t), Float) ema.setTitle("Accumulated Counts") ema.CountPlot = Qwt.QwtPlotCurve("Counts") ema.CountPlot.attach(ema) ema.CountPlot.setPen(QPen(Qt.red)) ema.setAxisTitle(Qwt.QwtPlot.xBottom, "<font size=-1>Last 100 seconds</font>") ema.setAxisScale(Qwt.QwtPlot.xBottom, -1000, 0, 10) ema.setAxisTitle(Qwt.QwtPlot.yLeft, " ") # Setup the timer self.myTimer = QTimer(self) self.connect(self.myTimer, SIGNAL("timeout()"), self.updateStatus) self.myTimer.start(1000) try: self.dh = datahandlers.MySQLhandler() except DBException, e: print e sys.exit(1)
def close(self, *args, **kw): """ Redefine the close() method so we can close datahandler connections before closing the form. This works both for exit via menu and exit via window manager """ self.dh.close() return MainForm.close(self, *args, **kw)