James McCool
commited on
Commit
·
db18707
1
Parent(s):
dd71678
Update pagination button labels for improved clarity in app.py
Browse files- Changed button labels to display the current page number instead of generic "Previous" and "Next" text, enhancing user understanding of navigation.
- Maintained session state management by ensuring relevant data is cleared upon page navigation, consistent with previous enhancements.
app.py
CHANGED
|
@@ -196,18 +196,15 @@ with tab2:
|
|
| 196 |
# Create pagination controls in a single row
|
| 197 |
pagination_cols = st.columns([4, 1, 1, 1, 4])
|
| 198 |
with pagination_cols[1]:
|
| 199 |
-
if st.button("
|
| 200 |
if st.session_state['current_page'] > 0:
|
| 201 |
st.session_state.current_page -= 1
|
| 202 |
if 'player_frame' in st.session_state:
|
| 203 |
del st.session_state['player_frame']
|
| 204 |
del st.session_state['stack_frame']
|
| 205 |
|
| 206 |
-
with pagination_cols[2]:
|
| 207 |
-
st.markdown(f"**Page {st.session_state.current_page + 1} of {total_pages}**", unsafe_allow_html=True)
|
| 208 |
-
|
| 209 |
with pagination_cols[3]:
|
| 210 |
-
if st.button("
|
| 211 |
if 'current_page' not in st.session_state:
|
| 212 |
st.session_state.current_page = 1
|
| 213 |
else:
|
|
@@ -215,6 +212,7 @@ with tab2:
|
|
| 215 |
if 'player_frame' in st.session_state:
|
| 216 |
del st.session_state['player_frame']
|
| 217 |
del st.session_state['stack_frame']
|
|
|
|
| 218 |
# Calculate start and end indices for current page
|
| 219 |
start_idx = st.session_state.current_page * rows_per_page
|
| 220 |
end_idx = min((st.session_state.current_page + 1) * rows_per_page, total_rows)
|
|
|
|
| 196 |
# Create pagination controls in a single row
|
| 197 |
pagination_cols = st.columns([4, 1, 1, 1, 4])
|
| 198 |
with pagination_cols[1]:
|
| 199 |
+
if st.button(f"Page {st.session_state.current_page - 1}", disabled=st.session_state.current_page == 0):
|
| 200 |
if st.session_state['current_page'] > 0:
|
| 201 |
st.session_state.current_page -= 1
|
| 202 |
if 'player_frame' in st.session_state:
|
| 203 |
del st.session_state['player_frame']
|
| 204 |
del st.session_state['stack_frame']
|
| 205 |
|
|
|
|
|
|
|
|
|
|
| 206 |
with pagination_cols[3]:
|
| 207 |
+
if st.button(f"Page {st.session_state.current_page + 1}", disabled=st.session_state.current_page == total_pages - 1):
|
| 208 |
if 'current_page' not in st.session_state:
|
| 209 |
st.session_state.current_page = 1
|
| 210 |
else:
|
|
|
|
| 212 |
if 'player_frame' in st.session_state:
|
| 213 |
del st.session_state['player_frame']
|
| 214 |
del st.session_state['stack_frame']
|
| 215 |
+
|
| 216 |
# Calculate start and end indices for current page
|
| 217 |
start_idx = st.session_state.current_page * rows_per_page
|
| 218 |
end_idx = min((st.session_state.current_page + 1) * rows_per_page, total_rows)
|