예제 #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()
예제 #2
0
 def figure_clicked(self, event=None):
     #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
                 #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 ibeis.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()
             #print(ut.dict_str(event.__dict__))
         elif viztype == 'matches':
             self.cm.ishow_single_annotmatch(self.qreq_, self.aid2, fnum=None, mode=0)
예제 #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__))
예제 #4
0
 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')
             #print('... aid=%r' % aid)
             if event.button == 3:  # right-click
                 #import 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 ibeis.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()
             #print(ut.repr2(event.__dict__))
         elif viztype == 'matches':
             self.cm.ishow_single_annotmatch(self.qreq_,
                                             self.aid2,
                                             fnum=None,
                                             mode=0)
예제 #5
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__))
예제 #6
0
 def on_click(self, event):
     print('[inter] clicked in expandable interact')
     ax = event.inaxes
     if ih.clicked_inside_axis(event):
         func = pt.get_plotdat(ax, 'plot_func', None)
         if ut.VERBOSE:
             print('func = %r' % (func,))
         if func is not None:
             if ut.VERBOSE:
                 print('calling func = %r' % (func,))
             fnum = pt.next_fnum()
             #pt.figure(fnum=fnum)
             pnum = (1, 1, 1)
             index = pt.get_plotdat(ax, 'expandable_index', None)
             if index is not None:
                 ishow_func = self.ishow_func_list[index]
             else:
                 ishow_func = None
             if ishow_func is not None:
                 inter = ishow_func(fnum=fnum)
             else:
                 if check_if_subinteract(func):
                     inter = func(fnum=fnum)
                     inter.show_page()
                 elif hasattr(func, 'plot'):
                     inter = func
                     inter.start()
                     #func.plot(fnum=self.fnum, pnum=pnum)
                 else:
                     func(fnum=fnum, pnum=pnum)
                 #inter.show_page()
             fig = pt.gcf()
             pt.show_figure(fig)
예제 #7
0
 def on_drag(self, event=None):
     if self.debug:
         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
예제 #8
0
 def on_drag(self, event=None):
     if self.debug:
         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
예제 #9
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__))
예제 #10
0
    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')
        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)
예제 #11
0
    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')
        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)
예제 #12
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()