提交 6c455245 编写于 作者: 锦鲤AI幸运's avatar 锦鲤AI幸运 🎯

增加打开的数据集文件夹的功能

上级 66a76f68
...@@ -360,6 +360,9 @@ class MainWindow(QMainWindow, WindowMixin): ...@@ -360,6 +360,9 @@ class MainWindow(QMainWindow, WindowMixin):
opendir = action(getStr('openDir'), self.openDirDialog, opendir = action(getStr('openDir'), self.openDirDialog,
'Ctrl+u', 'open', getStr('openDir')) 'Ctrl+u', 'open', getStr('openDir'))
open_dataset_dir = action(getStr('openDatasetDir'), self.openDatasetDirDialog,
'Ctrl+p', 'open', getStr('openDatasetDir'), enabled=False)
save = action(getStr('save'), self.saveFile, save = action(getStr('save'), self.saveFile,
'Ctrl+V', 'verify', getStr('saveDetail'), enabled=False) 'Ctrl+V', 'verify', getStr('saveDetail'), enabled=False)
...@@ -519,9 +522,9 @@ class MainWindow(QMainWindow, WindowMixin): ...@@ -519,9 +522,9 @@ class MainWindow(QMainWindow, WindowMixin):
zoom=zoom, zoomIn=zoomIn, zoomOut=zoomOut, zoomOrg=zoomOrg, zoom=zoom, zoomIn=zoomIn, zoomOut=zoomOut, zoomOrg=zoomOrg,
fitWindow=fitWindow, fitWidth=fitWidth, fitWindow=fitWindow, fitWidth=fitWidth,
zoomActions=zoomActions, saveLabel=saveLabel, zoomActions=zoomActions, saveLabel=saveLabel,
undo=undo, undoLastPoint=undoLastPoint, undo=undo, undoLastPoint=undoLastPoint,open_dataset_dir=open_dataset_dir,
fileMenuActions=( fileMenuActions=(
opendir, saveLabel, resetAll, quit), opendir, open_dataset_dir, saveLabel, resetAll, quit),
beginner=(), advanced=(), beginner=(), advanced=(),
editMenu=(createpoly, edit, copy, delete,singleRere,None, undo, undoLastPoint, editMenu=(createpoly, edit, copy, delete,singleRere,None, undo, undoLastPoint,
None, color1, self.drawSquaresOption), None, color1, self.drawSquaresOption),
...@@ -563,7 +566,7 @@ class MainWindow(QMainWindow, WindowMixin): ...@@ -563,7 +566,7 @@ class MainWindow(QMainWindow, WindowMixin):
self.autoSaveOption.triggered.connect(self.autoSaveFunc) self.autoSaveOption.triggered.connect(self.autoSaveFunc)
addActions(self.menus.file, addActions(self.menus.file,
(opendir, None, saveLabel, saveRec, self.autoSaveOption, None, resetAll, deleteImg, quit)) (opendir, open_dataset_dir, None, saveLabel, saveRec, self.autoSaveOption, None, resetAll, deleteImg, quit))
addActions(self.menus.help, (showSteps, showInfo)) addActions(self.menus.help, (showSteps, showInfo))
addActions(self.menus.view, ( addActions(self.menus.view, (
...@@ -1448,6 +1451,23 @@ class MainWindow(QMainWindow, WindowMixin): ...@@ -1448,6 +1451,23 @@ class MainWindow(QMainWindow, WindowMixin):
self.lastOpenDir = targetDirPath self.lastOpenDir = targetDirPath
self.importDirImages(targetDirPath) self.importDirImages(targetDirPath)
def openDatasetDirDialog(self, _value=False): #1458
if not self.mayContinue():
return
if self.lastOpenDir and os.path.exists(self.lastOpenDir):
os.startfile(self.lastOpenDir)
defaultOpenDirPath = self.lastOpenDir
else:
if self.lang == 'ch':
self.actions.open_dataset_dir.setEnabled(False)
self.msgBox.warning(self, "提示", "\n 原文件夹已不存在,请从新选择数据集路径!")
defaultOpenDirPath = os.path.dirname(self.filePath) if self.filePath else '.'
else:
self.actions.open_dataset_dir.setEnabled (False)
self.msgBox.warning (self, "Warn", "\n The original folder no longer exists, please choose the data set path again!")
defaultOpenDirPath = os.path.dirname (self.filePath) if self.filePath else '.'
def importDirImages(self, dirpath, isDelete = False): def importDirImages(self, dirpath, isDelete = False):
if not self.mayContinue() or not dirpath: if not self.mayContinue() or not dirpath:
return return
...@@ -1495,6 +1515,7 @@ class MainWindow(QMainWindow, WindowMixin): ...@@ -1495,6 +1515,7 @@ class MainWindow(QMainWindow, WindowMixin):
self.reRecogButton.setEnabled(True) self.reRecogButton.setEnabled(True)
self.actions.AutoRec.setEnabled(True) self.actions.AutoRec.setEnabled(True)
self.actions.reRec.setEnabled(True) self.actions.reRec.setEnabled(True)
self.actions.open_dataset_dir.setEnabled(True)
def openPrevImg(self, _value=False): def openPrevImg(self, _value=False):
......
...@@ -31,6 +31,7 @@ save=确认 ...@@ -31,6 +31,7 @@ save=确认
saveAs=另存为 saveAs=另存为
fitWinDetail=缩放到当前窗口大小 fitWinDetail=缩放到当前窗口大小
openDir=打开目录 openDir=打开目录
openDatasetDir=打开数据集路径
copyPrevBounding=复制当前图像中的上一个边界框 copyPrevBounding=复制当前图像中的上一个边界框
showHide=显示/隐藏标签 showHide=显示/隐藏标签
changeSaveFormat=更改存储格式 changeSaveFormat=更改存储格式
......
...@@ -3,6 +3,7 @@ openFileDetail=Open image or label file ...@@ -3,6 +3,7 @@ openFileDetail=Open image or label file
quit=Quit quit=Quit
quitApp=Quit application quitApp=Quit application
openDir=Open Dir openDir=Open Dir
openDatasetDir=open DatasetDir
copyPrevBounding=Copy previous Bounding Boxes in the current image copyPrevBounding=Copy previous Bounding Boxes in the current image
changeSavedAnnotationDir=Change default saved Annotation dir changeSavedAnnotationDir=Change default saved Annotation dir
openAnnotation=Open Annotation openAnnotation=Open Annotation
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册