Move annotatedName to AddonManager to allow outside access
This commit is contained in:
parent
569f42c0f5
commit
c45ea26cd6
@ -115,6 +115,12 @@ When loading '%(name)s':
|
|||||||
def addonName(self, dir):
|
def addonName(self, dir):
|
||||||
return self.addonMeta(dir).get("name", dir)
|
return self.addonMeta(dir).get("name", dir)
|
||||||
|
|
||||||
|
def annotatedName(self, dir):
|
||||||
|
buf = self.addonName(dir)
|
||||||
|
if not self.isEnabled(dir):
|
||||||
|
buf += _(" (disabled)")
|
||||||
|
return buf
|
||||||
|
|
||||||
# Conflict resolution
|
# Conflict resolution
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
@ -456,7 +462,7 @@ class AddonsDialog(QDialog):
|
|||||||
addonList = self.form.addonList
|
addonList = self.form.addonList
|
||||||
mgr = self.mgr
|
mgr = self.mgr
|
||||||
|
|
||||||
self.addons = [(self.annotatedName(d), d) for d in mgr.allAddons()]
|
self.addons = [(mgr.annotatedName(d), d) for d in mgr.allAddons()]
|
||||||
self.addons.sort()
|
self.addons.sort()
|
||||||
|
|
||||||
selected = set(self.selectedAddons())
|
selected = set(self.selectedAddons())
|
||||||
@ -477,12 +483,6 @@ class AddonsDialog(QDialog):
|
|||||||
addon = ''
|
addon = ''
|
||||||
self.form.viewPage.setEnabled(bool (re.match(r"^\d+$", addon)))
|
self.form.viewPage.setEnabled(bool (re.match(r"^\d+$", addon)))
|
||||||
|
|
||||||
def annotatedName(self, dir):
|
|
||||||
buf = self.mgr.addonName(dir)
|
|
||||||
if not self.mgr.isEnabled(dir):
|
|
||||||
buf += _(" (disabled)")
|
|
||||||
return buf
|
|
||||||
|
|
||||||
def selectedAddons(self):
|
def selectedAddons(self):
|
||||||
idxs = [x.row() for x in self.form.addonList.selectedIndexes()]
|
idxs = [x.row() for x in self.form.addonList.selectedIndexes()]
|
||||||
return [self.addons[idx][1] for idx in idxs]
|
return [self.addons[idx][1] for idx in idxs]
|
||||||
|
Loading…
Reference in New Issue
Block a user