def __init__(self, parentSelector):
   # WAS "Graphic Effect"
   InstrumentFormation.__init__(self, name="Effect", parentSelector=parentSelector)
   self.instrument = PGraphicEffectInstrument()
   self.styleProperties=[UnwrappedComboBoxStyleProperty("Effect", 
                                               self.instrument.setGraphicEffect, self.selector,
                                               default=self.instrument.graphicEffect(),
                                               model = graphicEffectModel)]  
class GraphicEffectFormation(InstrumentFormation):
  '''
  Styling attributes of filter instrument (graphics effect.)
  
  Specialize to <PGraphicEffectInstrument>
  '''
  
  def __init__(self, parentSelector):
    # WAS "Graphic Effect"
    InstrumentFormation.__init__(self, name="Effect", parentSelector=parentSelector)
    self.instrument = PGraphicEffectInstrument()
    self.styleProperties=[UnwrappedComboBoxStyleProperty("Effect", 
                                                self.instrument.setGraphicEffect, self.selector,
                                                default=self.instrument.graphicEffect(),
                                                model = graphicEffectModel)]  
  
  
  def applyTo(self, morph):
    effect = self.adaptEncoding(self.instrument.graphicEffect())
    
    global effects
    effects.append(effect)
    
    morph.setGraphicsEffect(effect)
    
  
  def adaptEncoding(self, codedValue):
    '''
    Adapt coded value to a QGraphicEffect value
    '''
    adaptedValue = None
    if codedValue == 1:
      adaptedValue = QGraphicsBlurEffect()
    elif codedValue == 2:
      adaptedValue = QGraphicsDropShadowEffect()
    #print "Adapted graphic effect:", adaptedValue
    assert adaptedValue is None or isinstance(adaptedValue, QGraphicsEffect)
    return adaptedValue