Page MenuHome

File Browser: autocomplete now keeps focus in the file text field when using it to enter a directory.
ClosedPublic

Authored by Brecht Van Lommel (brecht) on Nov 22 2013, 2:18 AM.

Details

Summary

There is a bunch of internal refactoring going on too:

  • No longer use operators to handle these directory and file fields, only makes things more complicated than they should be.
  • Handle autocomplete partial/full match deeper in the UI code

TODO: still a problem in ui_apply_but_func that needs to be solved.

Depends on D20

Diff Detail

Branch
arcpatch-D20_2

Event Timeline

Brecht Van Lommel (brecht) updated this revision to Unknown Object (????).Nov 22 2013, 2:29 AM

Simplify code a bit.

Hi Brecht,

first, thanks for looking into this, code looks good so far, will try it out as soon as the other patch D20: Fix T37485 Autocomplete while appending and autocomplete folder behaviour is committed.

If I read the code correctly though, this drops the ability to create a new directory by typing it in the directory button. I personally would be ok with dropping this, but I received a lot of requests for adding this again when I implemented the file browser for 2.5 (I originally didn't port this over).

Andrea.

source/blender/editors/interface/interface_handlers.c
2334–2337

Note to self, this part of the code is also potentially unfinished.

source/blender/editors/space_file/file_ops.c
1231

Creating new directories should still work, but it's calling the FILE_OT_directory_new operator for that now.

Hi Brecht,

Have been testing this a bit today. I assume you're still working on this, so just wanted to let you know of the remaining issues I encountered:

In the directory text button the focus doesn't yet stay in after TAB.
Also, in the directory text button, if there is a partial match and the poll for creating a new directory is cancelled the directory button contains the partial match followed by a /, which is a non-existing directory.

Lastly one question, what problem in ui_apply_but_func is it that needs needs to be solved.

Let me know if you want some help with the above issues, I could dedicate some time this week.

source/blender/editors/space_file/file_ops.c
1231

Ah sorry, I must have had something in front of my eyes, all fine :)

In the directory text button the focus doesn't yet stay in after TAB.

I remember doing this intentionally but don't remember why, might have been an excuse for avoiding work, will check.

Also, in the directory text button, if there is a partial match and the poll for creating a new directory is cancelled the directory button contains the partial match followed by a /, which is a non-existing directory.

This I should be able to fix.

Lastly one question, what problem in ui_apply_but_func is it that needs needs to be solved.

It runs the callback function immediately instead of after deactivating the button first, which gives problematic recursive calls. But it's a UI code problem so is mine to solve really.

Brecht Van Lommel (brecht) updated this revision to Unknown Object (????).Nov 25 2013, 1:59 AM

Better handling of new directory cancel, and work around UI code limitaiton.

I still couldn't solve the keep focus on the directory field. Reactivating that field selects all text in it which is not great.

There's a few possible solutions I can think of but it requires more refactoring, would like to avoid that and just commit this improvement for now.