Forum

Author Topic: file path selection  (Read 3617 times)

Geogirl

  • Newbie
  • *
  • Posts: 3
    • View Profile
file path selection
« on: June 02, 2020, 04:55:55 AM »
Hey there is there any way that you can suggest the starting folder when using getExistingDirectory?  Below is the code I have but it defaults to the last folder opened whereas i want it to default to a specific folder on the C:\ where i can select whichever subfolder within it:

def load_photos():
   
   import Metashape
   chunk = Metashape.app.document.chunk
   photos_to_load = []

   today = datetime.today().strftime('%Y_%m_%d')

   photo_folder = Metashape.app.getExistingDirectory("Please select the folder of photos to load.")
   file_path = Path(Metashape.app.document.path)


   print (photo_folder)

Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15465
    • View Profile
Re: file path selection
« Reply #1 on: June 03, 2020, 01:11:12 AM »
Hello Geogirl,

Currently API command do not support definition of the default folder, but you get workaround it with the following call:

Metashape.app.settings.setValue("folders/python", "C:/NewDefaultFolder/")
path = Metashape.app.getExistingDirectory()
Best regards,
Alexey Pasumansky,
Agisoft LLC