123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- #!/usr/bin/env python3
- '''
- KLL Modifier Containers
- '''
-
- # Copyright (C) 2016 by Jacob Alexander
- #
- # This file is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This file is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this file. If not, see <http://www.gnu.org/licenses/>.
-
- ### Imports ###
-
-
-
- ### Decorators ###
-
- ## Print Decorator Variables
- ERROR = '\033[5;1;31mERROR\033[0m:'
- WARNING = '\033[5;1;33mWARNING\033[0m:'
-
-
-
- ### Classes ###
-
- class AnimationModifier:
- '''
- Animation modification container class
- '''
- def __init__( self, name, value=None ):
- self.name = name
- self.value = value
-
- def __repr__( self ):
- if self.value is None:
- return "{0}".format( self.name )
- return "{0}:{1}".format( self.name, self.value )
-
-
- class AnimationModifierList:
- '''
- Animation modification container list class
-
- Contains a list of modifiers, the order does not matter
- '''
- def __init__( self ):
- self.modifiers = []
-
- def setModifiers( self, modifier_list ):
- '''
- Apply modifiers to Animation
- '''
- for modifier in modifier_list:
- self.modifiers.append( AnimationModifier( modifier[0], modifier[1] ) )
-
- def strModifiers( self ):
- '''
- __repr__ of Position when multiple inheritance is used
- '''
- output = ""
- for index, modifier in enumerate( self.modifiers ):
- if index > 0:
- output += ","
- output += "{0}".format( modifier )
-
- return output
-
- def __repr__( self ):
- return self.strModifiers()
-
-
- class PixelModifier:
- '''
- Pixel modification container class
- '''
- def __init__( self, operator, value ):
- self.operator = operator
- self.value = value
-
- def __repr__( self ):
- if self.operator is None:
- return "{0}".format( self.value )
- return "{0}{1}".format( self.operator, self.value )
-
-
- class PixelModifierList:
- '''
- Pixel modification container list class
-
- Contains a list of modifiers
- Index 0, corresponds to pixel 0
- '''
- def __init__( self ):
- self.modifiers = []
-
- def setModifiers( self, modifier_list ):
- '''
- Apply modifier to each pixel channel
- '''
- for modifier in modifier_list:
- self.modifiers.append( PixelModifier( modifier[0], modifier[1] ) )
-
- def strModifiers( self ):
- '''
- __repr__ of Position when multiple inheritance is used
- '''
- output = ""
- for index, modifier in enumerate( self.modifiers ):
- if index > 0:
- output += ","
- output += "{0}".format( modifier )
-
- return output
-
- def __repr__( self ):
- return self.strModifiers()
|