Esempio n. 1
0
    def new_layout_spec(self, event):
        """
    New layout_spec for a Tracking Handle menu:
      axis vector is orthogonal to glyph
      vector is directed towards center of glyph
      benchmark is an offset from the glyph (so middle item is on glyph)
      opening item is the middle item
    
    Event opens the menu, here the event is a hit on a morph edge.
    TODO abstract opening with moving.
    """
        # Controlee is a morph, but can be an empty morph (an empty model/document.)
        # Note that an empty morph must implement get_orthogonal().
        assert self.controlee is not None

        # axis orthogonal to controlee.
        # Controlee is usually a graphic morph or background.
        axis = self.controlee.get_orthogonal(event)

        benchmark = layout.benchmark_from_hotspot(axis, event)

        # FIXME hardcoded to open at 1, should be the middle of the menu
        self.layout_spec = layout.LayoutSpec(event, benchmark, axis, opening_item=1)
        return self.layout_spec  # for debug

        """
Esempio n. 2
0
    def new_layout_spec(self, event):
        """
    New layout_spec for a Tracking Handle menu:
      axis vector is orthogonal to glyph
      vector is directed towards center of glyph
      benchmark is an offset from the glyph (so middle item is on glyph)
      opening item is the middle item
    
    Event opens the menu, here the event is a hit on a morph edge.
    TODO abstract opening with moving.
    """
        # Controlee is a morph, but can be an empty morph (an empty model/document.)
        # Note that an empty morph must implement get_orthogonal().
        assert self.controlee is not None

        # axis orthogonal to controlee.
        # Controlee is usually a graphic morph or background.
        axis = self.controlee.get_orthogonal(event)

        benchmark = layout.benchmark_from_hotspot(axis, event)

        # FIXME hardcoded to open at 1, should be the middle of the menu
        self.layout_spec = layout.LayoutSpec(event,
                                             benchmark,
                                             axis,
                                             opening_item=1)
        return self.layout_spec  # for debug
        """
Esempio n. 3
0
 def new_layout_spec(self, event):
     """
 New layout_spec for a Stationed Handle Menu:
   axis vector is vertical
   vector is directed down
   benchmark is an offset from the glyph (so middle item is on glyph)
   opening item is the middle item
 
 Event opens the menu, here the event is a hit at any point.
 """
     # Controlee is a morph, but can be an empty morph (an empty model/document.)
     # Controlee is usually the document, i.e. point is in background.
     axis = vector.downward_vector()  # axis vertical, downward
     benchmark = layout.benchmark_from_hotspot(axis, event)
     # FIXME hardcoded to open at 1, should be the middle of the menu
     self.layout_spec = layout.LayoutSpec(event, benchmark, axis, opening_item=1)
     return self.layout_spec  # for debug
Esempio n. 4
0
 def new_layout_spec(self, event):
     """
 New layout_spec for a Stationed Handle Menu:
   axis vector is vertical
   vector is directed down
   benchmark is an offset from the glyph (so middle item is on glyph)
   opening item is the middle item
 
 Event opens the menu, here the event is a hit at any point.
 """
     # Controlee is a morph, but can be an empty morph (an empty model/document.)
     # Controlee is usually the document, i.e. point is in background.
     axis = vector.downward_vector()  # axis vertical, downward
     benchmark = layout.benchmark_from_hotspot(axis, event)
     # FIXME hardcoded to open at 1, should be the middle of the menu
     self.layout_spec = layout.LayoutSpec(event,
                                          benchmark,
                                          axis,
                                          opening_item=1)
     return self.layout_spec  # for debug