Ejemplo n.º 1
0
 def _on_name_click(event):
     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
                 import guitool
                 from ibeis.viz.interact import interact_chip
                 height = fig.canvas.geometry().height()
                 qpoint = guitool.newQPoint(event.x, height - event.y)
                 refresh_func = functools.partial(viz.show_name,
                                                  ibs,
                                                  nid,
                                                  fnum=fnum,
                                                  sel_aids=sel_aids)
                 interact_chip.show_annot_context_menu(
                     ibs,
                     aid,
                     fig.canvas,
                     qpoint,
                     refresh_func=refresh_func,
                     with_interact_name=False)
             else:
                 viz.show_name(ibs,
                               nid,
                               fnum=fnum,
                               sel_aids=[aid],
                               in_image=True)
                 if select_aid_callback is not None:
                     select_aid_callback(aid)
     viz.draw()
Ejemplo n.º 2
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__))
Ejemplo n.º 3
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__))
Ejemplo n.º 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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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()
Ejemplo n.º 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()
Ejemplo n.º 8
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
                 height = self.fig.canvas.geometry().height()
                 qpoint = guitool.newQPoint(event.x, height - event.y)
                 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__))
Ejemplo n.º 9
0
 def _on_name_click(event):
     print_('[inter] clicked name')
     ax = event.inaxes
     if ih.clicked_inside_axis(event):
         viztype = vh.get_ibsdat(ax, 'viztype')
         print_(' viztype=%r' % viztype)
         if viztype == 'chip':
             aid = vh.get_ibsdat(ax, 'aid')
             print('... aid=%r' % aid)
             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 = functools.partial(viz.show_name, ibs, nid, fnum=fnum, sel_aids=sel_aids)
                 interact_chip.show_annot_context_menu(
                     ibs, aid, fig.canvas, qpoint, refresh_func=refresh_func,
                     with_interact_name=False)
             else:
                 viz.show_name(ibs, nid, fnum=fnum, sel_aids=[aid], in_image=True)
                 if select_aid_callback is not None:
                     select_aid_callback(aid)
     viz.draw()