for vendor in list accounts values for account in list vendor children

 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
43
44
45
46
47
48
for vendor in list(accounts.values()):
for account in list(vendor.children.values()):
item = QtGui.QListWidgetItem('%s ( %s %s - %s )'%(account.login,
account.name,
account.sname,
account.pos),
self.__contacts_list)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(account.login))
self.__contacts_list.openPersistentEditor(item)
self.__accounts[account.login] = account
##----------------------------------------------------------------------------- [ CLASS : ContactsDelegate ]
##
class CheckBoxDelegate(QtGui.QItemDelegate):
def __init__(self, parent):
#
self.__parent = parent
#
super(CheckBoxDelegate, self).__init__()
##
##
##------------------------------------------------------------------------- CREATE EDITOR
##
def createEditor(self, parent, option, index):
editor = QtGui.QCheckBox(parent)
editor.installEventFilter(self)
self.connect(editor, QtCore.SIGNAL('stateChanged(int)'), self.__parent.recvSelectionChanged)
return editor
##
##
##------------------------------------------------------------------------- SET EDITOR DATA
##
def setEditorData(self, editor, index):
editor.setText(index.data().toString())
##
##
##------------------------------------------------------------------------- SET MODEL DATA
##
def setModelData(self, editor, model, index): pass
##
##
##------------------------------------------------------------------------- UPDATE EDITOR GEOMETRY
##
def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect)
##
##
##------------------------------------------------------------------------- [ END CLASS ]