Skip to content

Commit 3b408a8

Browse files
authored
Merge 3279035 into e349494
2 parents e349494 + 3279035 commit 3b408a8

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

source/addonHandler/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ def runInstallTask(self,taskName,*args,**kwargs):
621621
if func:
622622
func(*args,**kwargs)
623623

624-
def getDocFilePath(self, fileName=None):
624+
def getDocFilePath(self, fileName: Optional[str] = None) -> Optional[str]:
625625
r"""Get the path to a documentation file for this add-on.
626626
The file should be located in C{doc\lang\file} inside the add-on,
627627
where C{lang} is the language code and C{file} is the requested file name.
@@ -630,9 +630,7 @@ def getDocFilePath(self, fileName=None):
630630
An add-on can specify a default documentation file name
631631
via the docFileName parameter in its manifest.
632632
@param fileName: The requested file name or C{None} for the add-on's default.
633-
@type fileName: str
634633
@return: The path to the requested file or C{None} if it wasn't found.
635-
@rtype: str
636634
"""
637635
if not fileName:
638636
fileName = self.manifest["docFileName"]

source/gui/_addonStoreGui/viewModels/store.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,16 @@ def _makeActionsList(self):
201201
# Translators: Label for an action that opens help for the selected addon
202202
displayName=pgettext("addonStore", "&Help"),
203203
actionHandler=self.helpAddon,
204-
validCheck=lambda aVM: aVM.model.isInstalled and self._filteredStatusKey in (
205-
# Showing help in the updatable add-ons view is misleading
206-
# as we can only fetch the add-on help from the installed version.
207-
_StatusFilterKey.INSTALLED,
208-
_StatusFilterKey.INCOMPATIBLE,
204+
validCheck=lambda aVM: (
205+
aVM.model.isInstalled
206+
and self._filteredStatusKey in (
207+
# Showing help in the updatable add-ons view is misleading
208+
# as we can only fetch the add-on help from the installed version.
209+
_StatusFilterKey.INSTALLED,
210+
_StatusFilterKey.INCOMPATIBLE,
211+
)
212+
and aVM.model._addonHandlerModel is not None
213+
and aVM.model._addonHandlerModel.getDocFilePath() is not None
209214
),
210215
listItemVM=selectedListItem
211216
),
@@ -236,7 +241,9 @@ def _makeActionsList(self):
236241
]
237242

238243
def helpAddon(self, listItemVM: AddonListItemVM) -> None:
244+
assert listItemVM.model._addonHandlerModel is not None
239245
path = listItemVM.model._addonHandlerModel.getDocFilePath()
246+
assert path is not None
240247
startfile(path)
241248

242249
def removeAddon(self, listItemVM: AddonListItemVM) -> None:

0 commit comments

Comments
 (0)