This is for T61599.
I also had to make the "New" operator a submenu in the
File Context Menu, so that you can still select the template.
The main issue currently is, that this does not work when
an already existing file is loaded.
The problem is, that we don't really support multi-step UI
interaction in a single operator. For example, we can't show
a confirm dialog first, and then a file browser.
Using the invoke method, only one indirection can be achieved.
This might become even more important, when we want to solve T61553 nicely.
I can think of two ways to solve the two-step-interaction for now:
- Define a wrapper operator for the existing operator, that adds one user interaction step.
- Use some state variable in the operator, so that it can call itself in the "next state".
Which one is better? Or should I use a completely different approach?
In general I'm not sure, how to forward all the parameters to the next
operator call in a nice way. I can just copy them one by one of course.
In any case, this patch already solves a big problem, so I think
it can be merged now. It can easily be replaced later on.