783 ) |
783 ) |
784 if devices: |
784 if devices: |
785 self.__showSpecificInstructions(list(devices)) |
785 self.__showSpecificInstructions(list(devices)) |
786 else: |
786 else: |
787 self.__showAllInstructions() |
787 self.__showAllInstructions() |
788 self.devicesComboBox.addItem("") |
|
789 self.devicesComboBox.addItem(self.tr("Manual Select")) |
788 self.devicesComboBox.addItem(self.tr("Manual Select")) |
790 self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole) |
789 self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole) |
791 elif len(devices) == 1: |
790 elif len(devices) == 1: |
792 # set the board type to the found one |
791 # set the board type to the found one |
793 self.__boardType = devices[0][0] |
792 self.__boardType = devices[0][0] |
797 self.devicesComboBox.setItemData(0, devices[0][2], self.DeviceVidPidRole) |
796 self.devicesComboBox.setItemData(0, devices[0][2], self.DeviceVidPidRole) |
798 self.devicesComboBox.addItem(self.tr("Manual Select")) |
797 self.devicesComboBox.addItem(self.tr("Manual Select")) |
799 self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole) |
798 self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole) |
800 self.on_devicesComboBox_currentIndexChanged(0) |
799 self.on_devicesComboBox_currentIndexChanged(0) |
801 else: |
800 else: |
802 self.devicesComboBox.addItem("") |
801 for index, (boardType, description, vidpid) in enumerate(sorted(devices)): |
803 for index, (boardType, description, vidpid) in enumerate( |
|
804 sorted(devices), 1 |
|
805 ): |
|
806 self.devicesComboBox.addItem(description) |
802 self.devicesComboBox.addItem(description) |
807 self.devicesComboBox.setItemData(index, boardType, self.DeviceTypeRole) |
803 self.devicesComboBox.setItemData(index, boardType, self.DeviceTypeRole) |
808 self.devicesComboBox.setItemData(index, vidpid, self.DeviceVidPidRole) |
804 self.devicesComboBox.setItemData(index, vidpid, self.DeviceVidPidRole) |
809 self.devicesComboBox.addItem(self.tr("Manual Select")) |
805 self.devicesComboBox.addItem(self.tr("Manual Select")) |
810 self.devicesComboBox.setItemData( |
806 self.devicesComboBox.setItemData( |
811 index + 1, self.__manualType, self.DeviceTypeRole |
807 index + 1, self.__manualType, self.DeviceTypeRole |
812 ) |
808 ) |
813 |
809 |
814 # reselect the remembered device, if it is still there |
810 # select the remembered device, if it is still there |
815 if currentDevice: |
811 if currentDevice: |
816 self.devicesComboBox.setCurrentText(currentDevice) |
812 self.devicesComboBox.setCurrentText(currentDevice) |
817 self.firmwarePicker.setText(firmwareFile) |
813 self.firmwarePicker.setText(firmwareFile) |
|
814 elif len(devices) == 1: |
|
815 self.devicesComboBox.setCurrentIndex(0) |
818 else: |
816 else: |
819 self.devicesComboBox.setCurrentIndex(0) |
817 self.devicesComboBox.setCurrentIndex(-1) |
820 |
818 |
821 def __updateFlashButton(self): |
819 def __updateFlashButton(self): |
822 """ |
820 """ |
823 Private method to update the state of the Flash button and the retest |
821 Private method to update the state of the Flash button and the retest |
824 button. |
822 button. |