Skip to content

Commit 9c13e60

Browse files
committed
bug fix
1 parent 7712793 commit 9c13e60

5 files changed

Lines changed: 63 additions & 6 deletions

File tree

image_processing_widget/main_widget.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
from configparser import ConfigParser
44
from pathlib import Path
5+
from time import sleep
56

67
import cv2 as cv
78
from yapsy.PluginManager import PluginManager
@@ -307,8 +308,12 @@ def gui_restore(self, settings):
307308

308309
def closeEvent(self, event):
309310
"""save before closing"""
311+
self.process_worker.stop()
312+
self.process_thread.quit()
310313
settings = QtCore.QSettings(str(self.settings_file), QtCore.QSettings.IniFormat)
311314
self.gui_save(settings)
315+
while self.process_thread.isRunning():
316+
sleep(0.5)
312317
event.accept()
313318

314319
def error_dialog(self, error):

image_processing_widget/splashscreen/splashscreen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ def __init__(self, length=100):
2626
self.frame = QtWidgets.QFrame(self)
2727
self.frame.setObjectName("Frame")
2828
self.frame.setAttribute(QtCore.Qt.WA_StyledBackground)
29-
self.main_layout.addWidget(self.frame)
3029
self.frame_layout = QtWidgets.QVBoxLayout(self.frame)
30+
self.main_layout.addWidget(self.frame)
3131

32-
title_row = QtWidgets.QHBoxLayout(self.frame)
32+
title_row = QtWidgets.QHBoxLayout()
3333
self.frame_layout.addLayout(title_row)
3434

3535
icon_size = 200

image_processing_widget/workers/process_worker.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ def __init__(self, dock, *args, **kwargs):
1313
self.dock = dock
1414
self.queue = Queue()
1515

16+
self._stop_flag = False
17+
1618
def run(self):
17-
while True:
19+
while not self._stop_flag:
1820
img = self.queue.get()
19-
processed_image = self.process_img(img)
20-
self.finished.emit(processed_image)
21+
if img is not None:
22+
processed_image = self.process_img(img)
23+
self.finished.emit(processed_image)
2124

2225
def process_img(self, img):
2326
try:
@@ -27,3 +30,7 @@ def process_img(self, img):
2730
except Exception as e:
2831
self.process_failed.emit(str(e))
2932
return
33+
34+
def stop(self):
35+
self._stop_flag = True
36+
self.queue.put(None)

pyproject.toml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
[tool.poetry]
22
name = "image-processing-widget"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "GUI to explore OpenCV image processing functions"
55
authors = ["wenliangyeoh <wlyeoh@cc.saga-u.ac.jp>"]
6+
readme = "README.md"
7+
repository = "https://github.com/fukuda-lab-saga/image-processing-widget"
8+
keywords = ["opencv", "gui", "pyside6"]
9+
classifiers = [
10+
"License :: OSI Approved :: MIT License",
11+
"Operating System :: OS Independent",
12+
"Intended Audience :: Education",
13+
]
14+
include = [
15+
"image_processing_config.ini",
16+
"image_processing_widget/resource/*",
17+
"plugins/*",
18+
"plugins/**/*",
19+
]
20+
621

722
[tool.poetry.dependencies]
823
python = ">3.10, <3.11"

requirements.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
numpy==1.23.2; python_version >= "3.8"
2+
opencv-python==4.5.5.64; python_version >= "3.6"
3+
packaging==21.3; python_version >= "3.7" \
4+
--hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 \
5+
--hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb
6+
pyparsing==3.0.9; python_full_version >= "3.6.8" and python_version >= "3.7" \
7+
--hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc \
8+
--hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb
9+
pyqtgraph==0.12.4; python_version >= "3.7" \
10+
--hash=sha256:d98c6e26e9eda6d1d1bba92d6df381ef77fca18b701f9e136759ce31a17c6217 \
11+
--hash=sha256:c2c8f2b7e1d7f97a710f370acff6368d686c9d6cdc560f2d83dcf59185dfa19d
12+
pyside6-addons==6.3.1; python_version >= "3.6" and python_version < "3.11" \
13+
--hash=sha256:7a6bb180e41a4c599aa0e93d11e60570d0ebc79c197afccd9c227566dad5d5ef \
14+
--hash=sha256:14f4171b15dbdd7d120dc125c84f2eca53bc197182295bfdfdb3bb95b58a46c7 \
15+
--hash=sha256:9a933fac75c85bea3a9e31b24926e06b1afebae23cd164f10f2001999ea2692c
16+
pyside6-essentials==6.3.1; python_version >= "3.6" and python_version < "3.11" \
17+
--hash=sha256:55696693325a2de7bf5b56274b534f191032d218d61a948baa95933f6e642e59 \
18+
--hash=sha256:e27962beb2cc45fe13a1a1c24a454c3c3c3c3082c4a84bc5dcf6b306979ba013 \
19+
--hash=sha256:fa825c5396a5dfedf59635e904239187e2f2225c7f65917d4e973062c9a6b916
20+
pyside6==6.3.1; python_version >= "3.6" and python_version < "3.11" \
21+
--hash=sha256:58b824cb41d549a149a17786326f79a2fa46a1ce94e06397e78ea5707757b052 \
22+
--hash=sha256:bc749968d641af1c516b6b0e00264bffea9cfc2d56dc04766f36e1a313e93a3a \
23+
--hash=sha256:947185379c181d5e51b7b6bf2df8d8127c675ea57604d41265c67444d226db26
24+
qtawesome==1.1.1; python_version >= "3.6"
25+
qtpy==2.2.0; python_version >= "3.7"
26+
shiboken6==6.3.1; python_version >= "3.6" and python_version < "3.11" \
27+
--hash=sha256:6393aa330101b098631a88dfb99b6b46794046c7f63b5c1ac93ae2fcef4773ff \
28+
--hash=sha256:aad9aa8e7ecd3c889cc789e41abf3990101126b5b02edfcf87f1ef331c9dc45a \
29+
--hash=sha256:cb9cf4ad858e59237642bf6b8be1fe6f19cb090799ff00e4c2643768d73e8ebe
30+
yapsy==1.12.2

0 commit comments

Comments
 (0)