Skip to content

Commit

Permalink
Update example galleries with required variables passed in.
Browse files Browse the repository at this point in the history
  • Loading branch information
hreikin committed Mar 9, 2023
1 parent fb48218 commit ea9d040
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Home.py
Expand Up @@ -34,4 +34,5 @@
st.header("Streamlit Uploads Library")
st.markdown(body=install_instructions)
st.code(body=example_usage_code)
default_gallery = Gallery(directory="assets")
default_gallery = Gallery(directory="assets")
gallery_with_columns = Gallery(directory="assets", number_of_columns=3)
4 changes: 1 addition & 3 deletions pages/Caching.py
Expand Up @@ -27,6 +27,4 @@
st.header("Caching")
st.markdown(body=cache_usage)
default_gallery = Gallery(directory="assets")
gallery_with_columns = Gallery(directory="assets", label="**Gallery - Columns**", number_of_columns=3)
expander_gallery = Gallery(directory="assets", expanded=True, gallery_type="expander", label="**Gallery - Expander**")
multiple_options_gallery = Gallery(directory="assets", gallery_type="expander", label="**Gallery - Multiple Options**", number_of_columns=3, show_filename=False)
gallery_with_columns = Gallery(directory="assets", number_of_columns=3)
10 changes: 1 addition & 9 deletions pages/Gallery.py
Expand Up @@ -80,12 +80,8 @@ def create_gallery(self):
"""
configuration = """
- `directory` (required): A `str()` of the path to the folder containing the gallery images, for example, `"assets"`.
- `expanded` (optional): A `bool()`, passing `False` starts the expander type gallery closed, default is open and `True`.
- `file_extensions` (optional): A `tuple()` containing strings of the file extensions to include in the gallery, default is `(".png", ".jpg", ".jpeg")`.
- `gallery_type` (optional): A `str()` with either "container" or "expander" used as the keyword, the default is `"container"`.
- `label` (optional): A `str()` containing the name of the gallery, passing `None` disables the label. The default value is `"Gallery"`.
- `number_of_columns` (optional): An `int()` defining the number of required columns, default is `5`.
- `show_filenames` (optional): A `bool()`, passing `True` displays the filenames, the default is `False` which hides them.
"""
example_usage_code = """
import streamlit as st
Expand All @@ -94,8 +90,6 @@ def create_gallery(self):
st.set_page_config(page_title="Streamlit Uploads Library")
default_gallery = Gallery(directory="assets")
gallery_with_columns = Gallery(directory="assets", label="**Gallery - Columns**", number_of_columns=3)
expander_gallery = Gallery(directory="assets", expanded=True, gallery_type="expander", label="**Gallery - Expander**")
multiple_options_gallery = Gallery(directory="assets", gallery_type="expander", label="**Gallery - Multiple Options**", number_of_columns=3, show_filename=False)
"""

with st.sidebar:
Expand All @@ -106,9 +100,7 @@ def create_gallery(self):
st.markdown(body=configuration)
st.code(body=example_usage_code)
default_gallery = Gallery(directory="assets")
gallery_with_columns = Gallery(directory="assets", label="**Gallery - Columns**", number_of_columns=3)
expander_gallery = Gallery(directory="assets", expanded=True, gallery_type="expander", label="**Gallery - Expander**")
multiple_options_gallery = Gallery(directory="assets", gallery_type="expander", label="**Gallery - Multiple Options**", number_of_columns=3, show_filename=False)
gallery_with_columns = Gallery(directory="assets", number_of_columns=3)

with st.expander(label="**Source Code**", expanded=True):
st.code(body=source_code)
4 changes: 4 additions & 0 deletions pages/Library.py
@@ -0,0 +1,4 @@
import streamlit as st
from src.streamlit_uploads_library.library import Library

library = Library(directory="assets", number_of_columns=4)

0 comments on commit ea9d040

Please sign in to comment.