finalize: custom command zone; auto screen detection

This commit is contained in:
chrys 2017-02-24 18:46:12 +01:00
parent d15ec7991e
commit 4cee4b5504
7 changed files with 16 additions and 12 deletions

View File

@ -138,7 +138,7 @@ dateFormat=%A, %B %d, %Y
autoSpellCheck=True
spellCheckLanguage=en_US
scriptPath=/usr/share/fenrir/scripts
commandPath=/usr/share/fenrir/command
commandPath=/usr/share/fenrir/commands
[focus]
cursor=True

View File

@ -141,7 +141,7 @@ spellCheckLanguage=en_US
# path for your scripts "scriptKey" functionality
scriptPath=/usr/share/fenrir/scripts
# overload commands, and create new one without changing Fenrir default
commandPath=/usr/share/fenrir/command
commandPath=/usr/share/fenrir/commands
[focus]
#follow the text cursor

View File

@ -139,7 +139,7 @@ autoSpellCheck=True
spellCheckLanguage=en_US
scriptPath=/usr/share/fenrir/scripts
# overload commands, and create new one without changing Fenrir default
commandPath=/usr/share/fenrir/command
commandPath=/usr/share/fenrir/commands
[focus]
#follow the text cursor

View File

@ -90,7 +90,7 @@ autoSpellCheck=True
spellCheckLanguage=en_US
scriptPath=/usr/share/fenrir/scripts
# overload commands, and create new one without changing Fenrir default
commandPath=/usr/share/fenrir/command
commandPath=/usr/share/fenrir/commands
[focus]
#follow the text cursor

View File

@ -50,12 +50,12 @@ class commandManager():
def loadCommands(self, section='commands',commandPath=''):
if commandPath =='':
commandPath = os.path.dirname(os.path.realpath(__main__.__file__))
commandPath = os.path.dirname(os.path.realpath(__main__.__file__))+ "/commands/"
if not commandPath.endswith('/'):
commandPath += '/'
commandFolder = commandPath + "commands/" + section +"/"
commandFolder = commandPath + section +"/"
if not os.path.exists(commandFolder):
self.env['runtime']['debug'].writeDebugOut("commandFolder not exists:" + commandFolder ,debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut("commandFolder not exists:" + commandFolder ,debug.debugLevel.WARNING)
return
if not os.path.isdir(commandFolder):
self.env['runtime']['debug'].writeDebugOut("commandFolder not a directory:" + commandFolder ,debug.debugLevel.ERROR)
@ -63,6 +63,7 @@ class commandManager():
if not os.access(commandFolder, os.R_OK):
self.env['runtime']['debug'].writeDebugOut("commandFolder not readable:" + commandFolder ,debug.debugLevel.ERROR)
return
print(commandFolder)
commandList = glob.glob(commandFolder+'*')
for command in commandList:
try:
@ -70,8 +71,11 @@ class commandManager():
fileName = fileName.split('/')[-1]
if fileName.startswith('__'):
continue
if self.env['commands'][section][fileName.upper()]:
continue
try:
if self.env['commands'][section][fileName.upper()] != None:
continue
except:
pass
if fileExtension.lower() == '.py':
command_mod = module_utils.importModule(fileName, command)
self.env['commands'][section][fileName.upper()] = command_mod.command()
@ -79,7 +83,7 @@ class commandManager():
self.env['commands'][section][fileName.upper()].initialize(self.env)
self.env['runtime']['debug'].writeDebugOut("Load command:" + section + "." + fileName.upper() ,debug.debugLevel.INFO, onAnyLevel=True)
except Exception as e:
print(e)
print(command+str(e))
self.env['runtime']['debug'].writeDebugOut("Loading command:" + command ,debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
continue

View File

@ -41,7 +41,7 @@ class screenManager():
if fixIgnoreScreens != '':
ignoreScreens.append(fixIgnoreScreens.split(','))
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
ignoreScreens.append(self.env['screenData']['autoIgnoreScreens'])
ignoreScreens.extend(self.env['screenData']['autoIgnoreScreens'])
return (screen in ignoreScreens)
def isScreenChange(self):

View File

@ -60,7 +60,7 @@ settings = {
'autoSpellCheck': False,
'spellCheckLanguage': 'en_US',
'scriptPath':'/usr/share/fenrir/scripts',
'commandPath':'/usr/share/fenrir/command',
'commandPath':'/usr/share/fenrir/commands',
},
'focus':{
'cursor': True,