提交 3cc1b548 编写于 作者: HinGwenWoong's avatar HinGwenWoong

Box color chagne when loaded

上级 e7570d5b
...@@ -1032,7 +1032,7 @@ class MainWindow(QMainWindow): ...@@ -1032,7 +1032,7 @@ class MainWindow(QMainWindow):
def loadLabels(self, shapes): def loadLabels(self, shapes):
s = [] s = []
for label, points, line_color, key_cls, difficult in shapes: for label, points, line_color, key_cls, difficult in shapes:
shape = Shape(label=label, line_color=line_color) shape = Shape(label=label, line_color=line_color, key_cls=key_cls)
for x, y in points: for x, y in points:
# Ensure the labels are within the bounds of the image. If not, fix them. # Ensure the labels are within the bounds of the image. If not, fix them.
...@@ -1046,16 +1046,7 @@ class MainWindow(QMainWindow): ...@@ -1046,16 +1046,7 @@ class MainWindow(QMainWindow):
shape.close() shape.close()
s.append(shape) s.append(shape)
# if line_color: self._update_shape_color(shape)
# shape.line_color = QColor(*line_color)
# else:
# shape.line_color = generateColorByText(label)
#
# if fill_color:
# shape.fill_color = QColor(*fill_color)
# else:
# shape.fill_color = generateColorByText(label)
self.addLabel(shape) self.addLabel(shape)
self.updateComboBox() self.updateComboBox()
...@@ -1588,32 +1579,32 @@ class MainWindow(QMainWindow): ...@@ -1588,32 +1579,32 @@ class MainWindow(QMainWindow):
if self.Cachelabel: if self.Cachelabel:
self.PPlabel = dict(self.Cachelabel, **self.PPlabel) self.PPlabel = dict(self.Cachelabel, **self.PPlabel)
for image, info in self.PPlabel.items(): if self.kie_mode:
for box in info: # load key_cls
if "key_cls" not in box: for image, info in self.PPlabel.items():
continue for box in info:
self.existed_key_cls_set.add(box["key_cls"]) if "key_cls" not in box:
if len(self.existed_key_cls_set) > 0: continue
for key_text in self.existed_key_cls_set: self.existed_key_cls_set.add(box["key_cls"])
if not self.keyList.findItemsByLabel(key_text): if len(self.existed_key_cls_set) > 0:
item = self.keyList.createItemFromLabel(key_text) for key_text in self.existed_key_cls_set:
self.keyList.addItem(item) if not self.keyList.findItemsByLabel(key_text):
rgb = self._get_rgb_by_label(key_text, self.kie_mode) item = self.keyList.createItemFromLabel(key_text)
self.keyList.setItemLabel(item, key_text, rgb) self.keyList.addItem(item)
rgb = self._get_rgb_by_label(key_text, self.kie_mode)
# key list dialog self.keyList.setItemLabel(item, key_text, rgb)
if self.kie_mode:
self.keyDialog = KeyDialog( # key list dialog
text=self.key_dialog_tip, self.keyDialog = KeyDialog(
parent=self, text=self.key_dialog_tip,
labels=self.existed_key_cls_set, parent=self,
sort_labels=True, labels=self.existed_key_cls_set,
show_text_field=True, sort_labels=True,
completion="startswith", show_text_field=True,
fit_to_content={'column': True, 'row': False}, completion="startswith",
flags=None fit_to_content={'column': True, 'row': False},
) flags=None
)
self.lastOpenDir = dirpath self.lastOpenDir = dirpath
self.dirname = dirpath self.dirname = dirpath
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册