pythonarcade / arcade

Easy to use Python library for creating 2D arcade games.
http://arcade.academy
Other
1.71k stars 324 forks source link

Provide dialogue to choose a file or path #1201

Open eruvanos opened 2 years ago

eruvanos commented 2 years ago

Goal

A player should be able to choose a file or path on system, to support following use cases:

Main features

What should be available

Active development

https://github.com/Ibrahim2750mi/arcade/blob/UIFileChooser/arcade/gui/widgets/layout.py#L365

Discussion summary

Main window vs separate window

We go for a a rendered dialogue within the main window, because:

Drag

Start without drag support, go for the main features.

Modal

Start without any special modal features, go for the main features.

Example dialogues for inspiration

image image image

Ibrahim2750mi commented 2 years ago

you can assign this issue to me

pushfoo commented 2 years ago

Recap of today's discord discussion: Discussion resulted in a mockup for what an early minimal version of the file picker could look like: image

Ibrahim made a good point: FileDialog is probably the most appropriate name for this class. Also, we could omit scrollbars from an early PR to begin dogfooding this feature in our projects.

A favorites sidebar can wait until further releases, but I think there's a decent way of handling it in a reasonably cross-platform way:

  1. Use pathlib to get the home directory
  2. Start a dict: { 'Home' : resolved_home_path }
  3. Add an entry to the dict for each existing home subdirectory : 'Desktop', 'Documents', 'Downloads', 'Music', 'Pictures', 'Videos'
  4. Generate some buttons from the dict keys to put in the lefthand favorites sidebar

I think most current operating systems use the above convention for default home sub-directories. If some break with the convention, we could add platform specific lists if needed. It could also be useful to support overriding the favorites list with a constructor argument.

Ibrahim2750mi commented 1 year ago

Currently waiting for #1523