X-Git-Url: http://git.maemo.org/git/?p=retroconv;a=blobdiff_plain;f=bak%2Ftestother.py;fp=bak%2Ftestother.py;h=0000000000000000000000000000000000000000;hp=7c0f7668f6adc11b68a33c34928281b3e2367ec9;hb=d13fa65a92f9782c6505aa12b18e93cc0747ce64;hpb=39b7e1e9a1d3e90acae7d9a300b849f5f9a202d8 diff --git a/bak/testother.py b/bak/testother.py deleted file mode 100644 index 7c0f766..0000000 --- a/bak/testother.py +++ /dev/null @@ -1,48 +0,0 @@ -import sys -from PyQt4.QtCore import * -from PyQt4.QtGui import * - -#################################################################### -def main(): - app = QApplication(sys.argv) - w = MyWindow() - w.show() - sys.exit(app.exec_()) - -#################################################################### -class MyWindow(QWidget): - def __init__(self, *args): - QWidget.__init__(self, *args) - - # create table - list_data = ["Tarek","Ehab","Galal"] - lm = MyListModel(list_data, self) - lv = QListView() - lv.setViewMode(QListView.IconMode) - lv.setModel(lm) - - # layout - layout = QVBoxLayout() - layout.addWidget(lv) - self.setLayout(layout) - -#################################################################### -class MyListModel(QAbstractListModel): - def __init__(self, datain, parent=None, *args): - """ datain: a list where each item is a row - """ - QAbstractListModel.__init__(self, parent, *args) - self.listdata = datain - - def rowCount(self, parent=QModelIndex()): - return len(self.listdata) - - def data(self, index, role): - if index.isValid() and role == Qt.DisplayRole: - return QVariant(self.listdata[index.row()]) - else: - return QVariant() - -#################################################################### -if __name__ == "__main__": - main()