Skip to content

Commit

Permalink
Show label count in the dock title
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterH0323 committed Jan 22, 2022
1 parent 8091e34 commit 5d79a46
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions PPOCRLabel/PPOCRLabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def __init__(self,

# Connect to itemChanged to detect checkbox changes.
self.labelList.itemChanged.connect(self.labelItemChanged)
self.labelListDock = QDockWidget(getStr('recognitionResult'), self)
self.labelListDockName = getStr('recognitionResult')
self.labelListDock = QDockWidget(self.labelListDockName, self)
self.labelListDock.setWidget(self.labelList)
self.labelListDock.setFeatures(QDockWidget.NoDockWidgetFeatures)
listLayout.addWidget(self.labelListDock)
Expand All @@ -204,7 +205,8 @@ def __init__(self,
self.BoxList.itemDoubleClicked.connect(self.editBox)
# Connect to itemChanged to detect checkbox changes.
self.BoxList.itemChanged.connect(self.boxItemChanged)
self.BoxListDock = QDockWidget(getStr('detectionBoxposition'), self)
self.BoxListDockName = getStr('detectionBoxposition')
self.BoxListDock = QDockWidget(self.BoxListDockName, self)
self.BoxListDock.setWidget(self.BoxList)
self.BoxListDock.setFeatures(QDockWidget.NoDockWidgetFeatures)
listLayout.addWidget(self.BoxListDock)
Expand Down Expand Up @@ -976,6 +978,10 @@ def addLabel(self, shape):
action.setEnabled(True)
self.updateComboBox()

# update show counting
self.BoxListDock.setWindowTitle(self.BoxListDockName + f" ({self.BoxList.count()})")
self.labelListDock.setWindowTitle(self.labelListDockName + f" ({self.labelList.count()})")

def remLabels(self, shapes):
if shapes is None:
# print('rm empty label')
Expand Down Expand Up @@ -1339,6 +1345,9 @@ def loadFile(self, filePath=None):
if len(select_indexes) > 0:
self.file_dock.setWindowTitle(self.fileListName + f" ({select_indexes[0].row() + 1}"
f"/{self.fileListWidget.count()})")
# update show counting
self.BoxListDock.setWindowTitle(self.BoxListDockName + f" ({self.BoxList.count()})")
self.labelListDock.setWindowTitle(self.labelListDockName + f" ({self.labelList.count()})")

self.canvas.setFocus(True)
return True
Expand Down Expand Up @@ -1745,6 +1754,8 @@ def deleteSelectedShape(self):
if self.noShapes():
for action in self.actions.onShapesPresent:
action.setEnabled(False)
self.BoxListDock.setWindowTitle(self.BoxListDockName + f" ({self.BoxList.count()})")
self.labelListDock.setWindowTitle(self.labelListDockName + f" ({self.labelList.count()})")

def chshapeLineColor(self):
color = self.colorDialog.getColor(self.lineColor, u'Choose line color',
Expand Down

0 comments on commit 5d79a46

Please sign in to comment.