import sys import qt import string import time from SummaryForm import * from Prelude import * from StatusBarDialog import * from Misc import disable_resize class SummaryDialog(SummaryForm): def __init__(self, parent, interface): SummaryForm.__init__(self, parent) disable_resize(self) self.interface = interface self.connect(self.updateButton, SIGNAL("clicked()"), self.update) def update(self): db = self.interface.db informations = (("Retrieving Alert Count...", db.getTotalAlertCount, self.totalalertTextLabel.setText), ("Retrieving Source IP...", db.getSourceIPCount, self.srcipcountTextLabel.setText), ("Retrieving Target IP...", db.getTargetIPCount, self.dstipcountTextLabel.setText), ("Retrieving Classification Count...", db.getAlertClassificationCount, self.alertclasscountTextLabel.setText), ("Retrieving Analyzer Count...", db.getAnalyzerClassCount, self.analyzerclasscountTextLabel.setText), ("Retrieving Protocol Count...", db.getTargetProtocolCount, self.targetprotocolcountTextLabel.setText), ("Retrieving First Alert Time...", db.getFirstAlertTime, self.firstalertdateTextLabel.setText), ("Retrieving Last Alert Time...", db.getLastAlertTime, self.lastalertdateTextLabel.setText), ) progress = StatusBarDialog(self, "Updating Summary", "Starting up...", "cancel", len(informations)) progress.show() for message, getValue, setText in informations: self.interface.app.processEvents() progress.update(message) value = str(getValue()) setText("
%s
" % value) if progress.wasCancelled(): return self.lastupdatetimeTextLabel.setText('%s
' % time.strftime("%Y-%m-%d %H:%M:%S"))