def removeClicked(self): r = Remove() selected = self.m_AttPanel.m_TableModel.getSelectedAttributes() if len(selected) == 0: return if len(selected) == self.m_Instances.numAttributes(): Utils.DiglogWarning(self.m_Explore, "Can't remove all attributes from data!\n") return r.setAttributeIndicesArray(selected) self.applyFilter(r)
def openFile(self): filename = QFileDialog.getOpenFileName( self.m_tab, '打开文件', '/', 'Arff data files(*.arff);;CSV data files(*.csv)') file = open(filename[0], 'rb') self.m_FileName = os.path.basename(file.name).split('.')[0] # 解析arff with file: s = file.read().decode('utf-8') try: data = arff.loads(s) except arff.BadLayout: Utils.DiglogWarning(self.m_Explor, "Syntax Errors in Data Sets") return inst = Instances(data) print(data) self.setInstances(inst) self.m_tabWidget.setTabEnabled(1, True) self.m_tabWidget.setTabEnabled(2, True)
def diglogError(self, txt: str): Utils.DiglogWarning(self.m_Explorer, txt)