usr bin env python encoding utf-8 import sys from PyQt4 import QtCore

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
# encoding: utf-8
import sys
from PyQt4 import QtCore, QtGui
from osa import search
names = (
('series', u'Серия'),
('number', u'Номер'),
('surname', u'Фамилия'),
('first_name', u'Имя'),
('last_name', u'Отчество'),
('birthday', u'Дата рождения'),
)
app = QtGui.QApplication(sys.argv)
model = search.OsaSAModel(names)
view = QtGui.QTableView()
sort = QtGui.QSortFilterProxyModel()
sort.setSourceModel(model)
view.setModel(sort)
view.horizontalHeader().setSortIndicatorShown(True)
view.horizontalHeader().setClickable(True)
QtCore.QObject.disconnect(view.horizontalHeader(), QtCore.SIGNAL("sectionPressed(int)"),
view, QtCore.SLOT("selectColumn(int)"))
QtCore.QObject.connect(view.horizontalHeader(), QtCore.SIGNAL("sectionClicked(int)"),
view, QtCore.SLOT("sortByColumn(int)"))
view.setAlternatingRowColors(True)
query_res = search.search(series=3003)
print query_res
model.setResultset(query_res)
view.show()
app.exec_()