parameters: (self)
return_statement: return True
docstring: Check if current layer is valid
             - A document must be opened
             - Active layer properties must be:
               . Layer type:  a paint layer
               . Color model: RGBA
               . Color depth: 8bits
docstring_summary: Check if current layer is valid
             - A document must be opened
             - Active layer properties must be:
               . Layer type:  a paint layer
               . Color model: RGBA
               . Color depth: 8bits
docstring_tokens: Check if current layer is valid - A document must be opened - Active layer properties must be : . Layer type : a paint layer . Color model : RGBA . Color depth : 8bits
function: def checkCurrentLayer(self):
          """Check if current layer is valid
             - A document must be opened
             - Active layer properties must be:
               . Layer type:  a paint layer
               . Color model: RGBA
               . Color depth: 8bits
          """
          self.__sourceDocument = Application.activeDocument()
          # Check if there's an active document
          if self.__sourceDocument is None:
              self.dBoxMessage(DBOX_WARNING, "There's no active document!")
              return False
  
          self.__sourceLayer = self.__sourceDocument.activeNode()
  
          # Check if current layer can be processed
          if self.__sourceLayer.type() != "paintlayer" or self.__sourceLayer.colorModel() != "RGBA" or self.__sourceLayer.colorDepth() != "U8":
              self.dBoxMessage(DBOX_WARNING, "Selected layer must be a 8bits RGBA Paint Layer!"
                                             "\n\nCurrent layer '{0}' properties:"
                                             "\n- Layer type: {1}"
                                             "\n- Color model: {2} ({3})"
                                             "\n- Color depth: {4}"
                                             "\n\n> Action is cancelled".format(self.__sourceLayer.name(),
                                                                           self.translateDictKey('layerType', self.__sourceLayer.type()),
                                                                           self.__sourceLayer.colorModel(), self.translateDictKey('colorModel', self.__sourceLayer.colorModel()),
                                                                           self.translateDictKey('colorDepth', self.__sourceLayer.colorDepth())
                              ))
              return False
  
          return True
function_tokens: def checkCurrentLayer ( self ) : self . __sourceDocument = Application . activeDocument ( ) # Check if there's an active document if self . __sourceDocument is None : self . dBoxMessage ( DBOX_WARNING , "There's no active document!" ) return False self . __sourceLayer = self . __sourceDocument . activeNode ( ) # Check if current layer can be processed if self . __sourceLayer . type ( ) != "paintlayer" or self . __sourceLayer . colorModel ( ) != "RGBA" or self . __sourceLayer . colorDepth ( ) != "U8" : self . dBoxMessage ( DBOX_WARNING , "Selected layer must be a 8bits RGBA Paint Layer!" "\n\nCurrent layer '{0}' properties:" "\n- Layer type: {1}" "\n- Color model: {2} ({3})" "\n- Color depth: {4}" "\n\n> Action is cancelled" . format ( self . __sourceLayer . name ( ) , self . translateDictKey ( 'layerType' , self . __sourceLayer . type ( ) ) , self . __sourceLayer . colorModel ( ) , self . translateDictKey ( 'colorModel' , self . __sourceLayer . colorModel ( ) ) , self . translateDictKey ( 'colorDepth' , self . __sourceLayer . colorDepth ( ) ) ) ) return False return True