Skip to content

Commit

Permalink
open both docs and images folders
Browse files Browse the repository at this point in the history
Open both docs and images folders when a user clicks that main button to see documents queued to be entered into the database.
  • Loading branch information
BBC-Esq authored Jan 7, 2024
1 parent 7810bfa commit bc975cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/choose_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def choose_documents_directory():
for file_path in file_paths:
extension = Path(file_path).suffix.lower()
if extension in allowed_extensions:
# Determine target folder without creating it
if extension in ['.png', '.jpg', '.jpeg', '.bmp', '.gif', '.tif', '.tiff']:
target_folder = current_dir / "Images_for_DB"
else:
Expand Down Expand Up @@ -65,14 +64,18 @@ def choose_documents_directory():
def see_documents_directory():
current_dir = Path(__file__).parent.resolve()
docs_folder = current_dir / "Docs_for_DB"
images_folder = current_dir / "Images_for_DB"

os_name = platform.system()
if os_name == 'Windows':
subprocess.Popen(['explorer', str(docs_folder)])
subprocess.Popen(['explorer', str(images_folder)])
elif os_name == 'Darwin':
subprocess.Popen(['open', str(docs_folder)])
subprocess.Popen(['open', str(images_folder)])
elif os_name == 'Linux':
subprocess.Popen(['xdg-open', str(docs_folder)])
subprocess.Popen(['xdg-open', str(images_folder)])

if __name__ == '__main__':
app = QApplication([])
Expand Down

0 comments on commit bc975cd

Please sign in to comment.