def handleKeyInformationTemplates(self, kits): self._keyDataListCtrl.DeleteAllItems() kitsLen = len(kits) kitsCount = kitsLen / 4 for i in xrange(kitsCount): keySetVersion = ord(kits[i * 4 + 0]) keyIndex = ord(kits[i * 4 + 1]) keyType = ord(kits[i * 4 + 2]) keyLength = ord(kits[i * 4 + 3]) i = self._keyDataListCtrl.GetItemCount() keyItem = ListItem() keyItem.SetId(i) keyItem.SetColumn(0) keyItem.SetText("%d" %(i)) self._keyDataListCtrl.InsertItem(keyItem) keyItem.SetColumn(1) keyItem.SetText("%02X" %(keySetVersion)) self._keyDataListCtrl.SetItem(keyItem) keyItem.SetColumn(2) keyItem.SetText("%02X" %(keyIndex)) self._keyDataListCtrl.SetItem(keyItem) keyItem.SetColumn(3) keyItem.SetText("%02X" %(keyType)) self._keyDataListCtrl.SetItem(keyItem) keyItem.SetColumn(4) keyItem.SetText("%02X" %(keyLength)) self._keyDataListCtrl.SetItem(keyItem)
def handleAPDUResponse(self, responseStr, transtime, args=tuple()): """Handle controller's apdu response event, to display apdu result informations;""" theListCtrl = args[0] itemIndex = 0 if len(args) == 1: itemIndex = theListCtrl.GetItemCount() - 1 else: itemIndex = args[1] responseItem = ListItem() responseItem.SetId(itemIndex) responseItem.SetColumn(2) responseItem.SetText(responseStr) theListCtrl.SetItem(responseItem) timeItem = ListItem() timeItem.SetId(itemIndex) timeItem.SetColumn(3) timeItem.SetText(Util.getTimeStr(transtime)) theListCtrl.SetItem(timeItem) indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('%d' %(itemIndex)) theListCtrl.SetItem(indexItem) self._scrollToLine(theListCtrl, itemIndex)
def handleAPDUCommand(self, commandStr, args=tuple()): """Handle controller's apdu command event, to display apdu command;""" theListCtrl = args[0] itemIndex = 0 if len(args) == 1: itemIndex = theListCtrl.GetItemCount() indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('> %d' %(itemIndex)) theListCtrl.InsertItem(indexItem) else: itemIndex = args[1] indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('> %d' %(itemIndex)) theListCtrl.SetItem(indexItem) commandItem = ListItem() commandItem.SetId(itemIndex) commandItem.SetColumn(1) commandItem.SetText(commandStr) theListCtrl.SetItem(commandItem) datetimeItem = ListItem() datetimeItem.SetId(itemIndex) datetimeItem.SetColumn(4) datetimeItem.SetText(datetime.now().strftime("%c")) theListCtrl.SetItem(datetimeItem) self._scrollToLine(theListCtrl, itemIndex)
def __handleAPDUResponse(self, responseStr, transtime, args): theListCtrl = args[0] itemIndex = 0 if len(args) > 1: itemIndex = args[1] else: itemIndex = theListCtrl.GetItemCount() - 1 responseItem = ListItem() responseItem.SetId(itemIndex) responseItem.SetColumn(2) responseItem.SetText(responseStr) theListCtrl.SetItem(responseItem) timeItem = ListItem() timeItem.SetId(itemIndex) timeItem.SetColumn(3) timeItem.SetText(Util.getTimeStr(transtime)) theListCtrl.SetItem(timeItem) indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('%d' % (itemIndex)) theListCtrl.SetItem(indexItem) theListCtrl.Refresh() theListCtrl.EnsureVisible(itemIndex)
def __handleAPDUCommand(self, commandStr, args): theListCtrl = args[0] itemIndex = 0 if len(args) > 1: itemIndex = args[1] indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('> %d' % (itemIndex)) theListCtrl.SetItem(indexItem) else: itemIndex = theListCtrl.GetItemCount() indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('> %d' % (itemIndex)) theListCtrl.InsertItem(indexItem) commandItem = ListItem() commandItem.SetId(itemIndex) commandItem.SetColumn(1) commandItem.SetText(commandStr) theListCtrl.SetItem(commandItem) datetimeItem = ListItem() datetimeItem.SetId(itemIndex) datetimeItem.SetColumn(4) datetimeItem.SetText(datetime.now().strftime("%c")) theListCtrl.SetItem(datetimeItem) theListCtrl.EnsureVisible(itemIndex)
def handleLoadScriptItem(self, scriptItemStr): itemIndex = self._scriptListCtrl.GetItemCount() scriptItem = ListItem() scriptItem.SetId(itemIndex) scriptItem.SetColumn(0) scriptItem.SetText('%d' %(itemIndex)) self._scriptListCtrl.InsertItem(scriptItem) scriptItem.SetId(itemIndex) scriptItem.SetColumn(1) scriptItem.SetText(scriptItemStr) self._scriptListCtrl.SetItem(scriptItem)