From e740f386c0f23c9db457a294bc454756841fc264 Mon Sep 17 00:00:00 2001 From: gutosie Date: Mon, 11 May 2020 15:02:44 +0300 Subject: [PATCH] vip --- NeoBoot/files/tools.py | 1444 ++++++++++++++++++++++++++++++---------- 1 file changed, 1094 insertions(+), 350 deletions(-) diff --git a/NeoBoot/files/tools.py b/NeoBoot/files/tools.py index ddecd15..df01e3b 100644 --- a/NeoBoot/files/tools.py +++ b/NeoBoot/files/tools.py @@ -1,6 +1,7 @@ -#!/usr/bin/python # -*- coding: utf-8 -*- -from __init__ import _ +# system modules + +from Plugins.Extensions.NeoBoot.__init__ import _ import codecs from enigma import getDesktop from Components.ActionMap import ActionMap @@ -11,28 +12,45 @@ from Components.Sources.List import List from Components.ConfigList import ConfigListScreen from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest from Components.config import getConfigListEntry, config, ConfigYesNo, ConfigText, ConfigSelection, NoSave -from Plugins.Extensions.NeoBoot.plugin import Plugins +from Plugins.Extensions.NeoBoot.plugin import Plugins, PLUGINVERSION, UPDATEVERSION from Plugins.Plugin import PluginDescriptor from Screens.Standby import TryQuitMainloop from Screens.MessageBox import MessageBox -from Screens.Console import Console from Screens.Screen import Screen from Tools.LoadPixmap import LoadPixmap -from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, fileExists, pathExists, createDir +from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, fileExists, pathExists, createDir, fileCheck from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen from os.path import dirname, isdir, isdir as os_isdir from enigma import eTimer -from stbbranding import getNeoLocation, getImageNeoBoot, getKernelVersionString, getBoxHostName, getCPUtype +from stbbranding import getNeoLocation, getImageNeoBoot, getKernelVersionString, getBoxHostName, getCPUtype, getBoxVuModel, getTunerModel, getCPUSoC import os import time import sys import struct, shutil -LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' +if fileExists('/etc/vtiversion.info') and fileExists('/.multinfo'): + from Screens.Console import Console +else: + from neoconsole import Console +LinkNeoBoot = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' +neoboot = getNeoLocation() + +def getDS(): + s = getDesktop(0).size() + return (s.width(), s.height()) -PLUGINVERSION = '8.01' +def isFHD(): + desktopSize = getDS() + return desktopSize[0] == 1920 -neoboot = getNeoLocation() +def isHD(): + desktopSize = getDS() + return desktopSize[0] >= 1280 and desktopSize[0] < 1920 + +def isUHD(): + desktopSize = getDS() + return desktopSize[0] >= 1920 and desktopSize[0] < 3840 + def getKernelVersion(): try: return open('/proc/version', 'r').read().split(' ', 4)[2].split('-', 2)[0] @@ -74,15 +92,23 @@ class BoundFunction: self.args = args def __call__(self): - self.fnc(*self.args) + self.fnc(*self.args) +# class MBTools(Screen): - screenwidth = getDesktop(0).size().width() - if screenwidth and screenwidth == 1920: - skin = '\n \n\t\t\n\t\t\t\n \t\t{"template": [\n \t\t\tMultiContentEntryText(pos = (50, 1), size = (820, 46), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0),\n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (4, 2), size = (66, 66), png = 1),\n \t\t\t],\n \t\t\t"fonts": [gFont("Regular", 35)],\n \t\t\t"itemHeight": 50\n \t\t}\n \t\t\n\t\t\n ' + if isFHD(): + skin = """ + + + + + + \n \t\t{"template": [\n \t\t\tMultiContentEntryText(pos = (50, 1), size = (920, 56), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0),\n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (6, 4), size = (66, 66), png = 1),\n \t\t\t],\n \t\t\t"fonts": [gFont("Regular", 35)],\n \t\t\t"itemHeight": 60\n \t\t}\n \t\t + + """ else: - skin = '\n \n\t\t\n\t\t\t\n \t\t{"template": [\n \t\t\tMultiContentEntryText(pos = (50, 1), size = (520, 36), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0),\n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (4, 2), size = (36, 36), png = 1),\n \t\t\t],\n \t\t\t"fonts": [gFont("Regular", 22)],\n \t\t\t"itemHeight": 36\n \t\t}\n \t\t\n\t\t\n ' + skin = '\n \n\t\t\n\t\t\t\n \t\t{"template": [\n \t\t\tMultiContentEntryText(pos = (50, 1), size = (520, 36), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0),\n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (4, 2), size = (36, 36), png = 1),\n \t\t\t],\n \t\t\t"fonts": [gFont("Regular", 22)],\n \t\t\t"itemHeight": 36\n \t\t}\n \t\t\n\t\t\n ' __module__ = __name__ def __init__(self, session): @@ -95,66 +121,83 @@ class MBTools(Screen): def updateList(self): self.list = [] - mypath = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' + mypath = '' +LinkNeoBoot+ '' if not fileExists(mypath + 'icons'): - mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png' + mypixmap = '' +LinkNeoBoot+ '/images/ok.png' png = LoadPixmap(mypixmap) - res = (_('Wykonaj kopi\xc4\x99 obrazu z NeoBoota'), png, 0) - self.list.append(res) - self['list'].list = self.list + res = (_ ('Make a copy of the image from NeoBoot'), png, 0) + self.list.append (res) + self ['list']. list = self.list - res = (_('Przywr\xc3\xb3\xc4\x87 kopi\xc4\x99 obrazu do NeoBoota'), png, 1) - self.list.append(res) - self['list'].list = self.list + res = (_ ('Restore a copy of the image to NeoBoot'), png, 1) + self.list.append (res) + self ['list']. list = self.list - res = (_('Menad\xc5\xbcer urz\xc4\x85dze\xc5\x84'), png, 2) - self.list.append(res) - self['list'].list = self.list + res = (_ ('Device manager'), png, 2) + self.list.append (res) + self ['list']. list = self.list - res = (_('Usu\xc5\x84 image ZIP z katalogu ImagesUpload '), png, 3) - self.list.append(res) - self['list'].list = self.list + res = (_ ('Delete image ZIP from the ImagesUpload directory'), png, 3) + self.list.append (res) + self ['list']. list = self.list - res = (_('Odinstalowanie NeoBoota'), png, 4) - self.list.append(res) - self['list'].list = self.list - - res = (_('Reinstalacja NeoBoota'), png, 5) - self.list.append(res) - self['list'].list = self.list - - res = (_('Zaktualizuj NeoBoota na wszystkich obrazach.'), png, 6) - self.list.append(res) - self['list'].list = self.list - - res = (_('Kopia Zapasowa NeoBoota'), png, 7) - self.list.append(res) - self['list'].list = self.list - - res = (_('Aktualizacja listy TV na zainstalowanych image.'), png, 8) - self.list.append(res) - self['list'].list = self.list + res = (_ ('NeoBoot Backup'), png, 4) + self.list.append (res) + self ['list']. list = self.list - res = (_('Aktualizacja IPTVPlayer na zainstalowanych image.'), png, 9) - self.list.append(res) - self['list'].list = self.list - - res = (_('Usuniecie hasla do root.'), png, 10) - self.list.append(res) - self['list'].list = self.list + res = (_ ('Uninstall NeoBoot'), png, 5) + self.list.append (res) + self ['list']. list = self.list - res = (_('Sprawdz poprawnosc instalacji neoboota'), png, 11) - self.list.append(res) - self['list'].list = self.list + res = (_ ('Reinstall NeoBoot'), png, 6) + self.list.append (res) + self ['list']. list = self.list - res = (_('Informacje NeoBoota'), png, 12) - self.list.append(res) - self['list'].list = self.list + res = (_ ('Update NeoBoot on all images.'), png, 7) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Update TV list on installed image.'), png, 8) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Update IPTVPlayer on installed image.'), png, 9) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Removing the root password.'), png, 10) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Check the correctness of neoboot installation'), png, 11) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Skin change'), png, 12) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Block or unlock skins.'), png, 13) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Mount Internal Flash'), png, 14) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Deleting languages'), png, 15) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('Supported sat tuners'), png, 16) + self.list.append (res) + self ['list']. list = self.list + + res = (_ ('NeoBoot Information'), png, 17) + self.list.append (res) + self ['list']. list = self.list - res = (_('Wspierane tunery sat'), png, 13) - self.list.append(res) - self['list'].list = self.list def KeyOk(self): self.sel = self['list'].getCurrent() @@ -168,13 +211,13 @@ class MBTools(Screen): pass if self.sel == 3 and self.session.open(MBDeleUpload): pass - if self.sel == 4 and self.session.open(UnistallMultiboot): + if self.sel == 4 and self.session.open(BackupMultiboot): pass - if self.sel == 5 and self.session.open(ReinstllNeoBoot): + if self.sel == 5 and self.session.open(UnistallMultiboot): pass - if self.sel == 6 and self.session.open(UpdateNeoBoot): + if self.sel == 6 and self.session.open(ReinstllNeoBoot): pass - if self.sel == 7 and self.session.open(BackupMultiboot): + if self.sel == 7 and self.session.open(UpdateNeoBoot): pass if self.sel == 8 and self.session.open(ListTv): pass @@ -184,25 +227,40 @@ class MBTools(Screen): pass if self.sel == 11 and self.session.open(CheckInstall): pass - if self.sel == 12 and self.session.open(MultiBootMyHelp): + if self.sel == 12 and self.session.open(SkinChange): pass - if self.sel == 13 and self.session.open(TunerInfo): + if self.sel == 13 and self.session.open(BlocUnblockImageSkin): + pass + if self.sel == 14 and self.session.open(InternalFlash): + pass + if self.sel == 15 and self.session.open(DeletingLanguages): + pass + if self.sel == 16 and self.session.open(TunerInfo): + pass + if self.sel == 17 and self.session.open(MultiBootMyHelp): pass - class MBBackup(Screen): - screenwidth = getDesktop(0).size().width() - if screenwidth and screenwidth == 1920: - skin = ' \n\t\t\n \n\n \n\n \n \n \n\t\t\t\n \n\n \n\n \n\n \n\n ' + if isFHD(): + skin = """ + + + + + + + + + """ else: - skin = ' \n\t\t\n \n\n \n\n \n \n \n\t\t\t\n \n\n\n\n \n\n ' + skin = ' \n\t\t\n \n\n \n\n \n \n \n\t\t\t\n \n\n\n\n \n\n ' def __init__(self, session): Screen.__init__(self, session) self['lab1'] = Label('') self['lab2'] = Label('') - self['lab3'] = Label(_('Wybierz obraz z kt\xc3\xb3rego chcesz zrobi\xc4\x87 kopie')) - self['key_red'] = Label(_('Kopia Zapasowa')) + self['lab3'] = Label(_('Choose the image you want to make a copy of')) + self['key_red'] = Label(_('Backup')) self['list'] = List([]) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, 'ok': self.backupImage, @@ -211,7 +269,7 @@ class MBBackup(Screen): neoboot = 'usb' elif pathExists('/media/hdd/ImageBoot'): neoboot = 'hdd' - self.backupdir = '/media/' + neoboot + '/NeoBootImageBackup' + self.backupdir = '/media/' + neoboot + '/CopyImageNEO' self.availablespace = '0' self.onShow.append(self.updateInfo) @@ -236,7 +294,7 @@ class MBBackup(Screen): f = open('/proc/mounts', 'r') for line in f.readlines(): if line.find('/hdd') != -1: - self.backupdir = '/media/' + neoboot + '/NeoBootImageBackup' + self.backupdir = '/media/' + neoboot + '/CopyImageNEO' device = '/media/' + neoboot + '' f.close() @@ -258,9 +316,9 @@ class MBBackup(Screen): f.close() os_remove('/tmp/ninfo.tmp') self.availablespace = usfree[0:-3] - strview = _('Masz zainstalowane nas\xc5\xa7\xc4\x99puj\xc4\x85ce obrazy') + strview = _('You have the following images installed') self['lab1'].setText(strview) - strview = _('Masz jeszcze wolne: ') + self.availablespace + ' MB' + strview = _('You still have free: ') + self.availablespace + ' MB' self['lab2'].setText(strview) imageslist = ['Flash'] for fn in listdir('/media/' + neoboot + '/ImageBoot'): @@ -271,18 +329,24 @@ class MBBackup(Screen): self['list'].list = imageslist def backupImage(self): + if not fileExists('/.multinfo'): + self.backupImage2() + else: + self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) + + def backupImage2(self): image = self['list'].getCurrent() if image: self.backimage = image.strip() myerror = '' if self.backimage == 'Flash': - myerror = _('Niestety nie mo\xc5\xbcna wykona\xc4\x87 kopii zapasowej z flesza t\xc4\x85 wtyczk\xc4\x85\nZainstaluj backupsuite do kopii obrazu z pamieci flesza') + myerror = _('Unfortunately you cannot backup from flash with this plugin. \nInstall backupsuite to a copy of the image from flash memory.') if int(self.availablespace) < 150: - myerror = _('Brak miejca do zrobienia kopii obrazu. Potrzebne jest 150 Mb wolnego miejsca na kopie obrazu.') + myerror = _('There is no space to make a copy of the image. You need 150 Mb of free space for copying the image.') if myerror == '': - message = _('Wykona\xc4\x87 kopi\xc4\x99 obrazu:') + image + ' teraz ?' + message = (_('Make copies of the image: %s now ?') % image) ybox = self.session.openWithCallback(self.dobackupImage, MessageBox, message, MessageBox.TYPE_YESNO) - ybox.setTitle(_('Potwierdzenie kopii zapasowej')) + ybox.setTitle(_('Backup confirmation')) else: self.session.open(MessageBox, myerror, MessageBox.TYPE_INFO) @@ -292,39 +356,51 @@ class MBBackup(Screen): neoboot = 'usb' elif pathExists('/media/hdd/ImageBoot'): neoboot = 'hdd' - cmd = "echo -e '\n\n%s '" % _('Prosz\xc4\x99 czeka\xc4\x87, NeoBoot dzia\xc5\x82a, wykonywanie kopii zapasowej moze zajac kilka chwil, proces w toku...') + cmd = "echo -e '\n\n%s '" % _('Please wait, NeoBoot is working, the backup may take a few moments, the process is in progress ...') cmd1 = '/bin/tar -cf ' + self.backupdir + '/' + self.backimage + '.tar /media/' + neoboot + '/ImageBoot/' + self.backimage + ' > /dev/null 2>&1' cmd2 = 'mv -f ' + self.backupdir + '/' + self.backimage + '.tar ' + self.backupdir + '/' + self.backimage + '.mb' - cmd3 = "echo -e '\n\n%s '" % _('NeoBoot: Kopia Zapasowa KOMPLETNA !') - self.session.open(Console, _('NeoBoot: Kopia Zapasowa Obrazu'), [cmd, + cmd3 = "echo -e '\n\n%s '" % _('NeoBoot: COMPLETE Backup!') + self.session.open(Console, _('NeoBoot: Image Backup'), [cmd, cmd1, cmd2, cmd3]) self.close() + else: + self.close() + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + class MBRestore(Screen): - __module__ = __name__ - skin = ' \n\t\n \n \n \n \n\t\t\t\n \n \n \n \n \n ' + __module__ = __name__ + skin = """ + + + + + + + + + """ - def __init__(self, session): + def __init__(self, session): Screen.__init__(self, session) - self['lab1'] = Label('') - self['lab2'] = Label('') - self['lab3'] = Label(_('Wybierz kopi\xc4\x99 kt\xc3\xb3r\xc4\x85 chcesz przywr\xc3\xb3ci\xc4\x87')) - self['key_red'] = Label(_('Restore')) - self['key_green'] = Label(_('Delete')) - self['list'] = List([]) + self['lab1'] = Label(_('Choose copy you want to restore or delete.')) + self['key_red'] = Label(_('Delete file')) + self['key_green'] = Label(_('Restore')) + self['list'] = List([]) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, 'ok': self.restoreImage, - 'red': self.restoreImage, - 'green': self.deleteback}) - self.backupdir = '' + getNeoLocation() + 'NeoBootImageBackup' - self.availablespace = '0' + 'red': self.deleteback, + 'green': self.restoreImage}) + self.backupdir = '' + getNeoLocation() + 'CopyImageNEO' self.onShow.append(self.updateInfo) def updateInfo(self): - linesdevice = open('/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location', 'r').readlines() + linesdevice = open('' +LinkNeoBoot+ '/.location', 'r').readlines() deviceneo = linesdevice[0][0:-1] device = deviceneo usfree = '0' @@ -346,10 +422,10 @@ class MBRestore(Screen): f = open('/proc/mounts', 'r') for line in f.readlines(): if line.find('/hdd') != -1: - self.backupdir = '' + getNeoLocation() + 'NeoBootImageBackup' + self.backupdir = '' + getNeoLocation() + 'CopyImageNEO' elif line.find('/usb') != -1: - self.backupdir = '' + getNeoLocation() + 'NeoBootImageBackup' - f.close() + self.backupdir = '' + getNeoLocation() + 'CopyImageNEO' + f.close() if pathExists(self.backupdir) == 0 and createDir(self.backupdir): pass if fileExists('/tmp/ninfo.tmp'): @@ -367,11 +443,7 @@ class MBRestore(Screen): f.close() os_remove('/tmp/ninfo.tmp') - self.availablespace = usfree[0:-3] - strview = _('Kopie Zapasowe znajduj\xc4\x85 si\xc4\x99 w katalogu /' + getNeoLocation() + 'NeoBootImageBackup') - self['lab1'].setText(strview) - strview = _('Ilo\xc5\x9b\xc4\x87 wolnego miejsca w Superbocie: ') + self.availablespace + ' MB' - self['lab2'].setText(strview) + imageslist = [] for fn in listdir(self.backupdir): imageslist.append(fn) @@ -379,21 +451,35 @@ class MBRestore(Screen): self['list'].list = imageslist def deleteback(self): + if not fileExists('/.multinfo'): + self.deleteback2() + else: + self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) + + def deleteback2(self): image = self['list'].getCurrent() if image: self.delimage = image.strip() - message = _('Wybierz obraz do przywr\xc3\xb3cenia lub usuni\xc4\x99cia:\n ') + image + '?' + message = (_('Software selected: %s remove ?') % image ) ybox = self.session.openWithCallback(self.dodeleteback, MessageBox, message, MessageBox.TYPE_YESNO) - ybox.setTitle(_('Potwierdzenie Usuni\xc4\x99cia')) + ybox.setTitle(_('Confirmation of Deletion...')) def dodeleteback(self, answer): if answer is True: - cmd = "echo -e '\n\n%s '" % _('SuperBoot usuwanie plik\xc3\xb3w kopi zapasowej.....') + cmd = "echo -e '\n\n%s '" % _('NeoBoot - deleting backup files .....') cmd1 = 'rm ' + self.backupdir + '/' + self.delimage - self.session.open(Console, _('SuperBoot: Pliki kopii zapasowej usuni\xc4\x99te'), [cmd, cmd1]) + self.session.open(Console, _('NeoBoot: Backup files deleted!'), [cmd, cmd1]) self.updateInfo() + else: + self.close() def restoreImage(self): + if not fileExists('/.multinfo'): + self.restoreImage2() + else: + self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) + + def restoreImage2(self): image = self['list'].getCurrent() if image: curimage = 'Flash' @@ -407,9 +493,9 @@ class MBRestore(Screen): if curimage == imagename: myerror = _('Sorry you cannot overwrite the image currently booted from. Please, boot from Flash to restore this backup.') if myerror == '': - message = _('Przed przywracaniem sprawdz czy masz wolne miejsce na swoim urz\xc4\x85dzeniu - 300Mb \nCzy chcesz przywr\xc3\xb3ci\xc4\x87 ten obraz:\n ') + image + '?' + message = (_('The required space on the device is 300 MB.\nDo you want to take this image: %s \nnow ?') % image) ybox = self.session.openWithCallback(self.dorestoreImage, MessageBox, message, MessageBox.TYPE_YESNO) - ybox.setTitle(_('Potwierdzenie Przywracania')) + ybox.setTitle(_('Restore Confirmation')) else: self.session.open(MessageBox, myerror, MessageBox.TYPE_INFO) @@ -421,7 +507,7 @@ class MBRestore(Screen): cmd2 = '/bin/tar -xf ' + self.backupdir + '/' + imagename + '.tar -C /' cmd3 = 'mv -f ' + self.backupdir + '/' + imagename + '.tar ' + self.backupdir + '/' + imagename + '.mb' cmd4 = 'sync' - cmd5 = "echo -e '\n\n%s '" % _('Superboot: Restore COMPLETE !') + cmd5 = "echo -e '\n\n%s '" % _('Neoboot: Restore COMPLETE !') self.session.open(Console, _('NeoBoot: Restore Image'), [cmd, cmd1, cmd2, @@ -429,23 +515,25 @@ class MBRestore(Screen): cmd4, cmd5]) self.close() + else: + self.close() - def myclose(self): - self.close() - - def myclose2(self, message): - self.session.open(MessageBox, message, MessageBox.TYPE_INFO) - self.close() - - + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + class MenagerDevices(Screen): __module__ = __name__ - skin = '\n\t\n\t\t' + skin = """ + + + + """ def __init__(self, session): - Screen.__init__(self, session) - self['lab1'] = Label('Uruchomic Menad\xc5\xbcer urz\xc4\x85dze\xc5\x84 ?') - self['key_red'] = Label(_('Uruchom')) + Screen.__init__(self, session) + self['lab1'] = Label(_('Start the device manager')) + self['key_red'] = Label(_('Run')) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, 'red': self.MD}) @@ -453,45 +541,117 @@ class MenagerDevices(Screen): try: from Plugins.Extensions.NeoBoot.files.devices import ManagerDevice self.session.open(ManagerDevice) -# from Plugins.Extensions.NeoBoot.files.devices import DevicesConf -# self.session.open(DevicesConf) - + except: False -class UnistallMultiboot(Screen): +class MBDeleUpload(Screen): __module__ = __name__ - skin = '\n\t\n\t\t' + skin = """ + + + + """ def __init__(self, session): Screen.__init__(self, session) - self['lab1'] = Label('Czy odinstalowa\xc4\x87 NeoBoota ?') - self['key_red'] = Label(_('Odinstaluj')) + self['lab1'] = Label(_('Are you sure you want to delete the image from the ImagesUpload directory\nIf you choose the red button on the remote control then you will delete all zip images from the ImagesUpload directory')) + self['key_red'] = Label(_('Clear')) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'red': self.usunup}) + + def usunup(self): + message = _('Do you really want to clear') + ybox = self.session.openWithCallback(self.pedeleup, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Do you really want to clear')) + + def pedeleup(self, answer): + if answer is True: + cmd = "echo -e '\n\n%s '" % _('Wait, deleting .....') + cmd1 = 'rm -r ' + getNeoLocation() + 'ImagesUpload/*.zip' + self.session.open(Console, _('Deleting downloaded image zip files ....'), [cmd, cmd1]) + self.close() + else: + self.close() + + +class BackupMultiboot(Screen): + __module__ = __name__ + skin = """ + + \n\t\t{"template": [\n\t\t\tMultiContentEntryText(pos = (50, 1), size = (620, 46), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0),\n\t\t\tMultiContentEntryPixmapAlphaTest(pos = (6, 4), size = (46, 46), png = 1),\n\t\t\t],\n\t\t\t"fonts": [gFont("dugme", 30)],\n\t\t\t"itemHeight": 46\n\t\t}\n\t\t + + + + """ + + skin = """ + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('Make complete copy NeoBoot')) + self['key_red'] = Label(_('Run')) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'red': self.gobackupneobootplugin}) + + def gobackupneobootplugin(self): + cmd = 'sh ' +LinkNeoBoot+ '/files/neobackup.sh -i' + self.session.open(Console, _('The backup will be saved to /media/neoboot. Performing ...'), [cmd]) + self.close() + + +class UnistallMultiboot(Screen): + __module__ = __name__ + skin = """ + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('Remove the plug')) + self['key_red'] = Label(_('Uninstall')) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.checkNeo, 'red': self.usun}) def usun(self): - message = _('Je\xc5\x9bli wybierzesz Tak, zostan\xc4\x85 przywr\xc3\xb3cone ustawienia obrazu pli \nMultibot zostanie tylko odinstalowany. \nBedziesz m\xc3\xb3g\xc5\x82 go zainstalowa\xc4\x87 ponownie') + if not fileExists('/.multinfo'): + self.usun2() + else: + self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) + + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + + def usun2(self): + message = _('If you choose Yes, the Multibot image settings will be restored and only uninstalled. You can reinstall it') ybox = self.session.openWithCallback(self.reinstallneoboot, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('Delete Confirmation')) def reinstallneoboot(self, answer): if answer is True: - cmd0 = "echo -e '\n\nPrzywracanie ustawie\xc5\x84.....'" - cmd = "echo -e '\n%s '" % _('Czekaj usuwam...') - cmd1 = 'rm /sbin/multinit; sleep 2' - cmd1a = "echo -e '\nNeoBoot usuwanie mened\xc5\xbcera rozruchu....'" + cmd0 = "echo -e '\nRestoring settings...\n'" + cmd = 'rm -f /etc/neoimage /etc/imageboot /etc/name' + cmd1 = 'rm /sbin/neoinit*; sleep 2' + cmd1a = "echo -e 'Removing boot manager from NeoBoot....\n'" cmd2 = 'rm /sbin/init; sleep 2' cmd3 = 'ln -sfn /sbin/init.sysvinit /sbin/init' cmd4 = 'chmod 777 /sbin/init; sleep 2' - cmd4a = "echo -e '\nNeoBoot restoring media mounts....'" - cmd6 = 'rm ' + getNeoLocation() + 'ImageBoot/.neonextboot;rm /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location; sleep 2' - cmd7 = 'rm ' + getNeoLocation() + 'ImageBoot/.Flash; rm ' + getNeoLocation() + 'ImageBoot/.version' - cmd7a = "echo -e '\n\nOdinstalowywanie neoboota...'" - cmd8 = "echo -e '\n\nPrzywracanie montowania.'" - cmd9 = "echo -e '\n\nNeoBoot odinstalowany, mozesz zrobic reinstalacje.'" - self.session.openWithCallback(self.close, Console, _('NeoBoot is reinstall...'), [cmd0, + cmd4a = "echo -e 'NeoBoot restoring media mounts...\n'" + cmd6 = 'rm -f ' + getNeoLocation() + 'ImageBoot/initneo.log ' + getNeoLocation() + 'ImageBoot/.imagedistro ' + getNeoLocation() + 'ImageBoot/.neonextboot '+ getNeoLocation() + 'ImageBoot/.updateversion '+ getNeoLocation() + 'ImageBoot/.Flash ' + getNeoLocation() + 'ImageBoot/.version ' + getNeoLocation() + 'ImageBoot/NeoInit.log ; sleep 2' + cmd7 = 'rm -f '+LinkNeoBoot+ '/.location '+LinkNeoBoot+ '/bin/install '+LinkNeoBoot+ '/bin/reading_blkid '+LinkNeoBoot+ '/files/mountpoint.sh '+LinkNeoBoot+ '/files/neo.sh '+LinkNeoBoot+ '/files/neom '+LinkNeoBoot+ '/.neo_info ' + cmd7a = "echo -e '\n\nUninstalling neoboot...\n'" + cmd8 = "echo -e '\n\nRestore mount.'" + cmd9 = "echo -e '\n\nNeoBoot uninstalled, you can do reinstallation.'" + cmd10 = "echo -e '\n\nNEOBoot Exit or Back - RESTART GUI NOW !!!'" + self.session.open(Console, _('NeoBoot is reinstall...'), [cmd0, cmd, cmd1, cmd1a, @@ -503,207 +663,233 @@ class UnistallMultiboot(Screen): cmd7, cmd7a, cmd8, - cmd9]) + cmd9, + cmd10]) + else: self.close() + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + + def checkNeo(self): + if not fileCheck(''+LinkNeoBoot+ '/.location') and not fileCheck(' ' + getNeoLocation() + 'ImageBoot/.neonextboot') : + self.restareE2() + else: + self.close() + + def restareE2(self): + self.session.open(TryQuitMainloop, 3) + class ReinstllNeoBoot(Screen): __module__ = __name__ - skin = '\n\t\n\t\t' + skin = """ + + + + """ def __init__(self, session): Screen.__init__(self, session) - self['lab1'] = Label('Przywrocic kopie NeoBoota z lokalizacji /media/neoboot ?') + self['lab1'] = Label(_('Restore copy NeoBoot')) self['key_red'] = Label(_('Backup')) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, 'red': self.reinstallMB}) - + def reinstallMB(self): - system('/bin/tar -xzvf ' + getNeoLocation() + 'NeoBoot_Backup.tar.gz -C /') - self.close() + self.session.open(ReinstllNeoBoot2) + + +class ReinstllNeoBoot2(Screen): + __module__ = __name__ + skin = """ + + + + + + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('Choose copy you want to restore or delete.')) + self['key_red'] = Label(_('Delete file')) + self['key_green'] = Label(_('Restore')) + self['list'] = List([]) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'ok': self.restoreImage, + 'green': self.restoreImage, + 'red': self.deleteback}) + self.backupdir = '' + getNeoLocation() + 'CopyNEOBoot' + self.onShow.append(self.updateInfo) + + def updateInfo(self): + self.backupdir = '' + getNeoLocation() + 'CopyNEOBoot' + if pathExists(self.backupdir) == 0 and createDir(self.backupdir): + pass + + imageslist = [] + for fn in listdir(self.backupdir): + imageslist.append(fn) + + self['list'].list = imageslist + + def deleteback(self): + image = self['list'].getCurrent() + if image: + self.delimage = image.strip() + message = (_('Software selected: %s remove ?') % image ) + ybox = self.session.openWithCallback(self.dodeleteback, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Confirmation of Deletion...')) + + def dodeleteback(self, answer): + if answer is True: + cmd = "echo -e '\n\n%s '" % _('NeoBoot - deleting backup files .....') + cmd1 = 'rm ' + self.backupdir + '/' + self.delimage + self.session.open(Console, _('NeoBoot: Backup files deleted!'), [cmd, cmd1]) + self.updateInfo() + else: + self.close() + + def restoreImage(self): + image = self['list'].getCurrent() + myerror = '' + if myerror == '': + message = (_('The required space on the device is 300 MB.\nDo you want to take this image: %s \nnow ?') % image) + ybox = self.session.openWithCallback(self.dorestoreImage, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Restore Confirmation')) + else: + self.session.open(MessageBox, myerror, MessageBox.TYPE_INFO) + + def dorestoreImage(self, answer): + image = self['list'].getCurrent() + if answer is True: + self.backimage = image.strip() + imagename = self.backimage[0:-3] + cmd = "echo -e '\n\n%s '" % _('Wait please, NeoBoot is working: ....Restore in progress....') + cmd1 = '/bin/tar -xf ' + self.backupdir + '/' + imagename + '.gz -C /' + cmd2 = "echo -e '\n\n%s '" % _('Neoboot: Restore COMPLETE !') + self.session.open(Console, _('NeoBoot: Restore Image'), [cmd, + cmd1, + cmd2]) + self.close() + else: + self.close() class UpdateNeoBoot(Screen): __module__ = __name__ - skin = '\n\t\n\t\t' + skin = """ + + + + """ def __init__(self, session): Screen.__init__(self, session) - self['lab1'] = Label('Aktualizowac neoboota na wszystkich obrazach ?') - self['key_red'] = Label(_('Zainstaluj')) + self['lab1'] = Label(_('Install neobot from flash memory to all images')) + self['key_red'] = Label(_('Install')) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, 'red': self.mbupload}) def mbupload(self): - self.session.open(MyUpgrade2) - - -class MyUpgrade2(Screen): - screenwidth = getDesktop(0).size().width() - if screenwidth and screenwidth == 1920: - skin = '\n\t\t\n' - else: - skin = '\n\t\t\n\t' - - def __init__(self, session): - Screen.__init__(self, session) - self['lab1'] = Label(_('[NeoBoot]Prosze czeka\xc4\x87, aktualizacja w toku...')) - self.activityTimer = eTimer() - self.activityTimer.timeout.get().append(self.updateInfo) - self.onShow.append(self.startShow) - - def startShow(self): - self.activityTimer.start(10) - - def updateInfo(self): - self.activityTimer.stop() - f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r') - mypath2 = f2.readline().strip() - f2.close() - if mypath2 != 'Flash': - self.myClose(_('Sorry, NeoBoot can installed or upgraded only when booted from Flash STB')) - self.close() + if not fileExists('/.multinfo'): + self.session.open(MyUpgrade2) else: - for fn in listdir('%sImageBoot' % getNeoLocation() ): - dirfile = '%sImageBoot/' % getNeoLocation() + fn - if isdir(dirfile): - target = dirfile + '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot' - cmd = 'rm -r ' + target + ' > /dev/null 2>&1' - system(cmd) - cmd = 'cp -r /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot ' + target - system(cmd) - - out = open('%sImageBoot/.version' % getNeoLocation(), 'w') - out.write(PLUGINVERSION) - out.close() - self.myClose(_('NeoBoot successfully updated. You can restart the plugin now.\nHave fun !!')) + self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) def myClose(self, message): - self.session.open(MessageBox, message, MessageBox.TYPE_INFO) - self.close() - -class MBDeleUpload(Screen): - __module__ = __name__ - skin = '\n\t\n\t\t' - - def __init__(self, session): - Screen.__init__(self, session) - self['lab1'] = Label('Czy na pewno chcesz usun\xc4\x85\xc4\x87 obraz z katalogu ImagesUpload ?\n\nJe\xc5\x9bli wybierzesz czerwony przycisk na pilocie to usuniesz wszystkie obrazy ZIP z katalogu ImagesUpload') - self['key_red'] = Label(_('Wyczy\xc5\x9b\xc4\x87')) - self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, - 'red': self.usunup}) - - def usunup(self): - message = _('Czy napewno chcesz wyczy\xc5\x9bci\xc4\x87') - ybox = self.session.openWithCallback(self.pedeleup, MessageBox, message, MessageBox.TYPE_YESNO) - ybox.setTitle(_('Czyszenie z pobranych obraz\xc3\xb3w')) - - def pedeleup(self, answer): - if answer is True: - cmd = "echo -e '\n\n%s '" % _('Czekaj usuwam.....') - cmd1 = 'rm -r ' + getNeoLocation() + 'ImagesUpload/*.zip' - self.session.open(Console, _('Usuwanie pobranych obraz\xc3\xb3w....'), [cmd, cmd1]) + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) self.close() - -class BackupMultiboot(Screen): - __module__ = __name__ - skin = '\n\t\n\t\t\n\t\t\t\n \t\t{"template": [\n \t\t\tMultiContentEntryText(pos = (50, 1), size = (520, 36), flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = 0),\n \t\t\tMultiContentEntryPixmapAlphaTest(pos = (4, 2), size = (36, 36), png = 1),\n \t\t\t],\n \t\t\t"fonts": [gFont("Regular", 22)],\n \t\t\t"itemHeight": 36\n \t\t}\n \t\t\n\t\t\n ' - - def __init__(self, session): - Screen.__init__(self, session) - self.list = [] - self['list'] = List(self.list) - self.downList() - self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk, - 'back': self.close}) - - def downList(self): - self.list = [] - mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/images/ok.png' - png = LoadPixmap(mypixmap) - res = (_('Wykonac kompletna kopie NeoBoota ?'), png, 0) - self.list.append(res) - self['list'].list = self.list - - def KeyOk(self): - self.sel = self['list'].getCurrent() - if self.sel: - self.sel = self.sel[2] - if self.sel == 0: - cmd = 'sh /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/NeoBoot.sh -i' - self.session.open(Console, _('Kopia zapasowa zostanie zapisana w lokalizacji /media/neoboot. Trwa wykonywanie....'), [cmd]) - self.close() - - -class SetPasswd(Screen): - __module__ = __name__ - skin = '\n\t\n\t\t' - - def __init__(self, session): - Screen.__init__(self, session) - self['lab1'] = Label('Czy skasowac haslo ?') - self['key_red'] = Label(_('Uruchom')) - self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, - 'red': self.passwd}) - - def passwd(self): - os.system('passwd -d root') - 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) +class MyUpgrade2(Screen): + if isFHD(): + skin = """ + + """ else: - self.close() + skin = '\n\t\t\n\t' -class ReinstallKernel(Screen): - __module__ = __name__ - skin = '\n\t\n\t\t' + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('[NeoBoot]Please wait, updating in progress ...')) + self.activityTimer = eTimer() + self.activityTimer.timeout.get().append(self.updateInfo) + self.onShow.append(self.startShow) - def __init__(self, session): - Screen.__init__(self, session) - self['lab1'] = Label('Reinstalacja j\xc4\x85dra.\n\nZainstalowa\xc4\x87 ?') - self['key_red'] = Label(_('Instalacja')) - self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, - 'red': self.InfoCheck}) + def startShow(self): + self.activityTimer.start(10) - def InfoCheck(self): - if fileExists('/.multinfo'): - if getCPUtype() == 'MIPS': - if not fileExists( '/boot/' + getBoxHostName() + '.vmlinux.gz'): - mess = _('Update available only from the image Flash.') - self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) - else: - self.kernel_update() + def updateInfo(self): + self.activityTimer.stop() + f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r') + mypath2 = f2.readline().strip() + f2.close() + if mypath2 != 'Flash': + self.myClose(_('Sorry, NeoBoot can installed or upgraded only when booted from Flash STB')) + self.close() + else: + for fn in listdir('%sImageBoot' % getNeoLocation() ): + dirfile = '%sImageBoot/' % getNeoLocation() + fn + if isdir(dirfile): + target = dirfile + '' +LinkNeoBoot+ '' + cmd = 'rm -r ' + target + ' > /dev/null 2>&1' + system(cmd) + cmd = 'cp -r ' +LinkNeoBoot+ ' ' + target + system(cmd) - elif getCPUtype() == 'ARMv7': - if not fileExists('/boot/zImage.' + getBoxHostName() + ''): - mess = _('Update available only from the image Flash.') - self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) - else: - self.kernel_update() + out = open('%sImageBoot/.version' % getNeoLocation(), 'w') + out.write(PLUGINVERSION) + out.close() + self.myClose(_('NeoBoot successfully updated. You can restart the plugin now.\nHave fun !!')) - else: - self.kernel_update() - - def kernel_update(self): - os.system('echo "Flash " > ' + getNeoLocation() + 'ImageBoot/.neonextboot') - out = open('' + getNeoLocation() + 'ImagesUpload/.kernel/used_flash_kernel', 'w') - out.write('Used Kernel: Flash') - out.close() - cmd1 = 'rm -f /home/root/*.ipk; opkg download kernel-image; sleep 2; opkg install --force-maintainer --force-reinstall --force-overwrite --force-downgrade /home/root/*.ipk; opkg configure update-modules' - self.session.open(Console, _('NeoBoot....'), [cmd1]) - self.close() + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + class ListTv(Screen): __module__ = __name__ - screenwidth = getDesktop(0).size().width() - if screenwidth and screenwidth == 1920: - skin = '\n\t\t\n' + skin = """ + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('Copy the tv list with flash on all image')) + self['key_red'] = Label(_('Install')) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'red': self.listupload}) + + def listupload(self): + if not fileExists('/.multinfo'): + self.listupload2() + else: + self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) + + def listupload2(self): + self.session.open(ListTv2) + + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + + +class ListTv2(Screen): + __module__ = __name__ + + if isFHD(): + skin = """ + + """ else: - skin = '\n\t\t\n\t' + skin = '\n\t\t\n\t' def __init__(self, session): Screen.__init__(self, session) @@ -753,11 +939,41 @@ class ListTv(Screen): class IPTVPlayer(Screen): __module__ = __name__ - screenwidth = getDesktop(0).size().width() - if screenwidth and screenwidth == 1920: - skin = '\n\t\t\n' + skin = """ + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('Copy the IPTV Player plugin from flash to all images')) + self['key_red'] = Label(_('Install')) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'red': self.IPTVPlayerUpload}) + + def IPTVPlayerUpload(self): + if not fileExists('/.multinfo'): + self.IPTVPlayerUpload2() + else: + self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) + + def IPTVPlayerUpload2(self): + self.session.open(IPTVPlayer2) + + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + +class IPTVPlayer2(Screen): + __module__ = __name__ + + if isFHD(): + skin = """ + + """ else: - skin = '\n\t\t\n\t' + skin = '\n\t\t\n\t' def __init__(self, session): Screen.__init__(self, session) @@ -796,14 +1012,19 @@ class IPTVPlayer(Screen): self.session.open(MessageBox, message, MessageBox.TYPE_INFO) self.close() + class SetPasswd(Screen): __module__ = __name__ - skin = '\n\t\n\t\t' + skin = """ + + + + """ def __init__(self, session): Screen.__init__(self, session) - self['lab1'] = Label('Czy skasowac haslo ?') - self['key_red'] = Label(_('Uruchom')) + self['lab1'] = Label(_('Delete password')) + self['key_red'] = Label(_('Start')) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, 'red': self.passwd}) @@ -818,20 +1039,31 @@ class SetPasswd(Screen): else: self.close() + class CheckInstall(Screen): __module__ = __name__ - skin = '\n\t\n\t\t' + skin = """ + + + + """ def __init__(self, session): Screen.__init__(self, session) - self['lab1'] = Label('Sprawdzanie poprawnosci zainstalwoanych modulow dla NeoBoota') - self['key_red'] = Label(_('Uruchom')) + self['lab1'] = Label(_('Checking filesystem...')) + self['key_red'] = Label(_('Start')) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, 'red': self.neocheck}) def neocheck(self): + if not fileExists('/.multinfo'): + self.neocheck2() + else: + self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) + + def neocheck2(self): try: - cmd = ' /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/module_neoboot.sh -i' + cmd = ' ' +LinkNeoBoot+ '/files/modulecheck.sh' self.session.openWithCallback(self.close, Console, _('NeoBoot....'), [cmd, cmd]) self.close() @@ -839,12 +1071,396 @@ class CheckInstall(Screen): except: False -class MultiBootMyHelp(Screen): - screenwidth = getDesktop(0).size().width() - if screenwidth and screenwidth == 1920: - skin = '\n\n' + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + + +class SkinChange(Screen): + if isFHD(): + skin = """ + + + + + + + + + """ + else: - skin = '\n\n' + skin = ' \n\n \n\n \n \n \n\t\t\t\n \n\n\n\n \n\n ' + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label('') + self['lab2'] = Label('') + self['lab3'] = Label(_('Choose the skin you want to make.')) + self['key_red'] = Label(_('Change')) + self['list'] = List([]) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.checkimageskin, + 'ok': self.SkinGO, + 'red': self.SkinGO, + '9': self.restareE2}) + + self.onShow.append(self.updateInfo) + + def updateInfo(self): + self.skindir = '' +LinkNeoBoot+ '/neoskins/' + + if pathExists(self.skindir) == 0 and createDir(self.skindir): + pass + + skinlist = ['default'] + for fn in listdir('' +LinkNeoBoot+ '/neoskins'): + dirfile = '' +LinkNeoBoot+ '/neoskins/' + fn + if os_isdir(dirfile) and skinlist.append(fn): + pass + + self['list'].list = skinlist + + + def SkinGO(self): + skin = self['list'].getCurrent() + if skin: + self.selectedskin = skin.strip() + myerror = '' + if self.selectedskin == 'default': + self.DefaultSkin() + elif myerror == '': + message = (_('Skin Change: %s now ?') % skin) + ybox = self.session.openWithCallback(self.doSkinChange, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Skin Change confirmation')) + else: + self.session.open(MessageBox, myerror, MessageBox.TYPE_INFO) + +#ln -sf "neoskins/default.py" "/usr/lib/enigma2/python/Plugins /Extensions/NeoBoot/skin.py" + def DefaultSkin(self): + cmd = "echo -e '\n\n%s '" % _('Please wait, NeoBot is working, skin change is progress...') + cmd1 = "echo -e '\n\n%s '" % _('NeoBoot: Complete Skin Change!') +# cmd2 = 'cp -r ' +LinkNeoBoot+ '/neoskins/default.py ' +LinkNeoBoot+ '/skin.py' + cmd2 = 'rm -f ' +LinkNeoBoot+ '/usedskin.p*; sleep 2' + cmd3 = 'ln -sf "neoskins/default.py" "' +LinkNeoBoot+ '/usedskin.py"' + self.session.open(Console, _('NeoBoot Skin Change'), [cmd, cmd1, cmd2, cmd3]) + + def doSkinChange(self, answer): + if answer is True: + if getBoxHostName() == 'vuultimo4k': + system('cp -r ' + LinkNeoBoot + '/images/ultimo4k.png ' + LinkNeoBoot + '/images/box.png') + elif getBoxHostName() == 'vusolo4k': + system('cp -r ' + LinkNeoBoot + '/images/solo4k.png ' + LinkNeoBoot + '/images/box.png') + elif getBoxHostName() == 'vuduo4k': + system('cp -r ' + LinkNeoBoot + '/images/duo4k.png ' + LinkNeoBoot + '/images/box.png') + elif getBoxHostName() == 'vuuno4k': + system('cp -r ' + LinkNeoBoot + '/images/uno4k.png ' + LinkNeoBoot + '/images/box.png') + elif getBoxHostName() == 'vuuno4kse': + system('cp -r ' + LinkNeoBoot + '/images/uno4kse.png ' + LinkNeoBoot + '/images/box.png') + elif getBoxHostName() == 'vuzero4kse': + system('cp -r ' + LinkNeoBoot + '/images/zero4kse.png ' + LinkNeoBoot + '/images/box.png') + elif getBoxHostName() == 'sf4008': + system('cp -r ' + LinkNeoBoot + '/images/sf4008.png ' + LinkNeoBoot + '/images/box.png') + + cmd = "echo -e '\n\n%s '" % _('Please wait, NeoBot is working, skin change is progress...') + cmd1 = 'rm -f ' +LinkNeoBoot+ '/usedskin.p*; sleep 2' + cmd2 = 'sleep 2; cp -r ' + self.skindir + '/' + self.selectedskin + '/*.py ' +LinkNeoBoot+ '/usedskin.py' + cmd3 = "echo -e '\n\n%s '" % _('NeoBoot: Complete Skin Change!') + cmd4 = "echo -e '\n\n%s '" % _('To use the new skin please restart enigma2') + self.session.open(Console, _('NeoBoot Skin Change'), [cmd, cmd1, cmd2, cmd3, cmd4]) + else: + self.close() + + def checkimageskin(self): + if fileCheck('/etc/vtiversion.info'): +# fail = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/usedskin.py' +# f = open(fail, 'r') +# content = f.read() +# f.close() +# localfile2 = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/usedskin.py' +# temp_file2 = open(localfile2, 'w') +# temp_file2.write(content.replace('selektor.png', 'slekvti.png')) +# temp_file2.close() + fail = '/usr/share/enigma2/CobaltFHD/skin.xml' + f = open(fail, 'r') + content = f.read() + f.close() + localfile2 = '/usr/share/enigma2/CobaltFHD/skin.xml' + temp_file2 = open(localfile2, 'w') + temp_file2.write(content.replace('NeoBootImageChoose', '#NeoBootImageChoose')) + temp_file2.close() + + self.restareE2() + else: + self.restareE2() + + def restareE2(self): + 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) + else: + self.close() + + +class BlocUnblockImageSkin(Screen): + __module__ = __name__ + skin = """ + + + + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('Block or unblock the neoboot skin display in the system skin.')) + self['key_red'] = Label(_('Block or unlock skins.')) + self['list'] = List([]) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.restareE2, + 'red': self.deleteback}) + self.backupdir = '/usr/share/enigma2' + self.onShow.append(self.updateInfo) + + def updateInfo(self): + self.backupdir = '/usr/share/enigma2' + if pathExists(self.backupdir) == 0 and createDir(self.backupdir): + pass + + imageslist = [] + for fn in listdir(self.backupdir): + imageslist.append(fn) + + self['list'].list = imageslist + + def deleteback(self): + image = self['list'].getCurrent() + if image: + self.delimage = image.strip() + message = (_('Select Yes to lock or No to unlock.\n %s ?') % image ) + ybox = self.session.openWithCallback(self.Block_Unlock_Skin, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Confirmation...')) + + def Block_Unlock_Skin(self, answer): + if answer is True: + fail = self.backupdir + '/' + self.delimage + '/skin.xml' + f = open(fail, 'r') + content = f.read() + f.close() + localfile2 = self.backupdir + '/' + self.delimage + '/skin.xml' + temp_file2 = open(localfile2, 'w') + temp_file2.write(content.replace('NeoBootImageChoose', 'neoBootImageChoose')) + temp_file2.close() + else: + fail = self.backupdir + '/' + self.delimage + '/skin.xml' + f = open(fail, 'r') + content = f.read() + f.close() + localfile2 = self.backupdir + '/' + self.delimage + '/skin.xml' + temp_file2 = open(localfile2, 'w') + temp_file2.write(content.replace('neoBootImageChoose', 'NeoBootImageChoose')) + temp_file2.close() + + + def restareE2(self): + 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) + else: + self.close() + + + +# else: +# self.myClose(_('Sorry, There is no skin for a neoboot')) + +# def myClose(self, message): +# self.session.open(MessageBox, message, MessageBox.TYPE_INFO) +# self.close() + + + + + +class InternalFlash(Screen): + __module__ = __name__ + skin = """ + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('Install software internal flash memory in media')) + self['key_red'] = Label(_('Start - Red')) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'red': self.mountIF}) + + def mountIF(self): + if fileExists('/.multinfo'): + self.mountinternalflash() + else: + self.myClose(_('Sorry, the operation is not possible from Flash')) + self.close() + + def mountinternalflash(self): + if fileExists('/.multinfo') and getCPUtype() == 'ARMv7': + if os.path.exists('/proc/stb/info/boxtype'): + if getBoxHostName == 'sf4008': #getCPUSoC() == 'bcm7251' + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash') + + if os.path.exists('/proc/stb/info/boxtype'): + if getBoxHostName == 'et1x000': #getCPUSoC() == 'bcm7251' or + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash') + + if os.path.exists('/proc/stb/info/boxtype'): + if getBoxHostName == 'ax51': #getCPUSoC() == 'bcm7251s' or + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash') + + if os.path.exists('/proc/stb/info/boxtype'): + if getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p3 /media/InternalFlash') + + if os.path.exists('/proc/stb/info/boxtype'): + if getBoxHostName() == 'zgemmah9s': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p7 /media/InternalFlash') + +# if os.path.exists('/proc/stb/info/boxtype'): +# if getBoxHostName() == 'zgemmah9combo': +# os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p7 /media/InternalFlash') + + if getBoxHostName == 'sf8008': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p13 /media/InternalFlash') + + if getBoxHostName == 'ax60': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p21 /media/InternalFlash') + + if getBoxHostName() == 'ustym4kpro' or getTunerModel() == 'ustym4kpro': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p13 /media/InternalFlash') + + if os.path.exists('/proc/stb/info/model'): + if getTunerModel() == 'dm900' or getCPUSoC() == 'BCM97252SSFF': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p2 /media/InternalFlash') + + if getBoxVuModel() == 'uno4kse' or getBoxVuModel() == 'uno4k' or getBoxVuModel() == 'ultimo4k' or getBoxVuModel() == 'solo4k': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash') + + if getBoxVuModel() == 'zero4k': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p7 /media/InternalFlash') + + if getBoxVuModel() == 'duo4k': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p9 /media/InternalFlash') + + if getCPUSoC() == 'bcm7252s' or getBoxHostName() == 'gbquad4k': + os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p5 /media/InternalFlash') + + #if getBoxHostName == 'osmio4k': + #os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p5 /media/InternalFlash') + + if fileExists('/media/InternalFlash/etc/init.d/neobootmount.sh'): + os.system('rm -f /media/InternalFlash/etc/init.d/neobootmount.sh;') + + self.myClose(_('Your image flash is mounted in the media location')) + + def myClose(self, message): + self.session.open(MessageBox, message, MessageBox.TYPE_INFO) + self.close() + + + +class DeletingLanguages(Screen): + __module__ = __name__ + skin = """ + + + + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('Select to delete.')) + self['key_red'] = Label(_('Delete file')) + self['list'] = List([]) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'ok': self.deleteback, + 'red': self.deleteback}) + self.backupdir = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/locale' + self.onShow.append(self.updateInfo) + + def updateInfo(self): + self.backupdir = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/locale' + if pathExists(self.backupdir) == 0 and createDir(self.backupdir): + pass + + imageslist = [] + for fn in listdir(self.backupdir): + imageslist.append(fn) + + self['list'].list = imageslist + + def deleteback(self): + image = self['list'].getCurrent() + if image: + self.delimage = image.strip() + message = (_('File: %s remove ?') % image ) + ybox = self.session.openWithCallback(self.dodeleteback, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Confirmation of Deletion...')) + + def dodeleteback(self, answer): + if answer is True: + cmd = "echo -e '\n\n%s '" % _('NeoBoot - deleting backup files .....') + cmd1 = 'rm -fR ' + self.backupdir + '/' + self.delimage + self.session.open(Console, _('NeoBoot: Backup files deleted!'), [cmd, cmd1]) + self.updateInfo() + else: + self.close() + + +class TunerInfo(Screen): + __module__ = __name__ + skin = """ + + + + """ + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = Label(_('List of supported stb.')) + self['key_red'] = Label(_('Start - Red')) + self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, + 'red': self.iNFO}) + + def iNFO(self): + try: + cmd = ' cat ' +LinkNeoBoot+ '/stbinfo' + cmd1 = '' + self.session.openWithCallback(self.close, Console, _('NeoBoot....'), [cmd, + cmd1]) + self.close() + + except: + False + + +class MultiBootMyHelp(Screen): + if isFHD(): + skin = """ + + + """ + else: + skin = '\n\n' __module__ = __name__ def __init__(self, session): @@ -861,41 +1477,169 @@ class MultiBootMyHelp(Screen): def updatetext(self): message = '' - message += 'NeoBoot Wersja ' + PLUGINVERSION + ' Enigma2\n\n' - message += 'NeoBoot opiera si\xc4\x99 na EGAMIBoot < mod by gutosie >\n\n' - message += 'Autor EGAMIBoota zezwolil na rozwijanie i edycje NeoBoot - Thanks/Dzi\xc4\x99ki\n\n' - message += 'nfidump by gutemine - Thanks/Dzi\xc4\x99ki\n\n' - message += 'ubi_reader by Jason Pruitt - Thanks/Dzi\xc4\x99ki\n\n' - message += 'T\xc5\x82umaczenie: gutosie\n\n' - message += _('Podziekowania wszystkim tu niewspomnianym za udzielenie pomocy w ulepszaniu NeoBoota \n\n') - message += _('Udanej zabawy :)\n\n') - + message += 'NeoBoot Version ' + PLUGINVERSION + ' Enigma2\n\n' + message += 'NeoBoot is based on EGAMIBoot < mod by gutosie >\n\n' + message += 'EGAMIBoot author allowed neoboot development and editing - Thanks\n\n' + message += 'nfidump by gutemine - Thanks\n\n' + message += 'ubi_reader by Jason Pruitt - Thanks\n\n' + message += 'Translation by gutosie and other people!\n\n' + message += _('Thank you to everyone not here for helping to improve NeoBoot \n\n') + message += _('Successful fun :)\n\n') self['lab1'].show() self['lab1'].setText(message) -class TunerInfo(Screen): + + +###______\\\\\\----for plugin----////_____### + +class MyHelpNeo(Screen): + if isFHD(): + skin = """ + + """ + else: + skin = """ + + """ + __module__ = __name__ - skin = '\n\t\n\t\t' + + def __init__(self, session): + Screen.__init__(self, session) + self['lab1'] = ScrollLabel('') + self['actions'] = ActionMap(['WizardActions', 'ColorActions', 'DirectionActions'], {'back': self.close, + 'ok': self.close, + 'up': self['lab1'].pageUp, + 'left': self['lab1'].pageUp, + 'down': self['lab1'].pageDown, + 'right': self['lab1'].pageDown}) + self['lab1'].hide() + self.updatetext() + + def updatetext(self): + message = _('NeoBoot Ver. ' + PLUGINVERSION + ' Enigma2\n\nDuring the entire installation process does not restart the receiver !!!\n\n') + message += _('NeoBoot Ver. updates ' + UPDATEVERSION + ' \n\n') + message = _('For proper operation NeoBota type device is required USB stick or HDD, formatted on your system files Linux ext3 or ext4..\n\n') + message += _('1. If you do not have a media formatted with the ext3 or ext4 is open to the Device Manager , select the drive and format it.\n\n') + message += _('2. Go to the device manager and install correctly hdd and usb ...\n\n') + message += _('3. Install NeoBota on the selected device.\n\n') + message += _('4. Install the needed packages...\n\n') + message += _('5. For proper installation NenoBota receiver must be connected to the Internet.\n\n') + message += _('6. In the event of a problem with the installation cancel and inform the author of the plug of a problem.\n\n') + message += _('Buy a satellite tuner in the store: http://www.expert-tvsat.com/\n') + message += _('Have fun !!!') + self['lab1'].show() + self['lab1'].setText(message) + + +class Opis(Screen): + if isFHD(): + skin = """ """ + else: + skin = """""" + __module__ = __name__ + def __init__(self, session): + Screen.__init__(self, session) + self['key_red'] = Label(_('Remove NeoBoot of STB')) + self['lab1'] = ScrollLabel('') + self['actions'] = ActionMap(['WizardActions', 'ColorActions', 'DirectionActions'], {'back': self.close, + 'red': self.delete, + 'ok': self.close, + 'up': self['lab1'].pageUp, + 'left': self['lab1'].pageUp, + 'down': self['lab1'].pageDown, + 'right': self['lab1'].pageDown}) + self['lab1'].hide() + self.updatetext() + + def updatetext(self): + message = _('NeoBoot Ver. ' + PLUGINVERSION + '\n\n') + message += _('NeoBoot Ver. updates ' + UPDATEVERSION + '\n\n') + message += _('1. Requirements: For proper operation of the device NeoBota are required USB stick or HDD.\n\n') + message += _('2. NeoBot is fully automated\n\n') + message += _('3. To install the new software in multiboot, you must send the software file compressed in zip format via ftp to the ImagesUpload directory, or download from the network.\n\n') + message += _('4. For proper installation and operation of additional image multiboot, use only the image intended for your receiver. !!!\n\n') + message += _('5. By installing the multiboot images of a different type than for your model STB DOING THIS AT YOUR OWN RISK !!!\n\n') + message += _('6. The installed to multiboot images, it is not indicated update to a newer version.\n\n') + message += _('The authors plug NeoBot not liable for damage a receiver, NeoBoota incorrect use or installation of unauthorized additions or images.!!!\n\n') + message += _('Have fun !!!') + message += _('\nCompletely uninstall NeoBota: \nIf you think NeoBot not you need it, you can uninstall it.\nTo uninstall now press the red button on the remote control.\n\n') + self['lab1'].show() + self['lab1'].setText(message) + + def delete(self): + message = _('Are you sure you want to completely remove NeoBoota of your image?\n\nIf you choose so all directories NeoBoota will be removed.\nA restore the original image settings Flash.') + ybox = self.session.openWithCallback(self.mbdelete, MessageBox, message, MessageBox.TYPE_YESNO) + ybox.setTitle(_('Removed successfully.')) + + def mbdelete(self, answer): + if answer is True: + if fileExists('/etc/fstab.org'): + system('rm -r /etc/fstab; mv /etc/fstab.org /etc/fstab') + if fileExists('/etc/init.d/volatile-media.sh.org'): + system(' mv /etc/init.d/volatile-media.sh.org /etc/init.d/volatile-media.sh; rm -r /etc/init.d/volatile-media.sh.org; chmod 755 /etc/init.d/volatile-media.sh ') + if os.path.isfile('%sImageBoot/.neonextboot' % getNeoLocation()): + os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; ' % (getNeoLocation(), getNeoLocation(), getNeoLocation()) ) + if os.path.isfile('%sImagesUpload/.kernel ' % getNeoLocation()): + os.system('rm -r %sImagesUpload/.kernel' % getNeoLocation()) + cmd = "echo -e '\n\n%s '" % _('Recovering setting....\n') + cmd1 = 'rm -R ' + LinkNeoBoot + '' + cmd2 = 'rm -R /sbin/neoinit*' + cmd3 = 'ln -sfn /sbin/init.sysvinit /sbin/init' + cmd4 = 'opkg install --force-maintainer --force-reinstall --force-overwrite --force-downgrade volatile-media; sleep 10; PATH=/sbin:/bin:/usr/sbin:/usr/bin; echo -n "Rebooting... "; reboot -d -f' + self.session.open(Console, _('NeoBot was removed !!! \nThe changes will be visible only after complete restart of the receiver.'), [cmd, + cmd1, + cmd2, + cmd3, + cmd4,]) + self.close() + else: + self.close() + +class ReinstallKernel(Screen): + __module__ = __name__ + + skin = """ + + + + """ def __init__(self, session): Screen.__init__(self, session) - self['lab1'] = Label('NeoBoot: Lista wspieranych modeli STB.') - self['key_red'] = Label(_('Uruchom - Red')) + self['lab1'] = Label(_('Re-installing the kernel. \n\nInstall?')) + self['key_red'] = Label(_('Installation')) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'back': self.close, - 'red': self.iNFO}) - - def iNFO(self): - try: - cmd = ' cat /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/stbinfo' - cmd1 = '' - self.session.openWithCallback(self.close, Console, _('NeoBoot....'), [cmd, - cmd1]) - self.close() + 'red': self.InfoCheck}) - except: - False + def InfoCheck(self): + if fileExists('/.multinfo'): + if getCPUtype() == 'MIPS': + if not fileExists( '/boot/' + getBoxHostName() + '.vmlinux.gz'): + mess = _('Update available only from the image Flash.') + self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) + else: + self.kernel_update() + elif getCPUtype() == 'ARMv7': + if not fileExists('/boot/zImage.' + getBoxHostName() + ''): + mess = _('Update available only from the image Flash.') + self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) + else: + self.kernel_update() + + else: + self.kernel_update() + + def kernel_update(self): + os.system('echo "Flash " > ' + getNeoLocation() + 'ImageBoot/.neonextboot') + out = open('' + getNeoLocation() + 'ImagesUpload/.kernel/used_flash_kernel', 'w') + out.write('Used Kernel: Flash') + out.close() + cmd1 = 'rm -f /home/root/*.ipk; opkg download kernel-image; sleep 2; opkg install --force-maintainer --force-reinstall --force-overwrite --force-downgrade /home/root/*.ipk; opkg configure update-modules; rm -f /home/root/*.ipk' + self.session.open(Console, _('NeoBoot....'), [cmd1]) + self.close() def myboot(session, **kwargs):