finish remove unneeded returns, import debug to everything, add header

This commit is contained in:
chrys
2016-09-19 22:15:58 +02:00
parent b6178fa933
commit 010b9b4e06
94 changed files with 541 additions and 33 deletions

View File

@ -1,7 +1,12 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
import importlib.util
import glob, os, time
from utils import debug
from core import debug
class commandManager():
def __init__(self):

View File

@ -1,4 +1,10 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
import time

View File

@ -0,0 +1,61 @@
#!/usr/bin/python
# Debugger module for the Fenrir screen reader.
from enum import Enum
from datetime import datetime
class debugLevel(Enum):
DEACTIVE = 0
ERROR = 1
WARNING = 2
INFO = 3
def __int__(self):
return self.value
def __str__(self):
return self.name
class debug():
def __init__(self, fileName='/var/log/fenrir.log'):
self._fileName = fileName
self._file = None
self._fileOpened = False
def __del__(self):
try:
self.closeDebugFile()
except:
pass
def openDebugFile(self, fileName = ''):
self._fileOpened = False
if fileName != '':
self._fileName = fileName
if self._fileName != '':
self._file = open(self._fileName,'a')
self._fileOpened = True
def writeDebugOut(self, environment, text, level = debugLevel.DEACTIVE):
if environment['runtime']['settingsManager'].getSettingAsInt(environment, 'general','debugLevel') < int(level):
if self._fileOpened:
self.closeDebugFile()
return
else:
if not self._fileOpened:
self.openDebugFile()
self._file.write(str(level) +' ' + str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')
) + ': ' + text + '\n')
def closeDebugFile(self):
if not self._fileOpened:
return False
if self._file != None:
self._file.close()
self._fileOpened = False
return True
def getDebugFile(self):
return self._fileName
def setDebugFile(self, fileName):
self.closeDebugFile()
self._fileName = fileName

View File

@ -1,5 +1,10 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
from core import settings
from core import runtime
from core import screenData

View File

@ -1,4 +1,10 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
generalInformation = {
'running': True,

View File

@ -1,4 +1,10 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
import time
input = {

View File

@ -1,7 +1,11 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
import time
from utils import debug
from core import debug
from core import inputEvent
class inputManager():

View File

@ -1,5 +1,10 @@
#!/bin/python
from utils import debug
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
class outputManager():
def __init__(self):

View File

@ -1,4 +1,10 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
runtime = {
'speechDriver': None,

View File

@ -1,5 +1,10 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
import time
screenData = {

View File

@ -1,6 +1,11 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
import time
from utils import debug
class screenManager():
def __init__(self):

View File

@ -1,6 +1,10 @@
#!/bin/python
# -*- coding: utf-8 -*-
from utils import debug
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
settings = {
'sound': {

View File

@ -1,4 +1,8 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
import importlib.util
import os
@ -9,7 +13,7 @@ from core import commandManager
from core import screenManager
from core import environment
from core.settings import settings
from utils import debug
from core import debug
class settingsManager():
def __init__(self):