def __init__(self, servicePath, oeMain):
     self.winOeCon = oeWindows.mainWindow('service-LibreELEC-Settings-mainWindow.xml', oe.__cwd__, 'Default', oeMain=oe, isChild=True)
     self.servicePath = servicePath
     oe.dictModules['connmanNetworkConfig'] = self
     self.service_properties = dbus_connman.service_get_properties(servicePath)
     for entry in sorted(self.datamap):
         for (key, value) in self.datamap[entry].items():
             if self.struct[value]['type'] == 'Boolean':
                 if key in self.service_properties:
                     self.struct[value]['settings'][value]['value'] = self.service_properties[key]
             if self.struct[value]['type'] == 'Dictionary':
                 if key in self.service_properties:
                     for setting in self.struct[value]['settings']:
                         if setting in self.service_properties[key]:
                             self.struct[value]['settings'][setting]['value'] = self.service_properties[key][setting]
             if self.struct[value]['type'] == 'Array':
                 if key in self.service_properties:
                     for setting in self.struct[value]['settings']:
                         if int(setting) < len(self.service_properties[key]):
                             self.struct[value]['settings'][setting]['value'] = self.service_properties[key][int(setting)]
     self.winOeCon.show()
     for strEntry in sorted(self.struct, key=lambda x: self.struct[x]['order']):
         dictProperties = {
             'modul': 'connmanNetworkConfig',
             'listTyp': oe.listObject['list'],
             'menuLoader': 'menu_loader',
             'category': strEntry,
             }
         self.winOeCon.addMenuItem(self.struct[strEntry]['name'], dictProperties)
     self.winOeCon.doModal()
     del self.winOeCon
     del oe.dictModules['connmanNetworkConfig']
示例#2
0
def openWizard():
    global winOeMain, __cwd__, __oe__
    try:
        winOeMain = oeWindows.wizard('service-LibreELEC-Settings-wizard.xml', __cwd__, 'Default', oeMain=__oe__)
        winOeMain.doModal()
        winOeMain = oeWindows.mainWindow('service-LibreELEC-Settings-mainWindow.xml', __cwd__, 'Default', oeMain=__oe__)  # None
    except Exception as e:
        dbg_log('oe::openWizard', 'ERROR: (' + repr(e) + ')')
def openWizard():
    global winOeMain, __cwd__, __oe__
    try:
        winOeMain = oeWindows.wizard('service-LibreELEC-Settings-wizard.xml', __cwd__, 'Default', oeMain=__oe__)
        winOeMain.doModal()
        winOeMain = oeWindows.mainWindow('service-LibreELEC-Settings-mainWindow.xml', __cwd__, 'Default', oeMain=__oe__)  # None
    except Exception, e:
        dbg_log('oe::openWizard', 'ERROR: (' + repr(e) + ')')
def openWizard():
    global winOeMain, __cwd__, __oe__
    try:
        winOeMain = oeWindows.wizard('wizard.xml', __cwd__, 'Default', oeMain=__oe__)
        winOeMain.doModal()
        winOeMain = oeWindows.mainWindow('mainWindow.xml', __cwd__, 'Default', oeMain=__oe__)  # None
    except Exception, e:
        xbmc.executebuiltin('Dialog.Close(busydialog)')
        dbg_log('oe::openWizard', 'ERROR: (' + repr(e) + ')')
示例#5
0
def openWizard():
    global winOeMain, __cwd__, __oe__
    try:
        winOeMain = oeWindows.wizard('service-OpenELEC-Settings-wizard.xml', __cwd__, 'Default', oeMain=__oe__)
        winOeMain.doModal()
        winOeMain = oeWindows.mainWindow('service-OpenELEC-Settings-mainWindow.xml', __cwd__, 'Default', oeMain=__oe__)  # None
    except Exception, e:
        xbmc.executebuiltin('Dialog.Close(busydialog)')
        dbg_log('oe::openWizard', 'ERROR: (' + repr(e) + ')')
示例#6
0
def openConfigurationWindow():
    global winOeMain, __cwd__, __oe__, dictModules
    try:
        PINmatch = False
        PINnext = 1000
        PINenable = read_setting('system', 'pinlock_enable')
        if PINenable == "0" or PINenable == None:
            PINmatch = True
        if PINenable == "1":
            PINfail = read_setting('system', 'pinlock_timeFail')
            if PINfail:
                nowTime = time.time()
                PINnext = (nowTime - float(PINfail))
            if PINnext >= 300:
                PINtry = 4
                while PINmatch == False:
                    if PINtry > 0:
                        PINlock = xbmcDialog.input(_(32233),
                                                   type=xbmcgui.INPUT_NUMERIC)
                        if PINlock == '':
                            break
                        else:
                            storedPIN = read_setting('system', 'pinlock_pin')
                            PINmatch = verify_password(storedPIN, PINlock)
                            if PINmatch == False:
                                PINtry -= 1
                                if PINtry > 0:
                                    xbmcDialog.ok(_(32234),
                                                  str(PINtry) + _(32235))
                    else:
                        timeFail = time.time()
                        write_setting('system', 'pinlock_timeFail',
                                      str(timeFail))
                        xbmcDialog.ok(_(32234), _(32236))
                        break
            else:
                timeLeft = "{0:.2f}".format((300 - PINnext) / 60)
                xbmcDialog.ok(_(32237), timeLeft + _(32238))
        if PINmatch == True:
            winOeMain = oeWindows.mainWindow(
                'service-LibreELEC-Settings-mainWindow.xml',
                __cwd__,
                'Default',
                oeMain=__oe__)
            winOeMain.doModal()
            for strModule in dictModules:
                dictModules[strModule].exit()
            winOeMain = None
            del winOeMain
        else:
            pass

    except Exception, e:
        dbg_log('oe::openConfigurationWindow', 'ERROR: (' + repr(e) + ')')
示例#7
0
def openConfigurationWindow():
    global winOeMain, __cwd__, __oe__, dictModules
    try:
        winOeMain = oeWindows.mainWindow('service-LibreELEC-Settings-mainWindow.xml', __cwd__, 'Default', oeMain=__oe__)
        winOeMain.doModal()
        for strModule in dictModules:
            dictModules[strModule].exit()
        winOeMain = None
        del winOeMain
    except Exception, e:
        dbg_log('oe::openConfigurationWindow', 'ERROR: (' + repr(e) + ')')
def openConfigurationWindow():
    global winOeMain, __cwd__, __oe__, dictModules
    try:
        winOeMain = oeWindows.mainWindow('mainWindow.xml', __cwd__, 'Default', oeMain=__oe__)
        winOeMain.doModal()
        for strModule in dictModules:
            dictModules[strModule].exit()
        winOeMain = None
        del winOeMain
    except Exception, e:
        xbmc.executebuiltin('Dialog.Close(busydialog)')
        dbg_log('oe::openConfigurationWindow', 'ERROR: (' + repr(e) + ')')
示例#9
0
def openConfigurationWindow():
    global winOeMain, __cwd__, __oe__, dictModules, PIN
    try:
        match = True

        if PIN.isEnabled():
            match = False

            if PIN.isDelayed():
                timeleft = PIN.delayRemaining()
                timeleft_mins, timeleft_secs = divmod(timeleft, 60)
                timeleft_hours, timeleft_mins = divmod(timeleft_mins, 60)
                xbmcDialog.ok(_(32237),
                              _(32238) % (timeleft_mins, timeleft_secs))
                return

            while PIN.attemptsRemaining() > 0:
                lockcode = xbmcDialog.numeric(0, _(32233), bHiddenInput=True)
                if lockcode == '':
                    break

                if PIN.verify(lockcode):
                    match = True
                    PIN.success()
                    break

                PIN.fail()

                if PIN.attemptsRemaining() > 0:
                    xbmcDialog.ok(
                        _(32234),
                        '%d %s' % (PIN.attemptsRemaining(), _(32235)))

            if not match and PIN.attemptsRemaining() <= 0:
                xbmcDialog.ok(_(32234), _(32236))
                return

        if match == True:
            winOeMain = oeWindows.mainWindow(
                'service-LibreELEC-Settings-mainWindow.xml',
                __cwd__,
                'Default',
                oeMain=__oe__)
            winOeMain.doModal()
            for strModule in dictModules:
                dictModules[strModule].exit()
            winOeMain = None
            del winOeMain

    except Exception as e:
        dbg_log('oe::openConfigurationWindow', 'ERROR: (' + repr(e) + ')')
示例#10
0
def openConfigurationWindow():
    global winOeMain, __cwd__, __oe__, dictModules
    try:
        winOeMain = oeWindows.mainWindow('mainWindow.xml',
                                         __cwd__,
                                         'Default',
                                         oeMain=__oe__)
        winOeMain.doModal()
        for strModule in dictModules:
            dictModules[strModule].exit()
        winOeMain = None
        del winOeMain
    except Exception, e:
        xbmc.executebuiltin('Dialog.Close(busydialog)')
        dbg_log('oe::openConfigurationWindow', 'ERROR: (' + repr(e) + ')')
示例#11
0
############################################################################################
# Base Environment
############################################################################################

os_release_data = get_os_release()
DISTRIBUTION = os_release_data[0]
VERSION = os_release_data[1]
ARCHITECTURE = os_release_data[2]
BUILD = os_release_data[3]
DOWNLOAD_DIR = '/storage/downloads'
XBMC_USER_HOME = os.environ.get('XBMC_USER_HOME', '/storage/.kodi')
CONFIG_CACHE = os.environ.get('CONFIG_CACHE', '/storage/.cache')
USER_CONFIG = os.environ.get('USER_CONFIG', '/storage/.config')
TEMP = '%s/temp/' % XBMC_USER_HOME
winOeMain = oeWindows.mainWindow('service-LibreELEC-Settings-mainWindow.xml',
                                 __cwd__,
                                 'Default',
                                 oeMain=__oe__)
if os.path.exists('/etc/machine-id'):
    SYSTEMID = load_file('/etc/machine-id')
else:
    SYSTEMID = os.environ.get('SYSTEMID', '')

############################################################################################

try:
    configFile = '%s/userdata/addon_data/service.libreelec.settings/oe_settings.xml' % XBMC_USER_HOME
    if not os.path.exists('%s/userdata/addon_data/service.libreelec.settings' %
                          XBMC_USER_HOME):
        if os.path.exists('%s/userdata/addon_data/service.openelec.settings' %
                          XBMC_USER_HOME):
            shutil.copytree(
示例#12
0
sys.path.append(xbmc.translatePath(os.path.join(__cwd__, 'resources', 'lib')))
sys.path.append(
    xbmc.translatePath(os.path.join(__cwd__, 'resources', 'lib', 'modules')))

## set default encoding

encoding = locale.getpreferredencoding(do_setlocale=True)
reload(sys)
sys.setdefaultencoding(encoding)

## load oeSettings modules

import oeWindows

winOeMain = oeWindows.mainWindow('mainWindow.xml',
                                 __cwd__,
                                 'Default',
                                 oeMain=__oe__)

xbmc.log('## OpenELEC Addon ## ' + str(__addon__.getAddonInfo('version')))


def dbg_log(source, text, level=4):
    xbmc.log('## OpenELEC Addon ## ' + source + ' ## ' + text, level)
    xbmc.log(traceback.format_exc())


def set_language(language):

    global WinOeSelect, winOeMain, __addon__, __cwd__, __oe__, _

    time.sleep(0.3)
示例#13
0
############################################################################################
# Base Environment
############################################################################################

os_release_data = get_os_release()
DISTRIBUTION = os_release_data[0]
VERSION = os_release_data[1]
ARCHITECTURE = os_release_data[2]
BUILD = os_release_data[3]
DOWNLOAD_DIR = '/storage/downloads'
XBMC_USER_HOME = os.environ.get('XBMC_USER_HOME', '/storage/.kodi')
CONFIG_CACHE = os.environ.get('CONFIG_CACHE', '/storage/.cache')
USER_CONFIG = os.environ.get('USER_CONFIG', '/storage/.config')
TEMP = '%s/temp/' % XBMC_USER_HOME
winOeMain = oeWindows.mainWindow('mainWindow.xml', __cwd__, 'Default', oeMain=__oe__)
if os.path.exists('/etc/machine-id'):
    SYSTEMID = load_file('/etc/machine-id')
else:
    SYSTEMID = os.environ.get('SYSTEMID', '')

############################################################################################

try:
    configFile = '%s/userdata/addon_data/service.libreelec.settings/oe_settings.xml' % XBMC_USER_HOME
    if not os.path.exists('%s/userdata/addon_data/service.libreelec.settings' % XBMC_USER_HOME):
        os.makedirs('%s/userdata/addon_data/service.libreelec.settings' % XBMC_USER_HOME)
    if not os.path.exists('%s/services' % CONFIG_CACHE):
        os.makedirs('%s/services' % CONFIG_CACHE)
except:
    pass
    def __init__(self, servicePath, oeMain):
        self.struct = {
            'AutoConnect': {
                'order': 1,
                'name': 32110,
                'type': 'Boolean',
                'menuLoader': 'menu_network_configuration',
                'settings': {
                    'AutoConnect': {
                        'order': 1,
                        'name': 32109,
                        'value': '',
                        'type': 'bool',
                        'dbus': 'Boolean',
                        'action': 'set_value',
                    }
                },
            },
            'IPv4': {
                'order': 2,
                'name': 32111,
                'type': 'Dictionary',
                'settings': {
                    'Method': {
                        'order': 1,
                        'name': 32113,
                        'value': '',
                        'type': 'multivalue',
                        'dbus': 'String',
                        'values': [
                            'dhcp',
                            'manual',
                            'off',
                        ],
                        'action': 'set_value',
                    },
                    'Address': {
                        'order': 2,
                        'name': 32114,
                        'value': '',
                        'type': 'ip',
                        'dbus': 'String',
                        'parent': {
                            'entry': 'Method',
                            'value': ['manual'],
                        },
                        'action': 'set_value',
                        'notempty': True,
                    },
                    'Netmask': {
                        'order': 3,
                        'name': 32115,
                        'value': '',
                        'type': 'ip',
                        'dbus': 'String',
                        'parent': {
                            'entry': 'Method',
                            'value': ['manual'],
                        },
                        'action': 'set_value',
                        'notempty': True,
                    },
                    'Gateway': {
                        'order': 4,
                        'name': 32116,
                        'value': '',
                        'type': 'ip',
                        'dbus': 'String',
                        'parent': {
                            'entry': 'Method',
                            'value': ['manual'],
                        },
                        'action': 'set_value',
                        'notempty': True,
                    },
                },
            },
            'IPv6': {
                'order': 3,
                'name': 32112,
                'type': 'Dictionary',
                'settings': {
                    'Method': {
                        'order': 1,
                        'name': 32113,
                        'value': '',
                        'type': 'multivalue',
                        'dbus': 'String',
                        'values': [
                            'auto',
                            'manual',
                            '6to4',
                            'off',
                        ],
                        'action': 'set_value',
                    },
                    'Address': {
                        'order': 2,
                        'name': 32114,
                        'value': '',
                        'type': 'text',
                        'dbus': 'String',
                        'parent': {
                            'entry': 'Method',
                            'value': ['manual'],
                        },
                        'action': 'set_value',
                    },
                    'PrefixLength': {
                        'order': 4,
                        'name': 32117,
                        'value': '',
                        'type': 'text',
                        'dbus': 'Byte',
                        'parent': {
                            'entry': 'Method',
                            'value': ['manual'],
                        },
                        'action': 'set_value',
                    },
                    'Gateway': {
                        'order': 3,
                        'name': 32116,
                        'value': '',
                        'type': 'text',
                        'dbus': 'String',
                        'parent': {
                            'entry': 'Method',
                            'value': ['manual'],
                        },
                        'action': 'set_value',
                    },
                    'Privacy': {
                        'order': 5,
                        'name': 32118,
                        'value': '',
                        'type': 'multivalue',
                        'dbus': 'String',
                        'parent': {
                            'entry': 'Method',
                            'value': ['manual'],
                        },
                        'values': [
                            'disabled',
                            'enabled',
                            'prefered',
                        ],
                        'action': 'set_value',
                    },
                },
            },
            'Nameservers': {
                'order': 4,
                'name': 32119,
                'type': 'Array',
                'settings': {
                    '0': {
                        'order': 1,
                        'name': 32120,
                        'value': '',
                        'type': 'ip',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                    '1': {
                        'order': 2,
                        'name': 32121,
                        'value': '',
                        'type': 'ip',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                    '2': {
                        'order': 3,
                        'name': 32122,
                        'value': '',
                        'type': 'ip',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                },
            },
            'Timeservers': {
                'order': 6,
                'name': 32123,
                'type': 'Array',
                'settings': {
                    '0': {
                        'order': 1,
                        'name': 32124,
                        'value': '',
                        'type': 'text',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                    '1': {
                        'order': 2,
                        'name': 32125,
                        'value': '',
                        'type': 'text',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                    '2': {
                        'order': 3,
                        'name': 32126,
                        'value': '',
                        'type': 'text',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                },
            },
            'Domains': {
                'order': 5,
                'name': 32127,
                'type': 'Array',
                'settings': {
                    '0': {
                        'order': 1,
                        'name': 32128,
                        'value': '',
                        'type': 'text',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                    '1': {
                        'order': 2,
                        'name': 32129,
                        'value': '',
                        'type': 'text',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                    '2': {
                        'order': 3,
                        'name': 32130,
                        'value': '',
                        'type': 'text',
                        'dbus': 'String',
                        'action': 'set_value_checkdhcp',
                    },
                },
            },
        }

        self.datamap = {
            0: {
                'AutoConnect': 'AutoConnect'
            },
            1: {
                'IPv4': 'IPv4'
            },
            2: {
                'IPv4.Configuration': 'IPv4'
            },
            3: {
                'IPv6': 'IPv6'
            },
            4: {
                'IPv6.Configuration': 'IPv6'
            },
            5: {
                'Nameservers': 'Nameservers'
            },
            6: {
                'Nameservers.Configuration': 'Nameservers'
            },
            7: {
                'Domains': 'Domains'
            },
            8: {
                'Domains.Configuration': 'Domains'
            },
            9: {
                'Timeservers': 'Timeservers'
            },
            10: {
                'Timeservers.Configuration': 'Timeservers'
            },
        }
        self.winOeCon = oeWindows.mainWindow(
            'service-LibreELEC-Settings-mainWindow.xml',
            oe.__cwd__,
            'Default',
            oeMain=oe,
            isChild=True)
        self.servicePath = servicePath
        oe.dictModules['connmanNetworkConfig'] = self
        self.service_properties = dbus_connman.service_get_properties(
            servicePath)
        for entry in sorted(self.datamap):
            for (key, value) in self.datamap[entry].items():
                if self.struct[value]['type'] == 'Boolean':
                    if key in self.service_properties:
                        self.struct[value]['settings'][value][
                            'value'] = self.service_properties[key]
                if self.struct[value]['type'] == 'Dictionary':
                    if key in self.service_properties:
                        for setting in self.struct[value]['settings']:
                            if setting in self.service_properties[key]:
                                self.struct[value]['settings'][setting][
                                    'value'] = self.service_properties[key][
                                        setting]
                if self.struct[value]['type'] == 'Array':
                    if key in self.service_properties:
                        for setting in self.struct[value]['settings']:
                            if int(setting) < len(
                                    self.service_properties[key]):
                                self.struct[value]['settings'][setting][
                                    'value'] = self.service_properties[key][
                                        int(setting)]
        self.winOeCon.show()
        for strEntry in sorted(self.struct,
                               key=lambda x: self.struct[x]['order']):
            dictProperties = {
                'modul': 'connmanNetworkConfig',
                'listTyp': oe.listObject['list'],
                'menuLoader': 'menu_loader',
                'category': strEntry,
            }
            self.winOeCon.addMenuItem(self.struct[strEntry]['name'],
                                      dictProperties)
        self.winOeCon.doModal()
        del self.winOeCon
        del oe.dictModules['connmanNetworkConfig']
示例#15
0
############################################################################################
# Base Environment
############################################################################################

os_release_data = get_os_release()
DISTRIBUTION = os_release_data[0]
VERSION = os_release_data[1]
ARCHITECTURE = os_release_data[2]
BUILD = os_release_data[3]
DOWNLOAD_DIR = '/storage/downloads'
XBMC_USER_HOME = os.environ.get('XBMC_USER_HOME', '/storage/.kodi')
CONFIG_CACHE = os.environ.get('CONFIG_CACHE', '/storage/.cache')
USER_CONFIG = os.environ.get('USER_CONFIG', '/storage/.config')
TEMP = '%s/temp/' % XBMC_USER_HOME
winOeMain = oeWindows.mainWindow('service-OpenELEC-Settings-mainWindow.xml', __cwd__, 'Default', oeMain=__oe__)
if os.path.exists('/etc/machine-id'):
    SYSTEMID = load_file('/etc/machine-id')
else:
    SYSTEMID = os.environ.get('SYSTEMID', '')

############################################################################################

try:
    configFile = '%s/userdata/addon_data/service.openelec.settings/oe_settings.xml' % XBMC_USER_HOME
    if not os.path.exists('%s/userdata/addon_data/service.openelec.settings' % XBMC_USER_HOME):
        os.makedirs('%s/userdata/addon_data/service.openelec.settings' % XBMC_USER_HOME)
    if not os.path.exists('%s/services' % CONFIG_CACHE):
        os.makedirs('%s/services' % CONFIG_CACHE)
except:
    pass
示例#16
0
os_release_data = get_os_release()
DISTRIBUTION = os_release_data[0]
VERSION = os_release_data[1]
ARCHITECTURE = os_release_data[2]
BUILD = os_release_data[3]
PROJECT = os_release_data[4]
DEVICE = os_release_data[5]
BUILDER_NAME = os_release_data[6]
BUILDER_VERSION = os_release_data[7]
DOWNLOAD_DIR = '/storage/downloads'
XBMC_USER_HOME = os.environ.get('XBMC_USER_HOME', '/storage/.kodi')
CONFIG_CACHE = os.environ.get('CONFIG_CACHE', '/storage/.cache')
USER_CONFIG = os.environ.get('USER_CONFIG', '/storage/.config')
TEMP = '%s/temp/' % XBMC_USER_HOME
winOeMain = oeWindows.mainWindow('service-banditOS-Settings-mainWindow.xml',
                                 __cwd__,
                                 'Default',
                                 oeMain=__oe__)
if os.path.exists('/etc/machine-id'):
    SYSTEMID = load_file('/etc/machine-id')
else:
    SYSTEMID = os.environ.get('SYSTEMID', '')

if PROJECT == 'RPi':
    RPI_CPU_VER = execute('vcgencmd otp_dump 2>/dev/null | grep 30: | cut -c8',
                          get_result=1).replace('\n', '')
else:
    RPI_CPU_VER = ''

BOOT_STATUS = load_file('/storage/.config/boot.status')

############################################################################################