def refreshAddonsList(self,activeIndex=0): self.addonsList.DeleteAllItems() self.curAddons=[] for idx, addon in enumerate(self.unknownCompatibilityAddonsList): self.addonsList.Append(( "", # check box field addon.manifest['summary'], addon.version, addon.manifest.get('lastTestedNVDAVersion') or # Translators: Displayed for add-ons in the incompatible add-ons dialog # if the last tested NVDA version is not specified. _("not specified") )) compatValue = AddonCompatibilityState.getAddonCompatibility(addon, CURRENT_NVDA_VERSION) shouldCheck = compatValue == compatValues.MANUALLY_SET_COMPATIBLE self.addonsList.CheckItem(idx, check=shouldCheck) # select the given active addon, the last addon (after an addon is installed), or the first addon if not given curAddonsLen=len(self.unknownCompatibilityAddonsList) if curAddonsLen>0: # No addons to select if activeIndex==-1: # Special value, select last addon (newly installed) activeIndex=curAddonsLen-1 elif activeIndex<0 or activeIndex>=curAddonsLen: # Index invalid, select first addon. activeIndex=0 self.addonsList.Select(activeIndex,on=1) self.addonsList.SetItemState(activeIndex,wx.LIST_STATE_FOCUSED,wx.LIST_STATE_FOCUSED)
def refreshAddonsList(self, activeIndex=0): self.addonsList.DeleteAllItems() self.curAddons = [] for idx, addon in enumerate(self.unknownCompatibilityAddonsList): self.addonsList.Append(( "", # check box field addon.manifest['summary'], addon.version, addon.manifest.get('lastTestedNVDAVersion') or # Translators: Displayed for add-ons in the incompatible add-ons dialog # if the last tested NVDA version is not specified. _("not specified"))) compatValue = AddonCompatibilityState.getAddonCompatibility( addon, CURRENT_NVDA_VERSION) shouldCheck = compatValue == compatValues.MANUALLY_SET_COMPATIBLE self.addonsList.CheckItem(idx, check=shouldCheck) # select the given active addon, the last addon (after an addon is installed), or the first addon if not given curAddonsLen = len(self.unknownCompatibilityAddonsList) if curAddonsLen > 0: # No addons to select if activeIndex == -1: # Special value, select last addon (newly installed) activeIndex = curAddonsLen - 1 elif activeIndex < 0 or activeIndex >= curAddonsLen: # Index invalid, select first addon. activeIndex = 0 self.addonsList.Select(activeIndex, on=1) self.addonsList.SetItemState(activeIndex, wx.LIST_STATE_FOCUSED, wx.LIST_STATE_FOCUSED)
def test_getAddonCompatibility_stateUnknown_incompatible(self): addonNotSupported = mockAddon(minNVDAVersion=NextNVDAVersionString) self.resetMockStateSaver(addonNotSupported, compatValues.UNKNOWN) compat = AddonCompatibilityState.getAddonCompatibility( addonNotSupported, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_INCOMPATIBLE)
def test_getAddonCompatibility_noState_testedNotSupported_incompatible( self): addonNotSupported = mockAddon(minNVDAVersion=NextNVDAVersionString) compat = AddonCompatibilityState.getAddonCompatibility( addonNotSupported, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_INCOMPATIBLE)
def test_getAddonCompatibility_stateUnknown_testedAndSupported_compatible( self): compatibleAddon = mockAddon() self.resetMockStateSaver(compatibleAddon, compatValues.UNKNOWN) compat = AddonCompatibilityState.getAddonCompatibility( compatibleAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_COMPATIBLE)
def test_getAddonCompatibility_whiteListed_compatible(self): compatibleAddon = mockAddon() self.resetMockStateSaver(compatibleAddon, compatValues.MANUALLY_SET_COMPATIBLE) compat = AddonCompatibilityState.getAddonCompatibility( compatibleAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch( compat, compatValues.AUTO_DEDUCED_COMPATIBLE ) # auto deduced compat trumps manual set compat
def test_getAddonCompatibility_blackListed_untestedWithSupport_manuallySetIncompatible( self): notTestedAddon = mockAddon(lastTestedNVDAVersion=LastNVDAVersionString) self.resetMockStateSaver(notTestedAddon, compatValues.MANUALLY_SET_INCOMPATIBLE) compat = AddonCompatibilityState.getAddonCompatibility( notTestedAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.MANUALLY_SET_INCOMPATIBLE)
def test_getAddonCompatibility_blackListed_testedWithoutSupport_incompatible( self): addonNotSupported = mockAddon(minNVDAVersion=NextNVDAVersionString) self.resetMockStateSaver(addonNotSupported, compatValues.MANUALLY_SET_INCOMPATIBLE) compat = AddonCompatibilityState.getAddonCompatibility( addonNotSupported, CurrentNVDAVersionTuple) self.assertCompatValuesMatch( compat, compatValues.AUTO_DEDUCED_INCOMPATIBLE ) # auto deduced incompt trumps manual set incompat
def test_getAddonCompatibility_stateUnknown_unknown(self): notTestedAddon = mockAddon(lastTestedNVDAVersion=LastNVDAVersionString) self.resetMockStateSaver(notTestedAddon, compatValues.UNKNOWN) compat = AddonCompatibilityState.getAddonCompatibility( notTestedAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.UNKNOWN)
def test_getAddonCompatibility_noState_notTestedWithSupport_unknown(self): notTestedAddon = mockAddon(lastTestedNVDAVersion=LastNVDAVersionString) compat = AddonCompatibilityState.getAddonCompatibility( notTestedAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.UNKNOWN)
def test_getAddonCompatibility_noState_notTestedWithSupport_unknown(self): notTestedAddon = mockAddon(lastTestedNVDAVersion=LastNVDAVersionString) compat = AddonCompatibilityState.getAddonCompatibility(notTestedAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.UNKNOWN)
def test_getAddonCompatibility_noState_testedAndSupported_compatible(self): compatibleAddon = mockAddon() compat = AddonCompatibilityState.getAddonCompatibility(compatibleAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_COMPATIBLE)
def test_getAddonCompatibility_blackListed_testedWithoutSupport_incompatible(self): addonNotSupported = mockAddon(minNVDAVersion=NextNVDAVersionString) self.resetMockStateSaver(addonNotSupported, compatValues.MANUALLY_SET_INCOMPATIBLE) compat = AddonCompatibilityState.getAddonCompatibility(addonNotSupported, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_INCOMPATIBLE) # auto deduced incompt trumps manual set incompat
def test_getAddonCompatibility_blackListed_untestedWithSupport_manuallySetIncompatible(self): notTestedAddon = mockAddon(lastTestedNVDAVersion=LastNVDAVersionString) self.resetMockStateSaver(notTestedAddon, compatValues.MANUALLY_SET_INCOMPATIBLE) compat = AddonCompatibilityState.getAddonCompatibility(notTestedAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.MANUALLY_SET_INCOMPATIBLE)
def test_getAddonCompatibility_blackListed_testedWithSupport_compatible(self): compatibleAddon = mockAddon() self.resetMockStateSaver(compatibleAddon, compatValues.MANUALLY_SET_INCOMPATIBLE) compat = AddonCompatibilityState.getAddonCompatibility(compatibleAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_COMPATIBLE) # auto deduced compat trumps manual set incompat
def test_getAddonCompatibility_stateUnknown_unknown(self): notTestedAddon = mockAddon(lastTestedNVDAVersion=LastNVDAVersionString) self.resetMockStateSaver(notTestedAddon, compatValues.UNKNOWN) compat = AddonCompatibilityState.getAddonCompatibility(notTestedAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.UNKNOWN)
def test_getAddonCompatibility_stateUnknown_incompatible(self): addonNotSupported = mockAddon(minNVDAVersion=NextNVDAVersionString) self.resetMockStateSaver(addonNotSupported, compatValues.UNKNOWN) compat = AddonCompatibilityState.getAddonCompatibility(addonNotSupported, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_INCOMPATIBLE)
def test_getAddonCompatibility_stateUnknown_testedAndSupported_compatible(self): compatibleAddon = mockAddon() self.resetMockStateSaver(compatibleAddon, compatValues.UNKNOWN) compat = AddonCompatibilityState.getAddonCompatibility(compatibleAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_COMPATIBLE)
def test_getAddonCompatibility_noState_testedAndSupported_compatible(self): compatibleAddon = mockAddon() compat = AddonCompatibilityState.getAddonCompatibility( compatibleAddon, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_COMPATIBLE)
def test_getAddonCompatibility_noState_notTestedNotSupported_incompatible(self): addonNotSupported = mockAddon(minNVDAVersion=NextNVDAVersionString, lastTestedNVDAVersion=LastNVDAVersionString) compat = AddonCompatibilityState.getAddonCompatibility(addonNotSupported, CurrentNVDAVersionTuple) self.assertCompatValuesMatch(compat, compatValues.AUTO_DEDUCED_INCOMPATIBLE)