✨ Add new events "FileMoved" and "FolderMoved" (#4405)
* Added FileMove- and FolderMove-Event * fixing the code formatting rules * 📝 Set version number Co-authored-by: Gina Häußge <gina@octoprint.org>
This commit is contained in:
1 parent
5a5460d08a
commit
dcd4f13cec
3 files changed
+62
No files matched your search
@@ -62,8 +62,10 @@ class Events:
|
||||
|
||||
FILE_ADDED = "FileAdded"
|
||||
FILE_REMOVED = "FileRemoved"
|
||||
FILE_MOVED = "FileMoved"
|
||||
FOLDER_ADDED = "FolderAdded"
|
||||
FOLDER_REMOVED = "FolderRemoved"
|
||||
FOLDER_MOVED = "FolderMoved"
|
||||
|
||||
# SD Upload
|
||||
TRANSFER_STARTED = "TransferStarted"
|
||||
|
||||
@@ -823,6 +823,19 @@ class FileManager:
|
||||
"type": get_file_type(dst_name),
|
||||
},
|
||||
)
|
||||
eventManager().fire(
|
||||
Events.FILE_MOVED,
|
||||
{
|
||||
"storage": destination,
|
||||
"source_path": source_path_in_storage,
|
||||
"source_name": source_name,
|
||||
"source_type": get_file_type(source_name),
|
||||
"destination_path": dst_path_in_storage,
|
||||
"destination_name": dst_name,
|
||||
"destination_type": get_file_type(dst_name),
|
||||
},
|
||||
)
|
||||
|
||||
eventManager().fire(Events.UPDATED_FILES, {"type": "printables"})
|
||||
|
||||
def add_folder(self, destination, path, ignore_existing=True, display=None):
|
||||
@@ -884,6 +897,17 @@ class FileManager:
|
||||
Events.FOLDER_ADDED,
|
||||
{"storage": destination, "path": dst_path_in_storage, "name": dst_name},
|
||||
)
|
||||
eventManager().fire(
|
||||
Events.FOLDER_MOVED,
|
||||
{
|
||||
"storage": destination,
|
||||
"source_path": source_path_in_storage,
|
||||
"source_name": source_name,
|
||||
"destination_path": dst_path_in_storage,
|
||||
"destination_name": dst_name,
|
||||
},
|
||||
)
|
||||
|
||||
eventManager().fire(Events.UPDATED_FILES, {"type": "printables"})
|
||||
|
||||
def has_analysis(self, destination, path):
|
||||
|
||||
Reference in new issue
Block a user