Skip to content

Commit

Permalink
Fix #4
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Sep 16, 2023
1 parent 84f1162 commit 5f33fa4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion css_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,15 @@ async def _parse_themes(self, themesDir : str, configDir : str = None) -> list[t

themeData = Theme(themePath, theme, configPath)

if (themeData.name not in [x.name for x in self.themes]):
theme_names = [x.name for x in self.themes]
if (themeData.name in theme_names):
for x in range(5):
new_name = themeData.name + f"_{x}"
if (new_name not in theme_names):
themeData.add_prefix(x)
break

if (themeData.name not in theme_names):
self.themes.append(themeData)
Log(f"Found theme {themeData.name}")

Expand Down
8 changes: 7 additions & 1 deletion css_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,10 @@ def to_dict(self) -> dict:
}

def get_display_name(self) -> str:
return self.display_name if (self.display_name is not None) else self.name
return self.display_name if (self.display_name is not None) else self.name

def add_prefix(self, id : int):
if self.display_name is None:
self.display_name = self.name

self.name += f"_{id}"

0 comments on commit 5f33fa4

Please sign in to comment.