Skip to content

themes in subdirectories #157

@rcsmit

Description

@rcsmit

With a growing number of themes, I wanted to put them in subdirectories (original, made_by_me, made_by_others, from_maperitive)

Easy implementation

`def get_available_themes():

if not THEMES_DIR.exists():
    st.error("THEMES_DIR doesnt exist")
    return []

themes = []
for file in sorted(THEMES_DIR.iterdir()):
    if file.is_file() and file.suffix.lower() == '.json':
        theme_name = file.stem
        themes.append(f"{theme_name}")


for folder in sorted(THEMES_DIR.iterdir()):
    if folder.is_dir():
        for file in folder.iterdir(): 
            theme_file = folder / f"{file.stem}.json"
            if theme_file.exists():
                themes.append(f"{folder.name}/{file.stem}")
return themes

Ingenerate_output_filename(city, theme_name, file_format="png")` this line has to be added

theme_name = theme_name.lower().replace(' ', '_').replace(',', '').replace('\\', '_').replace('/', '_')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions