예제 #1
0
 def _processClickArea(self, area, x, y):
   hit = False
   (rect, action, timedAction) = area
   if rect.contains(x, y):
     m = self.m.get("messages", None)
     if m:
       print("Clicked, sending %s" % action)
       hit = True
       self.set('lastClickXY', (x, y))
       m.routeMessage(action)
     else:
       print("No message handler to receive clicks")
   return hit
예제 #2
0
 def handleDrag(self, startX, startY, dx, dy, x, y, msDuration):
   # react on timed actions interactively
   if self.dragScreen:
     m = self.m.get(self.dragScreen, None)
     if m is not None:
       m.dragEvent(startX,startY,dx,dy,x,y)
   else:
     for area in self.dragAreas:
       (rect, module) = area
       if rect.contains(startX,startY):
         m = self.m.get(module, None)
         if m is not None:
           m.dragEvent(startX,startY,dx,dy,x,y)
         else:
           print "Drag registered to nonexistent module %s" % module
예제 #3
0
 def _processLPArea(self, area, msCurrentDuration, x, y):
   hit = False
   (rect, normalAction, timedAction) = area
   if timedAction: # we are interested only in timed actions
     if rect.contains(x,y):
       (givenMsDuration, action) = timedAction
       if givenMsDuration <= msCurrentDuration:
         m = self.m.get("messages", None)
         if m:
           print("Long-clicked (%f ms), sending %s" % (givenMsDuration, action))
           hit = True
           self.set('lastClickXY', (x,y))
           self.modrana.gui.lockDrag()
           m.routeMessage(action)
           self.set('needRedraw', True)
         else:
           print("No message handler to receive clicks")
         self.ignoreNextClicks = self.dmod.lpSkipCount()
   return hit