class Content(QtWidgets.QWidget): ''' Provides the main content widget. Contains the sysmptoms and the diagnosis panes. Also creates the DDStorm object and performs the main operation. ''' # Signal to detect when change=QtCore.pyqtSignal() def __init__(self): ''' Initiate the content widget ''' super(Content, self).__init__() # Create DDStorm object with the global configuration self.dd=DDStorm(True, conf) # Show warning if any error happened during data compilation if(not self.dd.compiler.is_clean()): ret=QtWidgets.QMessageBox.warning(self, "Compilation Error", "Error was encountered while compiling the Knowledgebase.", "Ignore", "View Log") if(ret==1): x_logfile() self.initUI() def initUI(self): ''' Create the user interface of the widget ''' global conf grid=QtWidgets.QGridLayout() self.setLayout(grid) self.symp=Symptoms(self.dd.symptoms()) self.symp.setFrameShape(QtWidgets.QFrame.StyledPanel) self.symp.changed.connect(self.update) self.diff=Differentials() self.diff.setFrameShape(QtWidgets.QFrame.StyledPanel) grid.addWidget(self.symp, 0, 0) grid.addWidget(self.diff, 0, 1) grid.setColumnStretch(0, 1) grid.setColumnStretch(1, 1) QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create("Cleanlooks")) def update(self, data): ''' Update the inteface with refreshed information ''' self.diff.update(self.dd.dd(data)) self.change.emit()
def initUI(self): ''' Create the user interface of the widget ''' global conf grid=QtWidgets.QGridLayout() self.setLayout(grid) self.symp=Symptoms(self.dd.symptoms()) self.symp.setFrameShape(QtWidgets.QFrame.StyledPanel) self.symp.changed.connect(self.update) self.diff=Differentials() self.diff.setFrameShape(QtWidgets.QFrame.StyledPanel) grid.addWidget(self.symp, 0, 0) grid.addWidget(self.diff, 0, 1) grid.setColumnStretch(0, 1) grid.setColumnStretch(1, 1) QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create("Cleanlooks"))