mirror of
https://github.com/gutosie/neoboot.git
synced 2025-11-02 12:25:46 +01:00
Add files via upload
This commit is contained in:
@@ -6,8 +6,59 @@ import os
|
|||||||
import time
|
import time
|
||||||
from Tools.Directories import fileExists, SCOPE_PLUGINS
|
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'):
|
def fileCheck(f, mode = 'r'):
|
||||||
return fileExists(f, mode) and f
|
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():
|
def getSupportedTuners():
|
||||||
supportedT=''
|
supportedT=''
|
||||||
@@ -114,41 +165,6 @@ def getNEO_filesystems():
|
|||||||
|
|
||||||
return neo_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
|
#typ procesora arm lub mips
|
||||||
def getCPUtype():
|
def getCPUtype():
|
||||||
cpu='UNKNOWN'
|
cpu='UNKNOWN'
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from Components.ProgressBar import ProgressBar
|
|||||||
from Components.ScrollLabel import ScrollLabel
|
from Components.ScrollLabel import ScrollLabel
|
||||||
from Components.Pixmap import Pixmap, MultiPixmap
|
from Components.Pixmap import Pixmap, MultiPixmap
|
||||||
from Components.config import *
|
from Components.config import *
|
||||||
|
from Components.PluginComponent import plugins
|
||||||
from Screens.VirtualKeyBoard import VirtualKeyBoard
|
from Screens.VirtualKeyBoard import VirtualKeyBoard
|
||||||
from Screens.MessageBox import MessageBox
|
from Screens.MessageBox import MessageBox
|
||||||
from Screens.ChoiceBox import ChoiceBox
|
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 = 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?'))
|
restartbox.setTitle(_('Restart GUI now?'))
|
||||||
|
|
||||||
|
|
||||||
def restartGUI(self, answer):
|
def restartGUI(self, answer):
|
||||||
if answer is True:
|
if answer is True:
|
||||||
self.session.open(TryQuitMainloop, 3)
|
self.session.open(TryQuitMainloop, 3)
|
||||||
|
|||||||
Reference in New Issue
Block a user