From 60ae6067ea1c4b7d2c9184d398dbb85d65a5cd46 Mon Sep 17 00:00:00 2001 From: tzutalin Date: Wed, 1 Jul 2020 18:18:19 -0700 Subject: [PATCH] Update zh translation and format code a little bit --- labelImg.py | 14 ++++++-------- resources/strings/strings-zh-CN.properties | 2 ++ resources/strings/strings-zh-TW.properties | 4 +++- resources/strings/strings.properties | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/labelImg.py b/labelImg.py index f1281e4e..d9474586 100755 --- a/labelImg.py +++ b/labelImg.py @@ -51,11 +51,8 @@ __appname__ = 'labelImg' class WindowMixin(object): def menu(self, title, actions=None): - menu = self.menuBar().addMenu(title) - if actions: - addActions(menu, actions) return menu @@ -155,7 +152,7 @@ class MainWindow(QMainWindow, WindowMixin): self.labelList.itemChanged.connect(self.labelItemChanged) listLayout.addWidget(self.labelList) - + self.dock = QDockWidget(getStr('boxLabelText'), self) self.dock.setObjectName(getStr('labels')) @@ -622,6 +619,7 @@ class MainWindow(QMainWindow, WindowMixin): subprocess.Popen(self.screencastViewer + [self.screencast]) def showInfoDialog(self): + from libs.__init__ import __version__ msg = u'Name:{0} \nApp Version:{1} \n{2} '.format(__appname__, __version__, sys.version_info) QMessageBox.information(self, u'Information', msg) @@ -793,7 +791,7 @@ class MainWindow(QMainWindow, WindowMixin): def updateComboBox(self): # Get the unique labels and add them to the Combobox. itemsTextList = [str(self.labelList.item(i).text()) for i in range(self.labelList.count())] - + uniqueTextList = list(set(itemsTextList)) # Add a null row for showing all the labels uniqueTextList.append("") @@ -841,7 +839,7 @@ class MainWindow(QMainWindow, WindowMixin): self.addLabel(self.canvas.copySelectedShape()) # fix copy and delete self.shapeSelectionChanged(True) - + def comboSelectionChanged(self, index): text = self.comboBox.cb.itemText(index) for i in range(self.labelList.count()): @@ -1373,13 +1371,13 @@ class MainWindow(QMainWindow, WindowMixin): self.toggleActions(False) self.canvas.setEnabled(False) self.actions.saveAs.setEnabled(False) + def deleteImg(self): deletePath = self.filePath - if self.filePath is not None: + if deletePath is not None: self.openNextImg() os.remove(deletePath) self.importDirImages(self.lastOpenDir) - def resetAll(self): self.settings.reset() diff --git a/resources/strings/strings-zh-CN.properties b/resources/strings/strings-zh-CN.properties index 5459a0ee..2bffc682 100644 --- a/resources/strings/strings-zh-CN.properties +++ b/resources/strings/strings-zh-CN.properties @@ -19,6 +19,8 @@ quit=退出 shapeFillColorDetail=更改填充颜色 closeCurDetail=关闭当前文件 closeCur=关闭文件 +deleteImg=删除图像 +deleteImgDetail=删除当前图像 fitWin=调整到窗口大小 delBox=删除选择的区块 boxLineColorDetail=选择线框颜色 diff --git a/resources/strings/strings-zh-TW.properties b/resources/strings/strings-zh-TW.properties index c09f3691..b99aa209 100644 --- a/resources/strings/strings-zh-TW.properties +++ b/resources/strings/strings-zh-TW.properties @@ -19,6 +19,8 @@ quit=結束 shapeFillColorDetail=更改填充顏色 closeCurDetail=關閉目前檔案 closeCur=關閉 +deleteImg=刪除圖像 +deleteImgDetail=刪除目前圖像 fitWin=調整到跟窗口一樣大小 delBox=刪除選取區塊 boxLineColorDetail=選擇框線顏色 @@ -62,4 +64,4 @@ files=檔案 advancedMode=進階模式 advancedModeDetail=切到進階模式 showAllBoxDetail=顯示所有區塊 -hideAllBoxDetail=隱藏所有區塊 \ No newline at end of file +hideAllBoxDetail=隱藏所有區塊 diff --git a/resources/strings/strings.properties b/resources/strings/strings.properties index a40350cd..f48a5fd3 100644 --- a/resources/strings/strings.properties +++ b/resources/strings/strings.properties @@ -20,8 +20,8 @@ saveAs=Save As saveAsDetail=Save the labels to a different file closeCur=Close closeCurDetail=Close the current file -deleteImg = Delete Current Image -deleteImgDetail = Delete current image +deleteImg=Delete current image +deleteImgDetail=Delete the current image resetAll=Reset All resetAllDetail=Reset All boxLineColor=Box Line Color