(self, e)
| 346 | |
| 347 | # the callback for the drop event |
| 348 | def dropEvent(self, e): |
| 349 | for url in e.mimeData().urls(): |
| 350 | # gets the image from the url |
| 351 | self.setProgress(25, 'getting the image...') |
| 352 | img = self.readImage(str(url.toString())) |
| 353 | if img is None: |
| 354 | self.setProgress(0, 'failed to obtain the image...') |
| 355 | continue |
| 356 | |
| 357 | # detects a face in the image |
| 358 | self.setProgress(50, 'detecting a face...', 2000) |
| 359 | face = self.detectFace(img) |
| 360 | if face is None: |
| 361 | self.setProgress(0, 'failed to detect a face...') |
| 362 | continue |
| 363 | |
| 364 | # shows a dialog to ask his/her name |
| 365 | self.setProgress(75, 'input his/her name') |
| 366 | dialog = AskNameDialog(face) |
| 367 | dialog.show() |
| 368 | if not dialog.exec_(): |
| 369 | self.setProgress(0, 'canceled') |
| 370 | continue |
| 371 | |
| 372 | # adds the face and the name to the widget |
| 373 | self.setProgress(100, 'done') |
| 374 | face_widget = FaceAndNameWidget(face, str(dialog.edit.text())) |
| 375 | self.face_widgets.append(face_widget) |
| 376 | self.faces_layout.addWidget(self.face_widgets[-1]) |
| 377 | |
| 378 | def vector2multiarray(self, vector): |
| 379 | multiarray = Float32MultiArray() |
nothing calls this directly
no test coverage detected