Explorar o código

Regex filename search

(cherry picked from commit 0fc75bd1d216fa3ce8a242e4b713f647680c16d6)
Michael Litvin %!s(int64=3) %!d(string=hai) anos
pai
achega
785b2187dd
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      labelme/app.py

+ 5 - 1
labelme/app.py

@@ -2071,7 +2071,11 @@ class MainWindow(QtWidgets.QMainWindow):
         self.fileListWidget.clear()
         for filename in self.scanAllImages(dirpath):
             if pattern and pattern not in filename:
-                continue
+                try:
+                    if not re.search(pattern, filename):
+                        continue
+                except re.error:
+                    pass
             label_file = osp.splitext(filename)[0] + ".json"
             if self.output_dir:
                 label_file_without_path = osp.basename(label_file)