-
Notifications
You must be signed in to change notification settings - Fork 122
/
refl_choose_col.py
33 lines (31 loc) · 1.45 KB
/
refl_choose_col.py
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
#This is an extension of refl_columns.py as that is a auto-generated script form pyqt and shouldn't be edited
#so this file provides any extra GUI tweaks not easily doable in the designer
#for the time being this also includes non-GUI behaviour
import refl_columns
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class ReflChoose(refl_columns.Ui_ChooseColumnsDialog):
visiblestates = {}
def setupUi(self, Dialog, ColHeaders, table):
super(ReflChoose, self).setupUi(Dialog)
self.visiblestates.clear()
self.listColumns.itemChanged.connect(self.on_listColumns_itemChanged)
self.buttonsColumns.clicked.connect(self.on_buttonsColumns_Clicked)
for key, value in ColHeaders.iteritems():
header = table.horizontalHeaderItem(key).text()
item = QtGui.QListWidgetItem(header)
if value:
item.setCheckState(2)
else:
item.setCheckState(0)
self.listColumns.insertItem(key, item)
def on_listColumns_itemChanged(self, item):
colno=self.listColumns.row(item)
self.visiblestates[colno] = (item.checkState() > 0)
def on_buttonsColumns_Clicked(self, button):
if self.buttonsColumns.button(QtGui.QDialogButtonBox.RestoreDefaults) == button:
for i in range(self.listColumns.count()):
self.listColumns.item(i).setCheckState(2)