Add files via upload

This commit is contained in:
gutosie
2021-02-23 15:00:15 +02:00
committed by GitHub
parent 0bc31fab7b
commit bcd2700b70
2 changed files with 54 additions and 36 deletions

View File

@@ -6,9 +6,60 @@ import os
import time
from Tools.Directories import fileExists, SCOPE_PLUGINS
LogFileObj = None
def Log(param = ''):
global LogFileObj
#first close object if exists
if param.lower() in ['open','write','append','close']:
if LogFileObj is not None:
LogFileObj.close()
if LogFileObj.closed:
LogFileObj = None
try:
with open('/tmp/NeoBoot.log','a') as f:
f.write('LogFile closed properly\n')
f.close()
except Exception:
print("ERROR closing LogFile!!!")
else:
print("ERROR closing LogFile!!!")
#second create object if does not exist
if LogFileObj is None:
if param.lower() in ['open','write']:
LogFileObj = open(LogFile, "w")
elif param.lower() in ['append']:
LogFileObj = open(LogFile, "a")
elif param.lower() in ['close']:
pass
elif param.lower() in ['flush']:
LogFileObj.flush()
return LogFileObj
def clearMemory():
with open("/proc/sys/vm/drop_caches", "w") as f:
f.write("1\n")
f.close()
def LogCrashGS(line):
log_file = open('%sImageBoot/neoboot.log' % getNeoLocation() , 'a')
log_file.write(line)
log_file.close()
def fileCheck(f, mode = 'r'):
return fileExists(f, mode) and f
# if not IsImageName():
# from Components.PluginComponent import plugins
# plugins.reloadPlugins()
def IsImageName():
if fileExists("/etc/issue"):
for line in open("/etc/issue"):
if "BlackHole" in line or "vuplus" in line:
return True
return False
def getSupportedTuners():
supportedT=''
if os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/stbinfo.cfg'):
@@ -114,41 +165,6 @@ def getNEO_filesystems():
return neo_filesystems
def Log(param = ''):
global LogFileObj
#first close object if exists
if param.lower() in ['open','write','append','close']:
if LogFileObj is not None:
LogFileObj.close()
if LogFileObj.closed:
LogFileObj = None
try:
with open('/tmp/NeoBoot.log','a') as f:
f.write('LogFile closed properly\n')
f.close()
except Exception:
print("ERROR closing LogFile!!!")
else:
print("ERROR closing LogFile!!!")
#second create object if does not exist
if LogFileObj is None:
if param.lower() in ['open','write']:
LogFileObj = open(LogFile, "w")
elif param.lower() in ['append']:
LogFileObj = open(LogFile, "a")
elif param.lower() in ['close']:
pass
elif param.lower() in ['flush']:
LogFileObj.flush()
return LogFileObj
def clearMemory():
with open("/proc/sys/vm/drop_caches", "w") as f:
f.write("1\n")
f.close()
###############################################
#typ procesora arm lub mips
def getCPUtype():
cpu='UNKNOWN'

View File

@@ -14,6 +14,7 @@ from Components.ProgressBar import ProgressBar
from Components.ScrollLabel import ScrollLabel
from Components.Pixmap import Pixmap, MultiPixmap
from Components.config import *
from Components.PluginComponent import plugins
from Screens.VirtualKeyBoard import VirtualKeyBoard
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
@@ -1366,6 +1367,7 @@ class SkinChange(Screen):
restartbox = self.session.openWithCallback(self.restartGUI, MessageBox, _('GUI needs a restart.\nDo you want to Restart the GUI now?'), MessageBox.TYPE_YESNO)
restartbox.setTitle(_('Restart GUI now?'))
def restartGUI(self, answer):
if answer is True:
self.session.open(TryQuitMainloop, 3)