The intent for this change is to allow faster labeling when there
are streaks of the same label occasionally, but not consistently
enough to enable "default label" mode. With this PR the user can
simply click again to confirm the previous selection, without
having to aim for the OK button, or move either hand to the
ENTER button.
The alignment and position change of the buttons is for two reasons:
- it covers less of the drawn shape, easing verification of the
label to be selected
- the alignment wasn't taken into account for offset calculation.
It works if the dialog is shown, but that causes the dialog to
briefly flicker in the old position. Presumably an `adjustSize`
or similar is needed on more widgets, but I was unable to
figure out which.
The previous variant calculates the delta by checking how many
"image pixels" the cursor was moved, and then emit an absolute
scrollbar move based on that. However, when zoomed in a single
image pixel can be multiple scroll bar units.
The effect was that panning a zoomed in image was very slow,
giving a rubber band kind of effect. Wiggling the mouse would emit
more deltas, eventually moving the image below the cursor again.
This PR uses the absolute coordinates instead, which keeps the
image closer to the cursor. There is still a slight rubber band
effect, probably due to slight differences between painter and
scroll bar positions/units.
The result is that panning a zoomed in image feels less sluggish.
This fixes a crash with the following steps to reproduce:
1. highlight a vertex or shape with the cursor
2. swap image using keyboard controls (i.e. press D)
3. left click on image without moving cursor. No shape may be below
cursor.
What happens is that the canvas will emit a selection signal for
the shape from the previous image, which then can't be found anymore
in `shapes_to_items`, causing this error:
```
Traceback (most recent call last):
File "/home/stefan/code/labelImg/./labelImg.py", line 806, in shape_selection_changed
self.shapes_to_items[shape].setSelected(True)
KeyError: <libs.shape.Shape object at 0x7fdb281d06a0>
```
This builds upon the fix from #858, which fixed the issue for
selected shapes, but not highlights.
The use case is adjusting shapes by moving their vertexes, even if
they are adjacent or overlapping another shape. Currently always
the "later drawn" shape wins, making it impossible to adjust an
earlier shape without re-creating it. Adjusting existing shapes is
common for review scenarios.
I have experimented with preferring the highlighted shape, but
I found it finicky and less clear as to how the vertex preference
works. JOSM (and OpenStreetMap editor) also uses the "prefer
selected" approach and it works well there.
For any shape with a dimension smaller than 2*epsilon, there can be
multiple potential points to select from. In practice this resulted
in e.g. the top right corner being highlighted when the cursor was
placed below the bottom right corner.
* Modified the default label text box into a drop down
* Unchecked the box at startup
* Removed commented code
* Removed unnecessary update method for the combobox
* Changed naming style for class
Steps to reproduce this particular issue:
1. draw a box
2. select the box
3. hover over one of the corners as if you want to resize the box (no click needed)
4. press DEL to delete the box
5. left click on the canvas
Note there are two more destructive operations on the canvas' `shape` in
`undo_last_line` and `reset_all_lines`, but former is dead code and latter
I don't know how to trigger. Thus I can't be sure un-highlighting will not
lead to visual glitches.
There are other potential fixes, e.g. checking in `selected_vertex`. I can
rework the patch, but then again, the fix is so straight forward that telling
me is probably more effort than just rewriting it.
See #750
See #605
* Fix incorrect save dir path handling for ML format.
Save dir path was split by incorrect os.dependent separator '/'
which was the cause of labels being saved to parent folder.
* Implement path normalization for command arguments.
Renamed 'predefined_classes_file' parameter to 'class_file'.
* rename local variables in main file
* additional renaming of functions and variables
* Rename main file functions
* Rename functions and variables in canvas.py
* Rename functions and locals for remaining files
* Rename non-Qt derived class' members
* Rename members of Qt-derived classes
* Fix paint label issue
* adds createMl reader & writer class
* adds getFormatMeta function to support more than two save_format
* adds CreateML read & write support
* adds format CreateML icon
* fixes negative height/width
* removes type hints
* fixes coordinate calculation
* adds unit test
* removes typehint