Move file execute region back to C, fixing bugs

We moved this to Python too quickly, causing the following regressions:
* No auto completion for file names
* Additional handling not applied on changes, like automatic extension
  appending (see file_filename_enter_handle)
* Red highlight missing when the file name already exists

Note that earlier (before the file browser redesign), this didn't use
the panel and layout code at all. So even if it's still not in Python,
at least it's integrated into regular panel management now.
OS-specific ordering of the open and cancel button is kept.

Fixes T69457.
This commit is contained in:
Julian Eisel
2019-09-04 16:21:42 +02:00
parent 640c45dc3a
commit 45d4c92579
4 changed files with 113 additions and 44 deletions

View File

@@ -414,46 +414,6 @@ class FILEBROWSER_PT_directory_path(Panel):
)
class FILEBROWSER_PT_file_operation(Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'EXECUTE'
bl_label = "Execute File Operation"
bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
return context.space_data.active_operator
def draw(self, context):
import sys
layout = self.layout
space = context.space_data
params = space.params
layout.scale_x = 1.3
layout.scale_y = 1.3
row = layout.row()
sub = row.row()
sub.prop(params, "filename", text="")
sub = row.row()
sub.ui_units_x = 5
# subsub = sub.row(align=True)
# subsub.operator("file.filenum", text="", icon='ADD').increment = 1
# subsub.operator("file.filenum", text="", icon='REMOVE').increment = -1
# organize buttons according to the OS standard
if sys.platform[:3] != "win":
sub.operator("FILE_OT_cancel", text="Cancel")
subsub = sub.row()
subsub.active_default = True
subsub.operator("FILE_OT_execute", text=params.title)
if sys.platform[:3] == "win":
sub.operator("FILE_OT_cancel", text="Cancel")
class FILEBROWSER_MT_view(Menu):
bl_label = "View"
@@ -523,7 +483,6 @@ classes = (
FILEBROWSER_PT_bookmarks_recents,
FILEBROWSER_PT_advanced_filter,
FILEBROWSER_PT_directory_path,
FILEBROWSER_PT_file_operation,
FILEBROWSER_PT_options_toggle,
FILEBROWSER_MT_view,
FILEBROWSER_MT_context_menu,