diff --git a/src/streamlit_app.py b/src/streamlit_app.py index 049b93a..d712c39 100644 --- a/src/streamlit_app.py +++ b/src/streamlit_app.py @@ -176,18 +176,17 @@ with col1: key='source_dir_input', help="Enter the full path to the directory containing files to process") - if is_running_locally(): - if st.button("Browse Source Directory", key='source_browse'): + col1_browse1, col1_browse2 = st.columns([1, 4]) + with col1_browse1: + if st.button("Browse", key='source_browse'): try: root = tk.Tk() root.withdraw() - root.wm_attributes('-topmost', 1) path = filedialog.askdirectory(title="Select Source Directory") - root.destroy() if path: st.session_state['source_dir'] = path st.session_state['source_dir_input'] = path - st.experimental_rerun() + root.destroy() except Exception as e: st.error(f"Error opening directory dialog: {str(e)}") @@ -197,18 +196,17 @@ with col1: key='dest_dir_input', help="Enter the full path where processed files will be saved") - if is_running_locally(): - if st.button("Browse Destination Directory", key='dest_browse'): + col2_browse1, col2_browse2 = st.columns([1, 4]) + with col2_browse1: + if st.button("Browse", key='dest_browse'): try: root = tk.Tk() root.withdraw() - root.wm_attributes('-topmost', 1) path = filedialog.askdirectory(title="Select Destination Directory") - root.destroy() if path: st.session_state['dest_dir'] = path st.session_state['dest_dir_input'] = path - st.experimental_rerun() + root.destroy() except Exception as e: st.error(f"Error opening directory dialog: {str(e)}") @@ -235,18 +233,19 @@ with col2: password_path = st.text_input("Password File Path", help="Enter the full path to the text file containing passwords", value=st.session_state.get('password_path', '')) - if is_running_locally(): - if st.button("Browse Password File"): + col3_browse1, col3_browse2 = st.columns([1, 4]) + with col3_browse1: + if st.button("Browse", key='password_browse'): try: root = tk.Tk() root.withdraw() - root.wm_attributes('-topmost', 1) - path = filedialog.askopenfilename(title="Select Password File", - filetypes=[("Text Files", "*.txt")]) - root.destroy() + path = filedialog.askopenfilename( + title="Select Password File", + filetypes=[("Text Files", "*.txt")] + ) if path: st.session_state['password_path'] = path - st.experimental_rerun() + root.destroy() except Exception as e: st.error(f"Error opening file dialog: {str(e)}")