Skip to content

Commit

Permalink
Fix TypeError in folders_to_tags.py
Browse files Browse the repository at this point in the history
- Additionally use proper comparison syntax
  • Loading branch information
CyanVoxel committed Jun 15, 2024
1 parent fae65bd commit 5c25666
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tagstudio/src/qt/modals/folders_to_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def add_folders_to_tree(items: list[str]) -> Tag:


def reverse_tag(library: Library, tag: Tag, list: list[Tag]) -> list[Tag]:
if list != None:
if list is not None:
list.append(tag)
else:
list = [tag]
Expand Down Expand Up @@ -144,7 +144,7 @@ def cut_branches_adding_nothing(branch: dict):
if cut:
branch["dirs"].pop(folder)

if not "tag" in branch:
if "tag" not in branch:
return
if branch["tag"].id == -1 or len(branch["files"]) > 0: # Needs to be first
return False
Expand Down Expand Up @@ -289,7 +289,7 @@ def populate(self, data: dict):
self.children_layout.addWidget(item)
for file in data["files"]:
label = QLabel()
label.setText(" -> " + file)
label.setText(" -> " + str(file))
self.children_layout.addWidget(label)

if len(data["files"]) == 0 and len(data["dirs"].values()) == 0:
Expand Down Expand Up @@ -321,7 +321,7 @@ def __init__(self, tag: Tag, parentTag: Tag) -> None:

self.bg_button = QPushButton(self)
self.bg_button.setFlat(True)
if parentTag != None:
if parentTag is not None:
text = f"{tag.name} ({parentTag.name})".replace("&", "&&")
else:
text = tag.name.replace("&", "&&")
Expand Down

0 comments on commit 5c25666

Please sign in to comment.