def __handleCapFileInfo(self, info): self._capFileInformationTreeCtrl.DeleteAllItems() tr = self._capFileInformationTreeCtrl.AddRoot( self._capFilePicker.GetPath()) packageAID = info['loadFileAID'] ti = self._capFileInformationTreeCtrl.InsertItem( tr, TreeItemId(), "".join("%02X" % (ord(c)) for c in packageAID), data=TreeItemData({ 'type': 'package', 'aid': packageAID })) tic = TreeItemId() for appletAID in info['applets']: tic = self._capFileInformationTreeCtrl.InsertItem( ti, tic, "".join("%02X" % (ord(c)) for c in appletAID), data=TreeItemData({ 'type': 'applet', 'aid': appletAID })) self._capFileInformationTreeCtrl.ExpandAll() self._loadButton.Enable()
def _initTree(self): """Initialize the tree""" self._nodes["<vbtreeroot>"] = self._parent.AddRoot("Root", data=TreeItemData("<vbtreeroot>")) self._parent.SetPyData(self._nodes["<vbtreeroot>"], "<vbtreeroot>")
def handleStatus(self, theStatus): self._contentTreeCtrl.DeleteAllItems() ri = self._contentTreeCtrl.AddRoot('STATUS') tir = TreeItemId() status_names = { 0x80 : 'ISD', 0x40 : 'SSD/Applets', 0x20 : 'ExecutableFiles', 0x10 : 'ExecutableFileAndModules' } for theElement in theStatus.keys(): tir = self._contentTreeCtrl.InsertItem(ri, tir, status_names[theElement], data=TreeItemData({ 'type' : 'root' })) ti = TreeItemId() if theElement == 0x10: statusData = theStatus[theElement] if statusData != None: executableModulesData = statusData[1] for executableModuleData in executableModulesData: packageAID = executableModuleData['aid'] packageLifeCycleState = executableModuleData['lifeCycleState'] ti = self._contentTreeCtrl.InsertItem(tir, ti, "AID: " + "".join("%02X" %(ord(c)) for c in packageAID) + " - LifeCycle: %02X" %(packageLifeCycleState), data = TreeItemData({ 'type' : 'package', 'aid' : packageAID})) executableModules = executableModuleData['executableModules'] ti2 = TreeItemId() for executableModule in executableModules: ti2 = self._contentTreeCtrl.InsertItem(ti, ti2, "AID: " + "".join("%02X" %(ord(c)) for c in executableModule), data = TreeItemData({ 'type' : 'applet', 'aid' : executableModule})) else: statusData = theStatus[theElement] if statusData != None: appletInfos = statusData[0] for appletInfo in appletInfos: appletAID = appletInfo['aid'] appletLifeCycleState = appletInfo['lifeCycleState'] appletPrivileges = appletInfo['privileges'] ti = self._contentTreeCtrl.InsertItem(tir, ti, "AID: " + "".join("%02X" %(ord(c)) for c in appletAID) + " - LifeCycle: %02X - Privileges: %02X" %(appletLifeCycleState, appletPrivileges), data = TreeItemData({ 'type' : 'package' if theElement == 0x20 else 'instance', 'aid' : appletAID})) self._contentTreeCtrl.ExpandAll()