Properties
File mostly containing custom enum implementation allowing dynamic changes in it and loading it from config file.
1"""File mostly containing custom enum implementation allowing dynamic changes in it and loading it from config file. 2""" 3 4from tools import get_colors 5from enum import Enum 6from platform import system 7 8class StrEnum(str, Enum): 9 """Custom string enum for loading enum COLOR purposes. 10 11 Args: 12 str : String type. 13 Enum : Enum class from enum library. 14 """ 15 def __str__(self) -> str: 16 """Representation of the class. 17 18 Returns: 19 str: Return value of the color. 20 """ 21 return str(self.value) 22 23def create_color_enum(): 24 """Function creating enum from dictionary read from config file. 25 26 Returns: 27 StrEnum: Custom string enum. 28 """ 29 colors = get_colors() 30 capitalized_colors = {key.upper(): value for key, value in colors.items()} 31 return StrEnum('COLOR', capitalized_colors) 32 33COLOR = create_color_enum() 34 35class STRING(str, Enum): 36 """Class holding strings constants about warnings. 37 38 Args: 39 str : String type. 40 Enum : Enum class from enum library. 41 """ 42 ASSETS_WARNING = 'Make sure the folder under the name of chosen theme have all necessary assets with proper names!' 43 COLORS_WARNING = 'Color changes will be visible after restarting the app!' 44 SAVES_WARNING = 'Empty name will create default save name chess_save_x' 45 46SYSTEM = system()
class
StrEnum(builtins.str, enum.Enum):
9class StrEnum(str, Enum): 10 """Custom string enum for loading enum COLOR purposes. 11 12 Args: 13 str : String type. 14 Enum : Enum class from enum library. 15 """ 16 def __str__(self) -> str: 17 """Representation of the class. 18 19 Returns: 20 str: Return value of the color. 21 """ 22 return str(self.value)
Custom string enum for loading enum COLOR purposes.
Arguments:
- str : String type.
- Enum : Enum class from enum library.
def
create_color_enum():
24def create_color_enum(): 25 """Function creating enum from dictionary read from config file. 26 27 Returns: 28 StrEnum: Custom string enum. 29 """ 30 colors = get_colors() 31 capitalized_colors = {key.upper(): value for key, value in colors.items()} 32 return StrEnum('COLOR', capitalized_colors)
Function creating enum from dictionary read from config file.
Returns:
StrEnum: Custom string enum.
Custom string enum for loading enum COLOR purposes.
Arguments:
- str : String type.
- Enum : Enum class from enum library.
BACKGROUND =
<COLOR.BACKGROUND: '#606676'>
TILE_1 =
<COLOR.TILE_1: '#708871'>
HIGH_TILE_1 =
<COLOR.HIGH_TILE_1: '#94A695'>
TILE_2 =
<COLOR.TILE_2: '#BEC6A0'>
HIGH_TILE_2 =
<COLOR.HIGH_TILE_2: '#CFD7C9'>
TEXT =
<COLOR.TEXT: '#FEF3E2'>
DARK_TEXT =
<COLOR.DARK_TEXT: '#222831'>
TRANSPARENT =
<COLOR.TRANSPARENT: 'transparent'>
NOTIFICATION_BACKGROUND =
<COLOR.NOTIFICATION_BACKGROUND: '#536493'>
NOTIFICATION_OUTLINE =
<COLOR.NOTIFICATION_OUTLINE: '#393E46'>
NOTATION_BACKGROUND_B =
<COLOR.NOTATION_BACKGROUND_B: '#254336'>
NOTATION_BACKGROUND_W =
<COLOR.NOTATION_BACKGROUND_W: '#B7B597'>
CLOSE =
<COLOR.CLOSE: '#FF6969'>
CLOSE_HOVER =
<COLOR.CLOSE_HOVER: '#C80036'>
TRANSPARENT_MASK =
<COLOR.TRANSPARENT_MASK: '#97A789'>
class
STRING(builtins.str, enum.Enum):
36class STRING(str, Enum): 37 """Class holding strings constants about warnings. 38 39 Args: 40 str : String type. 41 Enum : Enum class from enum library. 42 """ 43 ASSETS_WARNING = 'Make sure the folder under the name of chosen theme have all necessary assets with proper names!' 44 COLORS_WARNING = 'Color changes will be visible after restarting the app!' 45 SAVES_WARNING = 'Empty name will create default save name chess_save_x'
Class holding strings constants about warnings.
Arguments:
- str : String type.
- Enum : Enum class from enum library.
ASSETS_WARNING =
<STRING.ASSETS_WARNING: 'Make sure the folder under the name of chosen theme have all necessary assets with proper names!'>
COLORS_WARNING =
<STRING.COLORS_WARNING: 'Color changes will be visible after restarting the app!'>
SAVES_WARNING =
<STRING.SAVES_WARNING: 'Empty name will create default save name chess_save_x'>
SYSTEM =
'Windows'