提交 814e8a87 编写于 作者: HinGwenWoong's avatar HinGwenWoong

Delete useless part in key dialog, translate tip

上级 77d83a60
......@@ -80,6 +80,7 @@ class MainWindow(QMainWindow):
settings = self.settings
self.lang = lang
self.kie_mode = kie_mode
self.key_previous_text = ""
# Load string bundle for i18n
if lang not in ['ch', 'en']:
lang = 'en'
......@@ -428,6 +429,7 @@ class MainWindow(QMainWindow):
# key list dialog
if kie_mode:
self.keyDialog = KeyDialog(
text=getStr('keyDialogTip'),
parent=self,
labels=None,
sort_labels=True,
......@@ -1219,10 +1221,9 @@ class MainWindow(QMainWindow):
self.canvas.resetAllLines()
if self.kie_mode:
previous_text = self.keyDialog.edit.text()
text, flags, group_id = self.keyDialog.popUp(text)
if not text:
self.keyDialog.edit.setText(previous_text)
self.key_previous_text, flags = self.keyDialog.popUp(self.key_previous_text)
if not self.key_previous_text:
self.keyDialog.edit.setText(self.key_previous_text)
def scrollRequest(self, delta, orientation):
units = - delta / (8 * 15)
......
import re
import sys
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtWidgets
from libs.utils import newIcon, labelValidator
QT5 = True
......@@ -49,16 +46,11 @@ class KeyDialog(QtWidgets.QDialog):
self.edit.editingFinished.connect(self.postProcess)
if flags:
self.edit.textChanged.connect(self.updateFlags)
self.edit_group_id = QtWidgets.QLineEdit()
self.edit_group_id.setPlaceholderText("Group ID")
self.edit_group_id.setValidator(
QtGui.QRegExpValidator(QtCore.QRegExp(r"\d*"), None)
)
layout = QtWidgets.QVBoxLayout()
if show_text_field:
layout_edit = QtWidgets.QHBoxLayout()
layout_edit.addWidget(self.edit, 6)
layout_edit.addWidget(self.edit_group_id, 2)
layout.addLayout(layout_edit)
# buttons
self.buttonBox = bb = QtWidgets.QDialogButtonBox(
......@@ -189,13 +181,7 @@ class KeyDialog(QtWidgets.QDialog):
flags[item.text()] = item.isChecked()
return flags
def getGroupId(self):
group_id = self.edit_group_id.text()
if group_id:
return int(group_id)
return None
def popUp(self, text=None, move=True, flags=None, group_id=None):
def popUp(self, text=None, move=True, flags=None):
if self._fit_to_content["row"]:
self.labelList.setMinimumHeight(
self.labelList.sizeHintForRow(0) * self.labelList.count() + 2
......@@ -213,10 +199,7 @@ class KeyDialog(QtWidgets.QDialog):
self.resetFlags(text)
self.edit.setText(text)
self.edit.setSelection(0, len(text))
if group_id is None:
self.edit_group_id.clear()
else:
self.edit_group_id.setText(str(group_id))
items = self.labelList.findItems(text, QtCore.Qt.MatchFixedString)
if items:
if len(items) != 1:
......@@ -227,6 +210,6 @@ class KeyDialog(QtWidgets.QDialog):
if move:
self.move(QtGui.QCursor.pos())
if self.exec_():
return self.edit.text(), self.getFlags(), self.getGroupId()
return self.edit.text(), self.getFlags()
else:
return None, None, None
......@@ -108,3 +108,4 @@ autoSaveMode=Auto Export Label Mode
lockBox=Lock selected box/Unlock all box
lockBoxDetail=Lock selected box/Unlock all box
keyListTitle=Key List
keyDialogTip=Enter object label
\ No newline at end of file
......@@ -108,3 +108,4 @@ autoSaveMode=自动导出标记结果
lockBox=锁定框/解除锁定框
lockBoxDetail=若当前没有框处于锁定状态则锁定选中的框,若存在锁定框则解除所有锁定框的锁定状态
keyListTitle=关键词列表
keyDialogTip=请输入类型名称
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册