def OnButtonUp(self, wid, event):
        """Mouse button released."""
        m = self.get_pointer()
        ctrl, shift = self._GetCtrlShift(event)
        print "MarkerWindowInteractor.OnButtonUp(): ctrl=", ctrl, "shift=", shift, "button=", event.button
        self._Iren.SetEventInformationFlipY(m[0], m[1], ctrl, shift, chr(0), 0,
                                            None)

        if event.button in self.interactButtons:
            print "self.vtk_interact_mode =", self.vtk_interact_mode
            if (self.vtk_interact_mode == False):
                self.releaseFuncs[event.button]()

        try:
            self.releaseHooks[event.button]()
        except KeyError:
            pass

        thisCamera = self.get_camera_fpu()
        try:
            self.lastCamera
        except AttributeError:
            pass  # this
        else:
            if thisCamera != self.lastCamera:
                UndoRegistry().push_command(self.set_camera, self.lastCamera)

        return True
 def button_down(*args):
     marker = self.get_marker_at_point()
     if marker is None: return
     color = EventHandler().get_default_color()
     oldColor = marker.get_color()
     UndoRegistry().push_command(EventHandler().notify, 'color marker',
                                 marker, oldColor)
     EventHandler().notify('color marker', marker, color)
Exemple #3
0
    def OnButtonUp(self, wid, event):
        if not hasattr(self, 'lastPnts'): return
        #calling this before base class freezes the cursor at last pos
        if not self.hasData: return
        if event.button == 1:
            self.observer.InteractionOff()
        MarkerWindowInteractor.OnButtonUp(self, wid, event)

        pnts = self.get_plane_points()

        if pnts != self.lastPnts:
            UndoRegistry().push_command(self.set_plane_points, self.lastPnts)
        return True
Exemple #4
0
        def button_up(*args):
            if self.markerAtPoint is None: return
            thisPos = self.markerAtPoint.get_center()

            def undo_move(marker):
                marker.set_center(self.lastPos)
                ra = self.get_actor_for_marker(marker)
                ra.update()
                self.Render()

            if thisPos != self.lastPos:
                UndoRegistry().push_command(undo_move, self.markerAtPoint)
            self.markerAtPoint = None
    def OnButtonUp(self, wid, event):
        """Mouse button released."""

        #print "PlaneWidgetsXYZ.OnButtonUp(): event=", event

        if not hasattr(self, 'lastPntsXYZ'): return
        MarkerWindowInteractor.OnButtonUp(self, wid, event)
        pntsXYZ = (self.get_plane_points(self.pwX),
                   self.get_plane_points(self.pwY),
                   self.get_plane_points(self.pwZ))

        if pntsXYZ != self.lastPntsXYZ:
            UndoRegistry().push_command(self.set_plane_points_xyz,
                                        self.lastPntsXYZ)

        return True
        def button_down(*args):
            marker = self.get_marker_at_point()
            if marker is None: return
            dlg = gtk.Dialog('Marker Label')
            dlg.show()

            frame = gtk.Frame('Marker Label')
            frame.show()
            frame.set_border_width(5)
            dlg.vbox.pack_start(frame)

            entry = gtk.Entry()
            entry.set_activates_default(True)
            entry.show()

            label = marker.get_label()
            defaultLabel = label
            if defaultLabel == '' and self.lastLabel is not None:
                m = re.match('(.+?)(\d+)', self.lastLabel)
                if m:
                    defaultLabel = m.group(1) + str(int(m.group(2)) + 1)

            entry.set_text(defaultLabel)
            frame.add(entry)

            dlg.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
            dlg.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
            dlg.set_default_response(gtk.RESPONSE_OK)
            response = dlg.run()
            if response == gtk.RESPONSE_OK:
                label = entry.get_text()
                if label == '': return
                oldLabel = marker.get_label()
                UndoRegistry().push_command(EventHandler().notify,
                                            'label marker', marker, oldLabel)
                EventHandler().notify('label marker', marker, label)
                self.lastLabel = label
            dlg.destroy()
            self.Render()
Exemple #7
0
 def undo_last(self, button):
     UndoRegistry().undo()