def display_query(selcols): ## setup a new empty model model1 = DataFrameModel() ## setup an application and create a table view widget app = QtGui.QApplication([]) widget1 = DataTableWidget() widget1.resize(1600, 800) widget1.show() ## asign the created model widget1.setViewModel(model1) ## fill the model with data model1.setDataFrame(selcols) ## start the app""" app.exec_() return
def goToColumn(self): print "go to column 7" index = self.dataTableView.view().model().index(7, 0) self.dataTableView.view().setCurrentIndex(index) def changeColumnValue(self, columnName, index, dtype): print "failed to change", columnName, "to", dtype print index.data(), index.isValid() self.dataTableView.view().setCurrentIndex(index) def setFilter(self): #filterIndex = eval(self.lineEditFilterCondition.text()) search = DataSearch("Test", self.lineEditFilterCondition.text()) self.dataTableView.view().model().setFilter(search) #raise NotImplementedError def clearFilter(self): self.dataTableView.view().model().clearFilter() if __name__ == '__main__': app = QtGui.QApplication(sys.argv) widget = TestWidget() widget.show() widget.setDataFrame(getCsvData()) #widget.setDataFrame( getRandomData(2, 2) ) app.exec_()
raise ValueError, "Test Test ä" def exception2(): raise ValueError, u"Test Test ä" def exception3(): raise ValueError, u"Test Test" def exception4(): raise ValueError, "Test Test" app = QtGui.QApplication([]) sys.excepthook = excepthook widget = QtGui.QPushButton("raise exceptions") widget.move(100, 100) widget.resize(100, 100) widget.show() widget.clicked.connect(exception) widget.clicked.connect(exception2) widget.clicked.connect(exception3) widget.clicked.connect(exception4) app.exec_() #@pytest.fixture() #def overwriteExcepthook(): #sys.excepthook = excepthook