MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / dropEvent

Method dropEvent

recognition/scripts/drag_and_drop.py:348–376  ·  view source on GitHub ↗
(self, e)

Source from the content-addressed store, hash-verified

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()

Callers

nothing calls this directly

Calls 6

setProgressMethod · 0.95
readImageMethod · 0.95
detectFaceMethod · 0.95
AskNameDialogClass · 0.85
FaceAndNameWidgetClass · 0.85
showMethod · 0.80

Tested by

no test coverage detected