From bcd2700b70e8f4fdbd53e68c250012a985510cb4 Mon Sep 17 00:00:00 2001 From: gutosie Date: Tue, 23 Feb 2021 15:00:15 +0200 Subject: [PATCH] Add files via upload --- NeoBoot/files/stbbranding.py | 88 +++++++++++++++++++++--------------- NeoBoot/files/tools.py | 2 + 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/NeoBoot/files/stbbranding.py b/NeoBoot/files/stbbranding.py index 76a9842..f820425 100644 --- a/NeoBoot/files/stbbranding.py +++ b/NeoBoot/files/stbbranding.py @@ -6,8 +6,59 @@ 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 + 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='' @@ -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' diff --git a/NeoBoot/files/tools.py b/NeoBoot/files/tools.py index 8ccccf1..665f49f 100644 --- a/NeoBoot/files/tools.py +++ b/NeoBoot/files/tools.py @@ -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)