WIP move clipboards to memoryManager

This commit is contained in:
Chrys 2017-10-30 20:59:56 +01:00
parent dec4974fb0
commit 5059013009
13 changed files with 8 additions and 4 deletions

View File

@ -11,14 +11,14 @@ class command():
pass
def initialize(self, environment):
self.env = environment
self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards'))
def shutdown(self):
pass
def getDescription(self):
return _('clears the currently selected clipboard')
def run(self):
self.env['commandBuffer']['currClipboard'] = -1
del self.env['commandBuffer']['clipboard'][:]
self.env['runtime']['memoryManager'].clearCurrentIndexList('clipboardHistory')
self.env['runtime']['outputManager'].presentText(_('clipboard cleared'), interrupt=True)
return
def setCallback(self, callback):

View File

@ -14,8 +14,12 @@ class memoryManager():
self.env = environment
def shutdown(self):
pass
def addValueToFirstIndex(self, name, value):
pass
def addValueToFirstIndex(self, name, value, index = 0):
if self.listStorage[name]['maxLength'] != None:
self.listStorage[name]['list'] = [value] + self.listStorage[name]['list']
else:
self.listStorage[name]['list'] = [value] + self.listStorage[name]['list'][:self.listStorage[name]['maxLength'] -1]
self.listStorage[name]['index'] = index
def addIndexList(self, name, maxLength = None, currList = [], currIndex = 0):
self.listStorage[name] = {'list': currList, 'index': currIndex, 'maxLength': maxLength}
def isLastIndex(self, name):