Fix filepath changes in preview mode #862
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are multiple fields that store different parts of the filepath, like
__filename
and__dirname
. With a realMockTag
(like in non-preview mode) these fields are passed to the matching properties of theMockTag
class, which in turn all (sometimes with some indirection) read/write from/to a single attribute named__filepath
, which contains the absolute path of the file. This also means that writing one of the fields will automatically update all the others.The preview doesn't have these properties/attribute, it is just a dict. And it wasn't treating these fields special, and didn't update the related fields. This is the reason why for example the
__filename
field, which is displayed in the table or tag panel, still showed the original value after you used the "tag to filename" function which only set the__path
field. As soon as the preview is written, theMockTag
implementation is used again, and the fields are properly updated again.This implements the automatic update of the filepath fields in the preview, so it will always show what the result will be.
Also add/update some useful tooltips to explain what these ominous buttons in the UI are exactly doing (and how they differ). Thanks to #860 there is no need anymore to (re-)generate
resource.py
.The
remove_from_preview
function was added in 5862184 but never used, so removed the dead code.Fixes #847