how to add object from dict

  • Thread starter Mohsen Pahlevanzadeh
  • Start date
M

Mohsen Pahlevanzadeh

Dear all,

I have the following code in projects.py:
##################################################33
for row in xrange(len(uniqueFields)):
instance = QtGui.QCheckBox(uniqueFields[row])

projectsFindInstance.projectsInstance.addOnFieldsInstance.update({"%s" %
uniqueFields[row]:instance})

projectsFindInstance.tableWidget.setCellWidget(row,0,instance)

projectsFindInstance.tableWidget.setRowCount(projectsFindInstance.tableWidget.rowCount()+1)
###############################################################

about code caused i fill up a QTableWidget from QChekBox, and i store
string of QCheckBox and its Object in dict.

and another file,(projectsFind.py) i have the following code:
#################################################################3
for key, val in
self.projectsInstance.addOnFieldsInstance.items():
instance = getattr(self,"%s" % val)
print val
#QtCore.QObject.connect(instance,
QtCore.SIGNAL(_fromUtf8("stateChanged (int)")),
#lambda:
self.projectsInstance.setFilterDict_Find("TWCH",self,"addonfields",instance.CheckState(),instance))
######################################################################3
I want to generate connect function accroding to numbers of obbjects.
But i get the following traceback:

################################################################3
Traceback (most recent call last):
File "./main.py", line 117, in <module>
main()
File "./main.py", line 104, in main
x.showFindProjects()
File "/home/mohsen/codes/amlak/amlak/src/UIInterface.py", line 101, in
showFindProjects
self.uiProjectsFind.setupUi(self.projectsFind)
File "/home/mohsen/codes/amlak/amlak/src/projectsFind.py", line 271,
in setupUi
instance = getattr(self,"%s" % val)
AttributeError: 'Ui_ProjectsFind' object has no attribute
'<PyQt4.QtGui.QCheckBox object at 0xa4abd64>'
#############################################################

Help needed......

Yours,
Mohsen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top