v0.9.19
This commit is contained in:
@@ -19,7 +19,7 @@ class FileSystemWatcher(QObject):
|
||||
file_modified = Signal(str)
|
||||
_file_modified_from_handler = Signal(str) # Internal signal from handler thread
|
||||
file_moved = Signal(str, str)
|
||||
monitoring_status_changed = Signal(bool) # Nuevo: Señal para el estado de monitoreo
|
||||
monitoring_status_changed = Signal(bool) # New: Signal for monitoring status
|
||||
directory_moved = Signal(str, str)
|
||||
directory_modified = Signal(str) # For changes that might not be specific files
|
||||
|
||||
@@ -158,6 +158,7 @@ class FileSystemWatcher(QObject):
|
||||
self.watcher = watcher
|
||||
|
||||
def on_created(self, event):
|
||||
"""Called when a file or directory is created."""
|
||||
if event.is_directory:
|
||||
self.watcher.directory_modified.emit(event.src_path)
|
||||
return
|
||||
@@ -165,6 +166,7 @@ class FileSystemWatcher(QObject):
|
||||
self.watcher.file_created.emit(event.src_path)
|
||||
|
||||
def on_deleted(self, event):
|
||||
"""Called when a file or directory is deleted."""
|
||||
if event.is_directory:
|
||||
self.watcher.directory_modified.emit(event.src_path)
|
||||
return
|
||||
@@ -172,6 +174,7 @@ class FileSystemWatcher(QObject):
|
||||
self.watcher.file_deleted.emit(event.src_path)
|
||||
|
||||
def on_moved(self, event):
|
||||
"""Called when a file or directory is moved or renamed."""
|
||||
if event.is_directory:
|
||||
self.watcher.directory_moved.emit(event.src_path, event.dest_path)
|
||||
self.watcher.directory_modified.emit(event.src_path)
|
||||
@@ -180,6 +183,7 @@ class FileSystemWatcher(QObject):
|
||||
self.watcher.file_moved.emit(event.src_path, event.dest_path)
|
||||
|
||||
def on_closed(self, event):
|
||||
"""Called when a file is closed."""
|
||||
if event.is_directory:
|
||||
self.watcher.directory_modified.emit(event.src_path)
|
||||
return
|
||||
@@ -187,6 +191,7 @@ class FileSystemWatcher(QObject):
|
||||
self.watcher.file_modified.emit(event.src_path)
|
||||
|
||||
def on_modified(self, event):
|
||||
"""Called when a file or directory is modified."""
|
||||
if event.is_directory:
|
||||
self.watcher.directory_modified.emit(event.src_path)
|
||||
return
|
||||
@@ -194,9 +199,11 @@ class FileSystemWatcher(QObject):
|
||||
self.watcher._file_modified_from_handler.emit(event.src_path)
|
||||
|
||||
def _emit_modified(self, path):
|
||||
"""Internal helper to emit the modified signal."""
|
||||
self.watcher.file_modified.emit(path)
|
||||
if path in self.watcher._modified_events_queue:
|
||||
del self.watcher._modified_events_queue[path]
|
||||
|
||||
def _is_image_file(self, path):
|
||||
"""Checks if a given path has a supported image extension."""
|
||||
return os.path.splitext(path)[1].lower() in IMAGE_EXTENSIONS
|
||||
|
||||
Reference in New Issue
Block a user