コード例 #1
0
    def onLeft2(self, xEff, yEff, ev):
        from Priithon.all import Y

        #self.yx1 = (yEff, xEff)
        def ppp(*args):
            pass

        self.viewer.doLDown = ppp

        if self.gfxWhenDone == 'remove':
            self.gfxRemove()
        elif self.gfxWhenDone == 'hide':
            self.gfxHide()

        #20070721 self.viewer.doOnMouse = self.oldOnMouse
        Y._registerEventHandler(self.viewer.doOnLDown,
                                oldFcnName='vLeftClickDoes')
        Y._registerEventHandler(self.viewer.doOnMouse,
                                oldFcnName='vLeftClickDoes')

        #sort indices
        y0, x0 = self.yx0
        y1, x1 = self.yx1
        if y1 < y0:
            y0, y1 = y1, y0
        if x1 < x0:
            x0, x1 = x1, x0
        self.yx0 = y0, x0
        self.yx1 = y1, x1

        self.doThisAlsoOnDone()
コード例 #2
0
    def __init__(self, id=-1, rubberWhat='box', color=(0,1,0), 
                 gfxWhenDone='hide', roiName='1'):
        """
        id can be a viewerID
               or a viewer.GLViewer object
        rubberWhat should be one of:
             'box'
             'line'
             'circle'
             'ellipse'

        gfxWhenDone should be one of: 'hide', 'remove', None
        """
        from Priithon.all import Y
        if type(id) is int:
            self.splitND = Y.viewers[id]
            self.viewer = Y.viewers[id].viewer
        else:
            self.splitND = None # CHECK Y.viewers[id]
            self.viewer = id

        self.id = id
        self.rubberWhat = rubberWhat
        self.color = color
        self.gfxWhenDone = gfxWhenDone
        self.roiName = roiName
        self.gfxIdx = None

        #20070721 self.oldOnMouse= self.viewer.doOnMouse
        #20070721 self.viewer.doLDown =self.onLeft1
        Y._registerEventHandler(self.viewer.doOnLDown, newFcn=self.onLeft1, newFcnName='vLeftClickDoes', oldFcnName=None)
コード例 #3
0
    def onLeft2(self, xEff, yEff, ev):
        from Priithon.all import Y
        #self.yx1 = (yEff, xEff)
        def ppp(*args):
            pass
        self.viewer.doLDown = ppp

        if   self.gfxWhenDone == 'remove':
            self.gfxRemove()
        elif   self.gfxWhenDone == 'hide':
            self.gfxHide()


        #20070721 self.viewer.doOnMouse = self.oldOnMouse
        Y._registerEventHandler(self.viewer.doOnLDown, oldFcnName='vLeftClickDoes')
        Y._registerEventHandler(self.viewer.doOnMouse, oldFcnName='vLeftClickDoes')

        #sort indices
        y0,x0 = self.yx0
        y1,x1 = self.yx1
        if y1< y0:
            y0,y1 = y1,y0
        if x1< x0:
            x0,x1 = x1,x0
        self.yx0 = y0,x0 
        self.yx1 = y1,x1
        
        self.doThisAlsoOnDone()
コード例 #4
0
 def onLeft1(self, xEff, yEff, ev):
     self.yx0 = (int(yEff), int(xEff))
     #20070721 self.viewer.doLDown =self.onLeft2
     #20070721 self.viewer.doOnMouse = self.onMove
     from Priithon.all import Y
     Y._registerEventHandler(self.viewer.doOnLDown, newFcn=self.onLeft2, newFcnName='vLeftClickDoes')
     Y._registerEventHandler(self.viewer.doOnMouse, newFcn=self.onMove, newFcnName='vLeftClickDoes', oldFcnName=None)
     self.doThisAlsoOnStart()
コード例 #5
0
 def onLeft1(self, xEff, yEff, ev):
     self.yx0 = (int(yEff), int(xEff))
     #20070721 self.viewer.doLDown =self.onLeft2
     #20070721 self.viewer.doOnMouse = self.onMove
     from Priithon.all import Y
     Y._registerEventHandler(self.viewer.doOnLDown,
                             newFcn=self.onLeft2,
                             newFcnName='vLeftClickDoes')
     Y._registerEventHandler(self.viewer.doOnMouse,
                             newFcn=self.onMove,
                             newFcnName='vLeftClickDoes',
                             oldFcnName=None)
     self.doThisAlsoOnStart()
コード例 #6
0
    def __init__(self,
                 id=-1,
                 rubberWhat='box',
                 color=(0, 1, 0),
                 gfxWhenDone='hide',
                 roiName='1'):
        """
        id can be a viewerID
               or a viewer.GLViewer object
        rubberWhat should be one of:
             'box'
             'line'
             'circle'
             'ellipse'

        gfxWhenDone should be one of: 'hide', 'remove', None
        """
        from Priithon.all import Y
        if type(id) is int:
            self.splitND = Y.viewers[id]
            self.viewer = Y.viewers[id].viewer
        else:
            self.splitND = None  # CHECK Y.viewers[id]
            self.viewer = id

        self.id = id
        self.rubberWhat = rubberWhat
        self.color = color
        self.gfxWhenDone = gfxWhenDone
        self.roiName = roiName
        self.gfxIdx = None

        #20070721 self.oldOnMouse= self.viewer.doOnMouse
        #20070721 self.viewer.doLDown =self.onLeft1
        Y._registerEventHandler(self.viewer.doOnLDown,
                                newFcn=self.onLeft1,
                                newFcnName='vLeftClickDoes',
                                oldFcnName=None)