def show_hud(self): """ Creates heads up display button bar on bottom and title string Example: >>> # DISABLE_DOCTEST >>> from ibeis.viz.interact.interact_name import * # NOQA >>> # build test data >>> self = testsdata_match_verification('PZ_MTEST', 30, 32) >>> # execute function >>> result = self.show_hud() >>> # verify results >>> print(result) >>> ut.quit_if_noshow(): >>> self.show_page() >>> pt.show_if_requested() """ # Button positioners hl_slot, hr_slot = pt.make_bbox_positioners(y=.02, w=.15, h=.063, xpad=.02, startx=0, stopx=1) # hack make a second bbox positioner to get different sized buttons on # # the left hl_slot2, hr_slot2 = pt.make_bbox_positioners(y=.02, w=.08, h=.05, xpad=.015, startx=0, stopx=1) def next_rect(accum=[-1]): accum[0] += 1 return hr_slot(accum[0]) def next_rect2(accum=[-1]): accum[0] += 1 return hl_slot2(accum[0]) ibs = self.ibs name1, name2 = self.name1, self.name2 nid1_is_known = not ibs.is_nid_unknown(self.nid1) nid2_is_known = not ibs.is_nid_unknown(self.nid2) all_nid_list = ibs.get_annot_name_rowids(self.all_aid_list) is_unknown = ibs.is_nid_unknown(all_nid_list) is_name1 = [nid == self.nid1 for nid in all_nid_list] is_name2 = [nid == self.nid2 for nid in all_nid_list] # option to remove all names only if at least one name exists if not all(is_unknown): unname_all_text = 'remove all names' self.append_button(unname_all_text, callback=self.unname_all, rect=next_rect()) # option to merge all into a new name if all are unknown if all(is_unknown) and not nid1_is_known and not nid2_is_known: joinnew_text = 'match all (nonjunk)\n to a new name' self.append_button(joinnew_text, callback=self.merge_nonjunk_into_new_name, rect=next_rect()) # option dismiss all and give new names to all nonjunk images if any(is_unknown): self.append_button('mark all unknowns\nas not matching', callback=self.dismiss_all, rect=next_rect()) # merges all into the first name if nid1_is_known and not all(is_name1): join1_text = 'match all to name1:\n{name1}'.format(name1=name1) callback = functools.partial(self.merge_all_into_nid, self.nid1) self.append_button(join1_text, callback=callback, rect=next_rect()) # merges all into the seoncd name if name1 != name2 and nid2_is_known and not all(is_name2): join2_text = 'match all to name2:\n{name2}'.format(name2=name2) callback = functools.partial(self.merge_all_into_nid, self.nid2) self.append_button(join2_text, callback=callback, rect=next_rect()) ### self.append_button('close', callback=self.close_, rect=next_rect2()) if self.qres_callback is not None: self.append_button('review', callback=self.review, rect=next_rect2()) self.append_button('reset', callback=self.reset_all_names, rect=next_rect2()) self.dbname = ibs.get_dbname() self.vsstr = ibsfuncs.vsstr(self.aid1, self.aid2) figtitle_fmt = ''' Match Review Interface - {dbname} {match_text}: {vsstr} ''' figtitle = figtitle_fmt.format(**self.__dict__) # sexy: using obj dict as fmtkw pt.set_figtitle(figtitle)
def get_vsstr(qaid, aid): return ibsfuncs.vsstr(qaid, aid)
def show_hud(self): """ Creates heads up display button bar on bottom and title string Example: >>> # DISABLE_DOCTEST >>> from ibeis.viz.interact.interact_name import * # NOQA >>> # build test data >>> self = testsdata_match_verification('PZ_MTEST', 30, 32) >>> # execute function >>> result = self.show_hud() >>> # verify results >>> print(result) >>> ut.quit_if_noshow(): >>> self.show_page() >>> pt.show_if_requested() """ # Button positioners hl_slot, hr_slot = pt.make_bbox_positioners(y=.02, w=.15, h=.063, xpad=.02, startx=0, stopx=1) # hack make a second bbox positioner to get different sized buttons on # # the left hl_slot2, hr_slot2 = pt.make_bbox_positioners(y=.02, w=.08, h=.05, xpad=.015, startx=0, stopx=1) def next_rect(accum=[-1]): accum[0] += 1 return hr_slot(accum[0]) def next_rect2(accum=[-1]): accum[0] += 1 return hl_slot2(accum[0]) ibs = self.ibs name1, name2 = self.name1, self.name2 nid1_is_known = not ibs.is_nid_unknown(self.nid1) nid2_is_known = not ibs.is_nid_unknown(self.nid2) all_nid_list = ibs.get_annot_name_rowids(self.all_aid_list) is_unknown = ibs.is_nid_unknown(all_nid_list) is_name1 = [nid == self.nid1 for nid in all_nid_list] is_name2 = [nid == self.nid2 for nid in all_nid_list] # option to remove all names only if at least one name exists if not all(is_unknown): unname_all_text = 'remove all names' self.append_button(unname_all_text, callback=self.unname_all, rect=next_rect()) # option to merge all into a new name if all are unknown if all(is_unknown) and not nid1_is_known and not nid2_is_known: joinnew_text = 'match all (nonjunk)\n to a new name' self.append_button(joinnew_text, callback=self.merge_nonjunk_into_new_name, rect=next_rect()) # option dismiss all and give new names to all nonjunk images if any(is_unknown): self.append_button('mark all unknowns\nas not matching', callback=self.dismiss_all, rect=next_rect()) # merges all into the first name if nid1_is_known and not all(is_name1): join1_text = 'match all to name1:\n{name1}'.format(name1=name1) callback = functools.partial(self.merge_all_into_nid, self.nid1) self.append_button(join1_text, callback=callback, rect=next_rect()) # merges all into the seoncd name if name1 != name2 and nid2_is_known and not all(is_name2): join2_text = 'match all to name2:\n{name2}'.format(name2=name2) callback = functools.partial(self.merge_all_into_nid, self.nid2) self.append_button(join2_text, callback=callback, rect=next_rect()) ### self.append_button('close', callback=self.close_, rect=next_rect2()) if self.qres_callback is not None: self.append_button('review', callback=self.review, rect=next_rect2()) self.append_button('reset', callback=self.reset_all_names, rect=next_rect2()) self.dbname = ibs.get_dbname() self.vsstr = ibsfuncs.vsstr(self.aid1, self.aid2) figtitle_fmt = ''' Match Review Interface - {dbname} {match_text}: {vsstr} ''' figtitle = figtitle_fmt.format( **self.__dict__) # sexy: using obj dict as fmtkw pt.set_figtitle(figtitle)