Skip to content

Fix path not filled when file is selected#40

Merged
ephread merged 1 commit into
ephread:mainfrom
videlanicolas:patch-3
Nov 14, 2021
Merged

Fix path not filled when file is selected#40
ephread merged 1 commit into
ephread:mainfrom
videlanicolas:patch-3

Conversation

@videlanicolas
Copy link
Copy Markdown
Contributor

Checklist for this pull request

Description

Currently if one presses any folder button on the dock to the right, nothing happens. This is because the popup first emits popup_hide and then file_selected, causing the signal connection to break before file_selected is fired.

To solve this I propose adding an enum that will change depending on the button is pressed. It'll be redundant to use 4 identical EditorFileDialog, we can still use one and change it's parameters. A new variable will hold the enum of the button pressed, and file_selected will execute _on_file_selected method that'll do a match on the selected enum and perform the correct action. If the FileDialog is canceled then file_selected0 is not fired and the enum continues holding the past value. This value is overriden when a new button is pressed.

If for some reason we end up with UNKNOWN that means this function was called from somewhere else other than the 4 buttons, which is not expected.

Currently if one presses any folder button on the dock to the right, nothing happens. This is because the popup first emits `popup_hide` and then `file_selected`, causing the signal connection to break before `file_selected` is fired.

To solve this I propose adding an enum that will change depending on the button is pressed. It'll be redundant to use 4 identical `EditorFileDialog`, we can still use one and change it's parameters. A new variable will hold the enum of the button pressed, and `file_selected` will execute `_on_file_selected` method that'll do a match on the selected enum and perform the correct action. If the FileDialog is canceled then `file_selected0` is not fired and the enum continues holding the past value. This value is overriden when a new button is pressed.

If for some reason we end up with UNKNOWN that means this function was called from somewhere else other than the 4 buttons, which is not expected.
@videlanicolas
Copy link
Copy Markdown
Contributor Author

This fixes #36.

@ephread
Copy link
Copy Markdown
Owner

ephread commented Nov 11, 2021

Thanks for the PR @videlanicolas! I'll try to have a look tomorrow.

@videlanicolas
Copy link
Copy Markdown
Contributor Author

Thanks!

@ephread ephread merged commit dc24eb8 into ephread:main Nov 14, 2021
@ephread
Copy link
Copy Markdown
Owner

ephread commented Nov 14, 2021

Great improvement!

@videlanicolas videlanicolas deleted the patch-3 branch November 18, 2021 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants