Example #1
0
 def figure_clicked(self, event=None):
     from ibeis.viz import viz_helpers as vh
     ax = event.inaxes
     if ih.clicked_inside_axis(event):
         viztype = vh.get_ibsdat(ax, 'viztype')
         if viztype == 'chip':
             aid = vh.get_ibsdat(ax, 'aid')
             print('... aid=%r' % aid)
             if event.button == 3:  # right-click
                 from ibeis.viz.interact import interact_chip
                 import guitool
                 height = self.fig.canvas.geometry().height()
                 qpoint = guitool.newQPoint(event.x, height - event.y)
                 if self.qreq_ is None:
                     config2_ = None
                 else:
                     if aid in self.qreq_.qaids:
                         config2_ = self.qreq_.query_config2_
                     else:
                         config2_ = self.qreq_.data_config2_
                 callback_list = interact_chip.build_annot_context_options(
                     self.ibs,
                     aid,
                     refresh_func=self.show_page,
                     config2_=config2_)
                 guitool.popup_menu(self.fig.canvas, qpoint, callback_list)
                 #interact_chip.show_annot_context_menu(
                 #    self.ibs, aid, self.fig.canvas, qpoint, refresh_func=self.show_page)
                 #self.show_page()
                 #ibs.print_annotation_table()
             print(ut.dict_str(event.__dict__))
 def figure_clicked(self, event=None):
     from ibeis.viz import viz_helpers as vh
     ax = event.inaxes
     if ih.clicked_inside_axis(event):
         viztype = vh.get_ibsdat(ax, 'viztype')
         if viztype == 'chip':
             aid = vh.get_ibsdat(ax, 'aid')
             print('... aid=%r' % aid)
             if event.button == 3:   # right-click
                 from ibeis.viz.interact import interact_chip
                 import guitool
                 height = self.fig.canvas.geometry().height()
                 qpoint = guitool.newQPoint(event.x, height - event.y)
                 if self.qreq_ is None:
                     config2_ = None
                 else:
                     if aid in self.qreq_.qaids:
                         config2_ = self.qreq_.query_config2_
                     else:
                         config2_ = self.qreq_.data_config2_
                 callback_list = interact_chip.build_annot_context_options(
                     self.ibs, aid, refresh_func=self.show_page, config2_=config2_)
                 guitool.popup_menu(self.fig.canvas, qpoint, callback_list)
                 #interact_chip.show_annot_context_menu(
                 #    self.ibs, aid, self.fig.canvas, qpoint, refresh_func=self.show_page)
                 #self.show_page()
                 #ibs.print_annotation_table()
             print(ut.dict_str(event.__dict__))
 def show_popup_menu(self, options, event):
     """
     context menu
     """
     import guitool
     height = self.fig.canvas.geometry().height()
     qpoint = guitool.newQPoint(event.x, height - event.y)
     qwin = self.fig.canvas
     guitool.popup_menu(qwin, qpoint, options)
Example #4
0
 def show_popup_menu(self, options, event):
     """
     context menu
     """
     import guitool
     height = self.fig.canvas.geometry().height()
     qpoint = guitool.newQPoint(event.x, height - event.y)
     qwin = self.fig.canvas
     guitool.popup_menu(qwin, qpoint, options)
Example #5
0
 def on_contextMenuClicked(ibswgt, qtindex, pos):
     printDBG('[newgui] contextmenu')
     model = qtindex.model()
     # id_ = model._get_row_id(qtindex.row())
     if model.name == NAMES_TREE:
         tblview = ibswgt.view
         # eid = model.eid
         # gid = id_
         guitool.popup_menu(tblview, pos, [
             ('right click action', lambda: None),
         ])
Example #6
0
 def on_contextMenuClicked(ibswgt, qtindex, pos):
     printDBG('[newgui] contextmenu')
     model = qtindex.model()
     #id_ = model._get_row_id(qtindex)
     if model.name == THUMB_TABLE:
         tblview = ibswgt.view
         # imgsetid = model.imgsetid
         # gid = id_
         guitool.popup_menu(tblview, pos, [
             ('right click action', lambda: None),
         ])
Example #7
0
    def _on_chip_click(event):
        print('[inter] clicked chip')
        ax, x, y = event.inaxes, event.xdata, event.ydata
        if ih.clicked_outside_axis(event):
            if not ischild:
                print('... out of axis')
                mode_ptr[0] = (mode_ptr[0] + 1) % 3
                _chip_view(**kwargs)
        else:
            if event.button == 3:   # right-click
                import guitool
                #from ibeis.viz.interact import interact_chip
                height = fig.canvas.geometry().height()
                qpoint = guitool.newQPoint(event.x, height - event.y)
                refresh_func = partial(_chip_view, **kwargs)

                callback_list = build_annot_context_options(
                    ibs, aid, refresh_func=refresh_func,
                    with_interact_chip=False,
                    config2_=config2_)
                qwin = fig.canvas
                guitool.popup_menu(qwin, qpoint, callback_list)
                #interact_chip.show_annot_context_menu(
                #    ibs, aid, fig.canvas, qpoint, refresh_func=refresh_func,
                #    with_interact_chip=False, config2_=config2_)
            else:
                viztype = vh.get_ibsdat(ax, 'viztype')
                print('[ic] viztype=%r' % viztype)
                if viztype == 'chip' and event.key == 'shift':
                    _chip_view(**kwargs)
                    ih.disconnect_callback(fig, 'button_press_event')
                elif viztype == 'chip':
                    kpts = ibs.get_annot_kpts(aid, config2_=config2_)
                    if len(kpts) > 0:
                        fx = vt.nearest_point(
                            x, y, kpts, conflict_mode='next')[0]
                        print('... clicked fx=%r' % fx)
                        _select_fxth_kpt(fx)
                    else:
                        print('... len(kpts) == 0')
                elif viztype in ['warped', 'unwarped']:
                    fx = vh.get_ibsdat(ax, 'fx')
                    if fx is not None and viztype == 'warped':
                        viz.show_keypoint_gradient_orientations(
                            ibs, aid, fx, fnum=df2.next_fnum())
                else:
                    print('...Unknown viztype: %r' % viztype)

        viz.draw()
Example #8
0
    def _on_chip_click(event):
        print('[inter] clicked chip')
        ax, x, y = event.inaxes, event.xdata, event.ydata
        if ih.clicked_outside_axis(event):
            if not ischild:
                print('... out of axis')
                mode_ptr[0] = (mode_ptr[0] + 1) % 3
                _chip_view(**kwargs)
        else:
            if event.button == 3:   # right-click
                import guitool
                #from ibeis.viz.interact import interact_chip
                height = fig.canvas.geometry().height()
                qpoint = guitool.newQPoint(event.x, height - event.y)
                refresh_func = partial(_chip_view, **kwargs)

                callback_list = build_annot_context_options(
                    ibs, aid, refresh_func=refresh_func,
                    with_interact_chip=False,
                    config2_=config2_)
                qwin = fig.canvas
                guitool.popup_menu(qwin, qpoint, callback_list)
                #interact_chip.show_annot_context_menu(
                #    ibs, aid, fig.canvas, qpoint, refresh_func=refresh_func,
                #    with_interact_chip=False, config2_=config2_)
            else:
                viztype = vh.get_ibsdat(ax, 'viztype')
                print('[ic] viztype=%r' % viztype)
                if viztype == 'chip' and event.key == 'shift':
                    _chip_view(**kwargs)
                    ih.disconnect_callback(fig, 'button_press_event')
                elif viztype == 'chip':
                    kpts = ibs.get_annot_kpts(aid, config2_=config2_)
                    if len(kpts) > 0:
                        fx = vt.nearest_point(
                            x, y, kpts, conflict_mode='next')[0]
                        print('... clicked fx=%r' % fx)
                        _select_fxth_kpt(fx)
                    else:
                        print('... len(kpts) == 0')
                elif viztype in ['warped', 'unwarped']:
                    fx = vh.get_ibsdat(ax, 'fx')
                    if fx is not None and viztype == 'warped':
                        viz.show_keypoint_gradient_orientations(
                            ibs, aid, fx, fnum=df2.next_fnum())
                else:
                    print('...Unknown viztype: %r' % viztype)

        viz.draw()
Example #9
0
def show_annot_context_menu(ibs, aid, qwin, qpoint, refresh_func=None,
                            with_interact_name=True, with_interact_chip=True,
                            with_interact_image=True, config2_=None):
    """
    Defines logic for poping up a context menu when viewing an annotation.
    Used in other interactions like name_interaction and interact_query_decision

    CommandLine:
        python -m ibeis.viz.interact.interact_chip --test-ishow_chip --show

    """
    import guitool
    callback_list = build_annot_context_options(
        ibs, aid, refresh_func=refresh_func,
        with_interact_name=with_interact_name,
        with_interact_chip=with_interact_chip,
        with_interact_image=with_interact_image, config2_=config2_)
    guitool.popup_menu(qwin, qpoint, callback_list)
Example #10
0
def show_annot_context_menu(ibs, aid, qwin, qpoint, refresh_func=None,
                            with_interact_name=True, with_interact_chip=True,
                            with_interact_image=True, config2_=None):
    """
    Defines logic for poping up a context menu when viewing an annotation.
    Used in other interactions like name_interaction and interact_query_decision

    CommandLine:
        python -m ibeis.viz.interact.interact_chip --test-ishow_chip --show

    """
    import guitool
    callback_list = build_annot_context_options(
        ibs, aid, refresh_func=refresh_func,
        with_interact_name=with_interact_name,
        with_interact_chip=with_interact_chip,
        with_interact_image=with_interact_image, config2_=config2_)
    guitool.popup_menu(qwin, qpoint, callback_list)
Example #11
0
 def on_contextMenuRequested(qres_wgt, qtindex, qpoint):
     """
     popup context menu
     """
     #selected_qtindex_list = qres_wgt.view.selectedIndexes()
     selected_qtindex_list = qres_wgt.selectedRows()
     if len(selected_qtindex_list) == 1:
         qwin = qres_wgt
         aid1, aid2 = qres_wgt.get_aidpair_from_qtindex(qtindex)
         tup = qres_wgt.get_widget_review_vars(aid1)
         ibs, cm, qreq_, update_callback, backend_callback = tup
         options = get_aidpair_context_menu_options(
             ibs,
             aid1,
             aid2,
             cm,
             qreq_=qreq_,
             logger=qres_wgt.logger,
             update_callback=update_callback,
             backend_callback=backend_callback)
         gt.popup_menu(qwin, qpoint, options)
     else:
         print('[context] Multiple %d selection' %
               (len(selected_qtindex_list), ))
Example #12
0
 def on_contextMenuRequested(iqrw, qtindex, qpos):
     printDBG('[newgui] contextmenu')
     guitool.popup_menu(iqrw, qpos, [
         ('view match annotations', lambda: show_match_at(iqrw, qtindex)),
         ('review match', lambda: review_match_at(iqrw, qtindex)),
     ])
Example #13
0
 def on_contextMenuClicked(ibswgt, qtindex, pos):
     #printDBG('[newgui] contextmenu')
     model = qtindex.model()
     tblview = ibswgt.views[model.name]
     id_list = [model._get_row_id(_qtindex) for _qtindex in tblview.selectedIndexes()]
     if model.name == ENCOUNTER_TABLE:
         if len(id_list) == 1:
             eid = id_list[0]
             guitool.popup_menu(tblview, pos, [
                 ('delete encounter', lambda: ibswgt.back.delete_encounter(eid)),
             ])
         else:
             merge_destination_id = model._get_row_id(qtindex)  # This is for the benefit of merge encounters
             guitool.popup_menu(tblview, pos, [
                 ('merge encounters', lambda: ibswgt.back.merge_encounters(id_list, merge_destination_id)),
                 ('delete encounters', lambda: ibswgt.back.delete_encounter(id_list)),
             ])
     elif model.name == IMAGE_TABLE:
         eid = model.eid
         if len(id_list) == 1:
             gid = id_list[0]
             guitool.popup_menu(tblview, pos, [
                 ('view hough image', lambda: ibswgt.back.show_hough(gid)),
                 ('delete image', lambda: ibswgt.back.delete_image(gid)),
             ])
         else:
             print(id_list)
             guitool.popup_menu(tblview, pos, [
                 ('move to new encounter', lambda: ibswgt.back.send_to_new_encounter(id_list, mode='move')),
                 ('copy to new encounter', lambda: ibswgt.back.send_to_new_encounter(id_list, mode='copy')),
                 ('delete images', lambda: ibswgt.back.delete_image(id_list)),
             ])
     elif model.name == ANNOTATION_TABLE:
         eid = model.eid
         if len(id_list) == 1:
             aid = id_list[0]
             guitool.popup_menu(tblview, pos, [
                 ('delete annotation', lambda: ibswgt.back.delete_annot(aid)),
             ])
         else:
             guitool.popup_menu(tblview, pos, [
                 ('delete annotations', lambda: ibswgt.back.delete_annot(id_list)),
             ])