Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
3cc1b548
Commit
3cc1b548
authored
Feb 20, 2022
by
HinGwenWoong
Browse files
Box color chagne when loaded
parent
e7570d5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
37 deletions
+28
-37
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+28
-37
No files found.
PPOCRLabel/PPOCRLabel.py
View file @
3cc1b548
...
...
@@ -1032,7 +1032,7 @@ class MainWindow(QMainWindow):
def
loadLabels
(
self
,
shapes
):
s
=
[]
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
:
# Ensure the labels are within the bounds of the image. If not, fix them.
...
...
@@ -1046,16 +1046,7 @@ class MainWindow(QMainWindow):
shape
.
close
()
s
.
append
(
shape
)
# if line_color:
# 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
.
_update_shape_color
(
shape
)
self
.
addLabel
(
shape
)
self
.
updateComboBox
()
...
...
@@ -1588,32 +1579,32 @@ class MainWindow(QMainWindow):
if
self
.
Cachelabel
:
self
.
PPlabel
=
dict
(
self
.
Cachelabel
,
**
self
.
PPlabel
)
for
image
,
info
in
self
.
PPlabel
.
items
()
:
for
box
in
info
:
if
"key_cls"
not
in
box
:
continue
self
.
existed_key_cls_set
.
add
(
box
[
"key_cls"
])
if
len
(
self
.
existed_key_cls_set
)
>
0
:
for
key_text
in
self
.
existed_key_cls_set
:
if
not
self
.
keyList
.
findItemsByLabel
(
key_text
)
:
item
=
self
.
keyList
.
createItemFromLabel
(
key_text
)
self
.
keyList
.
ad
dItem
(
item
)
rgb
=
self
.
_get_rgb_by_label
(
key_text
,
self
.
kie_mode
)
self
.
keyList
.
set
Item
Label
(
item
,
key_text
,
rgb
)
#
key
l
ist
dialog
if
self
.
kie_mode
:
self
.
keyDialog
=
KeyD
ialog
(
text
=
self
.
key
_d
ialog
_tip
,
parent
=
self
,
labels
=
self
.
existed_key_cls_set
,
sort_
labels
=
True
,
show_text_fi
el
d
=
True
,
completion
=
"startswith"
,
fit_to_content
=
{
'column'
:
True
,
'row'
:
False
}
,
flags
=
None
)
if
self
.
kie_mode
:
# load key_cls
for
image
,
info
in
self
.
PPlabel
.
items
()
:
for
box
in
info
:
if
"key_cls"
not
in
box
:
continue
self
.
existed_key_cls_set
.
add
(
box
[
"key_cls"
])
if
len
(
self
.
existed_key_cls_set
)
>
0
:
for
key_text
in
self
.
existed_key_cls_set
:
if
not
self
.
keyList
.
fin
dItem
sByLabel
(
key_text
):
item
=
self
.
keyList
.
createItemFromLabel
(
key_text
)
self
.
keyList
.
add
Item
(
item
)
rgb
=
self
.
_get_rgb_by_label
(
key_text
,
self
.
kie_mode
)
self
.
key
L
ist
.
setItemLabel
(
item
,
key_text
,
rgb
)
# key list d
ialog
self
.
key
D
ialog
=
KeyDialog
(
text
=
self
.
key_dialog_tip
,
parent
=
self
,
labels
=
self
.
existed_key_cls_set
,
sort_lab
el
s
=
True
,
show_text_field
=
True
,
completion
=
"startswith"
,
fit_to_content
=
{
'column'
:
True
,
'row'
:
False
},
flags
=
None
)
self
.
lastOpenDir
=
dirpath
self
.
dirname
=
dirpath
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment