Skip to content

Commit

Permalink
Studio/place marker: make sure place marker is not an empty string or…
Browse files Browse the repository at this point in the history
… nothing. Re #155.

Mypy: make sure place marker is neither an empty string nor None because track locator expects a genuine string for search text. This also results in moving the conditionals around in place marker script.
  • Loading branch information
josephsl committed Jan 27, 2021
1 parent 117012f commit df599b6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions addon/appModules/splstudio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2618,12 +2618,8 @@ def script_findPlaceMarker(self, gesture):
# #81: no more custom message for place marker track, as the generic one will be enough for now.
if self.canPerformPlaylistCommands() == self.SPLPlaylistNoErrors:
# 21.03/20.09.6-LTS: guard against place marker filename becoming nothing.
if self.placeMarker in (None, ""):
# Nullify place marker if it holds incorrect data.
self.placeMarker = None
# Translators: Presented when no place marker is found.
ui.message(_("No place marker found"))
else:
# #155 (21.03): an extra check to make sure it is indeed a string.
if self.placeMarker is not None and self.placeMarker != "":
obj = api.getFocusObject().parent.firstChild
track = self._trackLocator(self.placeMarker, obj=obj, columns=[obj.indexOf("Filename")])
# 21.03/20.09.6-LTS: only do the following if a track is found.
Expand All @@ -2635,6 +2631,11 @@ def script_findPlaceMarker(self, gesture):
# 21.03/20.09.6-LTS: bogus place marker, so nullify it.
self.placeMarker = None
ui.message(_("No place marker found"))
else:
# Nullify place marker if it holds incorrect data.
self.placeMarker = None
# Translators: Presented when no place marker is found.
ui.message(_("No place marker found"))

def script_metadataStreamingAnnouncer(self, gesture):
# 8.0: Call the module-level function directly.
Expand Down

0 comments on commit df599b6

Please sign in to comment.