WIP for memoryManager

This commit is contained in:
Chrys 2017-10-30 20:42:18 +01:00
parent 8b29f366a7
commit dec4974fb0
3 changed files with 12 additions and 3 deletions

View File

@ -12,7 +12,7 @@ generalData = {
'currUser':'', 'currUser':'',
'prevUser':'', 'prevUser':'',
'managerList':['processManager', 'punctuationManager', 'cursorManager', 'applicationManager', 'commandManager' 'managerList':['processManager', 'punctuationManager', 'cursorManager', 'applicationManager', 'commandManager'
,'screenManager','inputManager','outputManager','helpManager','eventManager','debug'], , 'screenManager', 'inputManager','outputManager', 'helpManager', 'memoryManager', 'eventManager', 'debug'],
'commandFolderList':['commands','onInput', 'onCursorChange', 'onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice' 'commandFolderList':['commands','onInput', 'onCursorChange', 'onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice'
,'onApplicationChange','onSwitchApplicationProfile','help',], ,'onApplicationChange','onSwitchApplicationProfile','help',],
} }

View File

@ -7,15 +7,21 @@
import time import time
from core import debug from core import debug
class inputManager(): class memoryManager():
def __init__(self): def __init__(self):
self.listStorage = {} self.listStorage = {}
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
def shutdown(self):
pass
def addValueToFirstIndex(self, name, value): def addValueToFirstIndex(self, name, value):
pass pass
def addIndexList(self, name, maxLength = None, currList = [], currIndex = 0): def addIndexList(self, name, maxLength = None, currList = [], currIndex = 0):
self.listStorage[name] = {'list': currList, 'index': currIndex, 'maxLength': maxLength} self.listStorage[name] = {'list': currList, 'index': currIndex, 'maxLength': maxLength}
def isLastIndex(self, name):
return self.listStorage[name]['index'] == len(self.listStorage[name]['list']):
def isFirstIndex(self, name):
return self.listStorage[name]['index'] == 0:
def getNextIndex(self, name): def getNextIndex(self, name):
if self.isIndexListEmpty(name): if self.isIndexListEmpty(name):
self.listStorage[name]['index'] = -1 self.listStorage[name]['index'] = -1

View File

@ -10,6 +10,7 @@ fenrirPath = os.path.dirname(currentdir)
from configparser import ConfigParser from configparser import ConfigParser
from core import debugManager from core import debugManager
from core import memoryManager
from core import processManager from core import processManager
from core import eventManager from core import eventManager
from core import inputManager from core import inputManager
@ -323,6 +324,8 @@ class settingsManager():
if fenrirManager: if fenrirManager:
environment['runtime']['fenrirManager'] = fenrirManager environment['runtime']['fenrirManager'] = fenrirManager
environment['runtime']['memoryManager'] = memoryManager.memoryManager()
environment['runtime']['memoryManager'].initialize(environment)
environment['runtime']['eventManager'] = eventManager.eventManager() environment['runtime']['eventManager'] = eventManager.eventManager()
environment['runtime']['eventManager'].initialize(environment) environment['runtime']['eventManager'].initialize(environment)
environment['runtime']['processManager'] = processManager.processManager() environment['runtime']['processManager'] = processManager.processManager()