Skip to content

Commit

Permalink
added .download_button, link_button, page_link, .toggle and .camera_i…
Browse files Browse the repository at this point in the history
…nput to monkey wrapping
  • Loading branch information
444B authored Mar 8, 2024
1 parent ee335a9 commit cf2d61d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/streamlit_analytics2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def reset_counts():
_orig_time_input = st.time_input
_orig_file_uploader = st.file_uploader
_orig_color_picker = st.color_picker
# new elements, testing
_orig_download_button = st.download_button
_orig_link_button = st.link_button
_orig_page_link = st.page_link
_orig_toggle = st.toggle
_orig_camera_input = st.camera_input

_orig_sidebar_button = st.sidebar.button
_orig_sidebar_checkbox = st.sidebar.checkbox
Expand All @@ -62,6 +68,13 @@ def reset_counts():
_orig_sidebar_time_input = st.sidebar.time_input
_orig_sidebar_file_uploader = st.sidebar.file_uploader
_orig_sidebar_color_picker = st.sidebar.color_picker
# new elements, testing
_orig_sidebar_download_button = st.sidebar.download_button
_orig_sidebar_link_button = st.sidebar.link_button
_orig_sidebar_page_link = st.sidebar.page_link
_orig_sidebar_toggle = st.sidebar.toggle
_orig_sidebar_camera_input = st.sidebar.camera_input



def _track_user():
Expand Down Expand Up @@ -290,6 +303,12 @@ def start_tracking(
st.time_input = _wrap_value(_orig_time_input)
st.file_uploader = _wrap_file_uploader(_orig_file_uploader)
st.color_picker = _wrap_value(_orig_color_picker)
# new elements, testing
st.download_button = _wrap_value(_orig_download_button)
st.link_button = _wrap_value(_orig_link_button)
st.page_link = _wrap_value(_orig_page_link)
st.toggle = _wrap_value(_orig_toggle)
st.camera_input = _wrap_value(_orig_camera_input)

st.sidebar.button = _wrap_button(_orig_sidebar_button)
st.sidebar.checkbox = _wrap_checkbox(_orig_sidebar_checkbox)
Expand All @@ -305,6 +324,13 @@ def start_tracking(
st.sidebar.time_input = _wrap_value(_orig_sidebar_time_input)
st.sidebar.file_uploader = _wrap_file_uploader(_orig_sidebar_file_uploader)
st.sidebar.color_picker = _wrap_value(_orig_sidebar_color_picker)
# new elements, testing
st.sidebar.download_button = _wrap_value(_orig_sidebar_download_button)
st.sidebar.link_button = _wrap_value(_orig_sidebar_link_button)
st.sidebar.page_link = _wrap_value(_orig_sidebar_page_link)
st.sidebar.toggle = _wrap_value(_orig_sidebar_toggle)
st.sidebar.camera_input = _wrap_value(_orig_sidebar_camera_input)


# replacements = {
# "button": _wrap_bool,
Expand Down Expand Up @@ -364,6 +390,12 @@ def stop_tracking(
st.time_input = _orig_time_input
st.file_uploader = _orig_file_uploader
st.color_picker = _orig_color_picker
# new elements, testing
st.download_button = _orig_download_button
st.link_button = _orig_link_button
st.page_link = _orig_page_link
st.toggle = _orig_toggle
st.camera_input = _orig_camera_input

st.sidebar.button = _orig_sidebar_button
st.sidebar.checkbox = _orig_sidebar_checkbox
Expand All @@ -379,6 +411,12 @@ def stop_tracking(
st.sidebar.time_input = _orig_sidebar_time_input
st.sidebar.file_uploader = _orig_sidebar_file_uploader
st.sidebar.color_picker = _orig_sidebar_color_picker
# new elements, testing
st.sidebar.download_button = _orig_sidebar_download_button
st.sidebar.link_button = _orig_sidebar_link_button
st.sidebar.page_link = _orig_sidebar_page_link
st.sidebar.toggle = _orig_sidebar_toggle
st.sidebar.camera_input = _orig_sidebar_camera_input

# Save count data to firestore.
# TODO: Maybe don't save on every iteration but on regular intervals in a background
Expand Down

0 comments on commit cf2d61d

Please sign in to comment.