Hi All,
I
am using the following code to populate a tree control. The dictionary
currently I am using is ‘dictFolders’ and its structure
is defined below.
lstFolders=[]
lstFolders =
[“A”,“B”,“C”,“D”]
dictFolders={}
dictFolders =
{“A”:[“Obj1”,“Obj2”,“Obj3”,“Obj4”,“Obj5”,“Obj6”,“Obj7”,“Obj8”,“Obj9”],
“B”:[“Doc1”,“Doc2”,“Doc3”,“Doc4”,“Doc5”,“Doc6”,“Doc7”,“Doc8”,“Doc9”],
“C”:[“Link1”,“Link2”,“Link3”,“Link4”,“Link5”,“Link6”],
“D”:[“Obj1”,“Obj2”,“Obj3”,“Obj4”,“Obj5”,“Obj6”,“Obj7”]}
Setting the
root node text to the Action ID entered
self.treeAction.SetItemText(self.treeAction.GetRootItem(),”Parent Folder
Name”)
Loop to
Populate the tree containing Action Objects
print
“length of dictFolders=”, len(dictFolders)
for intIndex in
range (0,len(dictFolders)):
#If tree control does not have any children then append Items
if self.treeAction.ItemHasChildren(nodeFolders[intIndex])==False:
for intiLoopIndex in range (0,len(dictFolders[lstFolders[intIndex]])):
self.treeAction.AppendItem(nodeFolders[intIndex],(dictFolders[lstFolders[intIndex]][intiLoopIndex]))
self.treeAction.ExpandAllChildren(nodeFolders[intIndex])
Collapsing all
children after populating
for intIndex in
range(0,len(dictFolders.keys())):
self.treeAction.CollapseAllChildren(nodeFolders[intIndex])
Now I want to implement the same with a new dictionary whose
structure is given below:
dictFoldersNew = {“A”:{“XYZ”: [[“Name1”,
“UID1”], [“Name2”, “UID2”]],
“PLM”: [[“Number1”, “UUID1”], [“Number2”,
“UID2”]],
“RST”: [[“ID1”, “UUID1”], [“ID2”,
“UID2”]]},
“B”: [[“IDB1”, “UID1”], [“IDB2”, “UID2”]],
“C”: [[“IDC1”, “UID1”], [“IDC2”, “UID2”]],
“D”: [[“IDD1”, “UID1”], [“IDD2”, “UID2”]]}
I want a second level of folders under A and the rest of the
structure should remain the same. Under XYZ, PLM and RST I want to
display UID1,Number1 and ID1 respectively. And under B,C and D, I want to display
(IDB1,IDB2),( IDC1,IDC2). IDD1,IDD2) respectively.
How can I do this?.. Presently I am unable to understand
the new dictionary format.
Any help is much appreciated.
Regards,
Rajendra
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***