개정판 1b86c1f7
issue #631: 다국어 이름 파일 지원
Change-Id: I87730bd85f4332789f7304d007fa8a15b9d1ae52
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
184 | 184 |
except Exception as ex: |
185 | 185 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
186 | 186 |
|
187 |
def my_imread(self, filePath): |
|
188 |
""" read a file which's name contains unicode string : ref http://devdoftech.co.kr:82/redmine/issues/631 """ |
|
189 |
import numpy as np |
|
190 |
import cv2 |
|
191 |
|
|
192 |
stream = open(filePath.encode('utf-8') , 'rb') |
|
193 |
_bytes = bytearray(stream.read()) |
|
194 |
numpyArray = np.asarray(_bytes, dtype=np.uint8) |
|
195 |
return cv2.imdecode(numpyArray, cv2.IMREAD_UNCHANGED) |
|
196 |
|
|
187 | 197 |
''' |
188 | 198 |
@brief open a image file selected by user |
189 | 199 |
@author |
... | ... | |
206 | 216 |
elif QT_VERSION_STR[0] == '5': |
207 | 217 |
fileName, dummy = QFileDialog.getOpenFileName(self, "Open image file", os.getcwd() if folder == '' else folder, "Image files(*.png *.jpg)", options=options) |
208 | 218 |
if len(fileName) and os.path.isfile(fileName): |
209 |
cvImg = cv2.cvtColor(cv2.imread(fileName), cv2.COLOR_BGR2GRAY)
|
|
219 |
cvImg = cv2.cvtColor(self.my_imread(fileName), cv2.COLOR_BGR2GRAY)
|
|
210 | 220 |
#blur = cv2.GaussianBlur(cvImg, (5,5),0) |
211 | 221 |
cvImg = cv2.threshold(cvImg, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)[1] |
212 | 222 |
|
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
72 | 72 |
""" getter of connectedItem """ |
73 | 73 |
import uuid |
74 | 74 |
|
75 |
if type(self._connectedItem) is uuid.UUID: |
|
75 |
if type(self._connectedItem) is uuid.UUID and self.scene():
|
|
76 | 76 |
matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(self._connectedItem)] |
77 | 77 |
if matches: |
78 | 78 |
self._connectedItem = matches[0] |
내보내기 Unified diff