"""
@Name: Cam Engine Globals
@Description: This file includes all the global variables that need
to be accessed by the application from various locations.
@Created on: Feb-2021
@Created by: Vinimay Kaul
@Last Modified: 27-Feb-2021
@Last Modified by: Vinimay Kaul
"""
import os
from pathlib import Path
# General Variable values
APPLICATION_VERSION="0.0.0"
COMPATIBILITY_ALL = 0
COMPATIBILITY_WIN_ONLY = 1
COMPATIBILITY_MAC_ONLY = 2
APP_OBJECT = None
WINDOW_OBJECT = None
RESTART_ENABLED = True
TK_OBJECT = None
SPLASH_SCREEN_IMAGE = Path("./CommonMedia/splash.png")
SPLASH_SCREEN_TIMEOUT = 2000
ABOUT_SCREEN_IMAGE = Path("./CommonMedia/about.png")
AUDIO_THREAD = None
CV2_ERROR_MESSAGE = ""
STACK_BUTTONS = []
STACK_BUTTONS_SL = []
ENABLED_SLIDES = []
ACTIVE_SLIDE_INDEX = 0
ACTIVE_SLIDE_NAME = None
ACTIVE_SLIDE_NAME_SL = None
SLIDE_OBJECT = None # Not needed... Use ActivePlugin.slideObject instead
NOTIFICATION_OBJECT = None
FREE_MODE_ACTIVE = False
GLOBAL_CE = None
USER_PLAN = None
USER_VALID = None
CS_LOGGER = None
CS_EXCEPTIONHOOK_LOGGER = None
CS_THREAD_ERROR_LOGGER = None
CS_RUNTIME_FILE = "./cs_runtime.csk"
# Specific Classes
[docs]
class CEEnvironment:
TEST_MODE_ACTIVE = False
#This will be populatet in the main python file and loaded into the CryptoEngine from uix.py
KEY_STORE = ""
AppDataFolder = Path("./")
[docs]
@staticmethod
def GetPluginFolder():
return Path("PluginsCE")
[docs]
@staticmethod
def GetFullPluginsPath():
# return CEEnvironment.GetAppDataFolder() + CEEnvironment.GetPluginFolder()
return CEEnvironment.AppDataFolder / CEEnvironment.GetPluginFolder()
[docs]
@staticmethod
def SetAppDataFolder(path):
CEEnvironment.AppDataFolder = Path(path)
[docs]
@staticmethod
def GetAppDataFolder():
return CEEnvironment.AppDataFolder
[docs]
@staticmethod
def GetAppFolder():
return Path(os.getcwd())
[docs]
class ApplicationScreens():
AnimationsScreen = None
ToolsScreen = None
PnSScreen = None
SearchScreen = None
[docs]
@staticmethod
def SetAnimationsScreen(anims):
ApplicationScreens.AnimationsScreen = anims
[docs]
@staticmethod
def GetAnimationsScreen():
return ApplicationScreens.AnimationsScreen
[docs]
@staticmethod
def SetPnSScreen(pns):
ApplicationScreens.PnSScreen = pns
[docs]
@staticmethod
def GetPnSScreen():
return ApplicationScreens.PnSScreen
[docs]
@staticmethod
def SetSearchScreen(search):
ApplicationScreens.SearchScreen = search
[docs]
@staticmethod
def GetSearchScreen():
return ApplicationScreens.SearchScreen
# class CurrentGameLevel:
# curr_game_level = 0
#
# @staticmethod
# def ResetGameLevel(cls):
# cls.curr_game_level = 0
#
# @staticmethod
# def SetGameLevel(cls, lvl):
# cls.curr_game_level = lvl
#
# @staticmethod
# def GetGameLevel(cls):
# return cls.curr_game_level
[docs]
class ActivePlugin:
active_plugin = None
active_slide = None
slideObject = None
[docs]
@staticmethod
def setActivePlugin(plugin):
ActivePlugin.active_plugin = plugin
[docs]
@staticmethod
def getActivePlugin():
return ActivePlugin.active_plugin
[docs]
@staticmethod
def setActiveSlide(slide):
ActivePlugin.active_slide = slide
[docs]
@staticmethod
def getActiveSlide():
return ActivePlugin.active_slide