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')
                logger.info('... aid=%r' % aid)
                if event.button == 3:  # right-click
                    from wbia import guitool
                    from wbia.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()
    def figure_clicked(self, event=None):
        ax = event.inaxes
        if ih.clicked_inside_axis(event):
            viztype = vh.get_ibsdat(ax, 'viztype')
            if viztype == 'chip':
                aid = vh.get_ibsdat(ax, 'aid')
                # logger.info('... aid=%r' % aid)
                if event.button == 3:  # right-click
                    # import wbia.guitool
                    # height = self.fig.canvas.geometry().height()
                    # qpoint = guitool.newQPoint(event.x, height - event.y)
                    # ibs = self.ibs
                    # is_exemplar = ibs.get_annot_exemplar_flags(aid)
                    # def context_func():
                    #    ibs.set_annot_exemplar_flags(aid, not is_exemplar)
                    #    self.show_page()
                    # guitool.popup_menu(self.fig.canvas, pt, [
                    #    ('unset as exemplar' if is_exemplar else 'set as exemplar', context_func),
                    # ])
                    # TODO USE ABSTRACT INTERACTION
                    from wbia.viz.interact import interact_chip

                    options = interact_chip.build_annot_context_options(
                        self.ibs, aid, refresh_func=self.show_page)
                    self.show_popup_menu(options, event)
                    # interact_chip.show_annot_context_menu(
                    #    self.ibs, aid, self.fig.canvas, qpoint, refresh_func=self.show_page)
                    # ibs.print_annotation_table()
                # logger.info(ut.repr2(event.__dict__))
            elif viztype == 'matches':
                self.cm.ishow_single_annotmatch(self.qreq_,
                                                self.aid2,
                                                fnum=None,
                                                mode=0)
Exemple #3
0
    def figure_clicked(self, event=None):
        from wbia.viz import viz_helpers as vh
        import wbia.guitool as gt

        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 wbia.viz.interact import interact_chip

                    height = self.fig.canvas.geometry().height()
                    qpoint = gt.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_
                    )
                    gt.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.repr2(event.__dict__))
 def on_drag(self, event=None):
     if self.debug > 1:
         print('[pt.a] on_drag')
     if ih.clicked_inside_axis(event):
         self.on_drag_inside(event)
     # Make sure BLIT (bit block transfer) is used for updates
     # self.fig.canvas.blit(self.fig.ax.bbox)
     pass
    def on_click(self, event):
        if self.debug > 0:
            print('[pt.a] on_click')
            # print('[pt.a] on_click. event=%r' % (ut.repr2(event.__dict__)))
        # raise NotImplementedError('implement yourself')
        if event.button is not None:
            for button in self.MOUSE_BUTTONS.values():
                if self.MOUSE_BUTTONS[event.button] == button:
                    self.is_down[button] = True
        # if event.button == self.LEFT_BUTTON:
        #    self.is_down['left'] = True
        # if event.button == self.RIGHT_BUTTON:
        #    self.is_down['right'] = True
        # if event.button == self.MIDDLE_BUTTON:
        #    self.is_down['middle'] = True
        if ih.clicked_inside_axis(event):
            ax = event.inaxes
            self.on_click_inside(event, ax)
        else:
            self.on_click_outside(event)

        for pan in self.pan_event_list:
            pan.pan_on_press(event)
Exemple #6
0
    def _emit_button_press(self, event):
        from wbia.plottool import interact_helpers as ih

        if ih.clicked_inside_axis(event):
            self.click_inside_signal.emit(event, event.inaxes)