33 self.
_fs_watcher_fs_watcher = wx.FileSystemWatcher()
39 if os.path.isdir(path):
42 path = os.path.join(path,
'')
46 from wx
import FileSystem
48 fs.ChangePathTo(path,
True)
54 file_search = fs.FindFirst(
"*")
55 except AssertionError:
60 self.
_watched_path_watched_path.add(fs.URLToFileName(file_search))
62 file_search = fs.FindNext()
63 except AssertionError:
68 path = os.path.join(os.path.dirname(path),
'')
97 new_path = event.GetNewPath()
98 previous_path = event.GetPath()
99 change_type = event.GetChangeType()
101 if change_type == wx.FSW_EVENT_MODIFY:
104 count = self._fs_watcher.GetWatchedPaths(paths) # DEBUG This is always empty
105 print(f"DEBUG: FSW_EVENT_MODIFY count={count} paths={paths}")
107 # print(f"DEBUG: FileSystemWatcher count files {count} event wx.FSW_EVENT_MODIFY file = {file}")
108 if file == previous_path:
115 if change_type == wx.FSW_EVENT_CREATE:
116 if os.path.isdir(previous_path):
118 elif os.path.isfile(previous_path):
120 elif change_type == wx.FSW_EVENT_DELETE:
125 if previous_path.endswith(os.sep):
129 elif change_type == wx.FSW_EVENT_RENAME:
135 if os.path.isdir(new_path):
137 elif os.path.isfile(new_path):
145 suffixes = (
'.robot',
'.txt',
'.resource',
'.tsv')
146 return os.path.splitext(file_path)[-1].
lower()
in suffixes
def _is_mark_dirty_needed(self, event)
def _is_valid_file_format(file_path)
def create_fs_watcher(self, path)
def is_watcher_created(self)
def is_workspace_dirty(self)
def _on_fs_event(self, event)
def get_workspace_new_path(self)
def start_listening(self, path)