From d965a7cd3c05b4103e7a60468ab19d139d682915 Mon Sep 17 00:00:00 2001 From: StepthenFriedman <143859543+StepthenFriedman@users.noreply.github.com> Date: Wed, 6 Dec 2023 19:25:07 +0800 Subject: [PATCH 1/2] change several implicit conversion into explicit conversion might help prevent crashing --- labelImg.py | 4 ++-- libs/canvas.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/labelImg.py b/labelImg.py index efd8a2976..44af4de39 100755 --- a/labelImg.py +++ b/labelImg.py @@ -210,8 +210,8 @@ def __init__(self, default_filename=None, default_prefdef_class_file=None, defau self.file_dock.setFeatures(QDockWidget.DockWidgetFloatable) self.dock_features = QDockWidget.DockWidgetClosable | QDockWidget.DockWidgetFloatable - self.dock.setFeatures(self.dock.features() ^ self.dock_features) - + self.dock.setFeatures(self.dock.features() ^ int(self.dock_features)) + # Actions action = partial(new_action, self) quit = action(get_str('quit'), self.close, diff --git a/libs/canvas.py b/libs/canvas.py index ca7986ff3..5793219d9 100644 --- a/libs/canvas.py +++ b/libs/canvas.py @@ -165,7 +165,7 @@ def mouseMoveEvent(self, ev): return # Polygon copy moving. - if Qt.RightButton & ev.buttons(): + if bool(Qt.RightButton) & bool(ev.buttons()): if self.selected_shape_copy and self.prev_point: self.override_cursor(CURSOR_MOVE) self.bounded_move_shape(self.selected_shape_copy, pos) @@ -176,7 +176,7 @@ def mouseMoveEvent(self, ev): return # Polygon/Vertex moving. - if Qt.LeftButton & ev.buttons(): + if bool(Qt.LeftButton) & bool(ev.buttons()): if self.selected_vertex(): self.bounded_move_vertex(pos) self.shapeMoved.emit() From 77cfabc8d92b6cbc53b785f96ff250223e70e06e Mon Sep 17 00:00:00 2001 From: StepthenFriedman <143859543+StepthenFriedman@users.noreply.github.com> Date: Thu, 7 Dec 2023 09:59:39 +0800 Subject: [PATCH 2/2] 12/7 --- labelImg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labelImg.py b/labelImg.py index 44af4de39..12ac91845 100755 --- a/labelImg.py +++ b/labelImg.py @@ -211,7 +211,7 @@ def __init__(self, default_filename=None, default_prefdef_class_file=None, defau self.dock_features = QDockWidget.DockWidgetClosable | QDockWidget.DockWidgetFloatable self.dock.setFeatures(self.dock.features() ^ int(self.dock_features)) - + # Actions action = partial(new_action, self) quit = action(get_str('quit'), self.close,