sys.find

Here are the examples of the python api sys.find taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

3 Source : config_utils.py
with GNU General Public License v3.0
from krahsdevil

def check_retropie_menu():
    oTree = ET.parse(ES_SYSTEMS_PRI_FILE)
    oRoot = oTree.getroot()
    try:
        for sys in oRoot.iter('system'):
            if sys.find('name').text == "retropie":
                if sys.find('path').text == RETROPIE_MENU:
                    return True
                break
        return False
    except: return False

def check_es_restart(p_lList, p_lCtrl):

2 Source : systems_check.py
with GNU General Public License v3.0
from krahsdevil

def check_xml_file(p_sFile):
    """
    Analize es_systems.cfg a check if execution string is correct in
    order to have CRT Edition integration. Also checks if any special 
    system is missing (non default system on retropie).
    sCore will be empty if the system don't require any change in 
    execution string. By default sCore will be the system but special
    systems like retropie o CRT menu has a different format of
    launching.
    """
    global oTree
    global oRoot
    global bReboot
    global lSysInfo
    bCheck = False
    oTree = ET.parse(p_sFile)
    oRoot = oTree.getroot()
    for sys in oRoot.iter('system'):
        sSystem = sys.find('name').text
        sCore = sSystem
        sFullName = sys.find('fullname').text
        sCommand = sys.find('command').text
        sTheme = sys.find('theme').text
        for item in SYSTEMS:
            if sSystem == item:
                # set checked
                SYSTEMS[sSystem]["check"] = True
                # set core name, empty if is 1CRT or Retropie
                sCore = SYSTEMS[sSystem]["core"]
                if sTheme != SYSTEMS[sSystem]["theme"]:
                    sys.find('theme').text = SYSTEMS[sSystem]["theme"]
                    lSysInfo.append(("-- CHANGED theme for %s" % \
                             sSystem, "OK"))
                    bCheck = True
        if sCore:
            sExecLine = "python3 %s " % CRT_LAUNCHER_FILE
            sExecLine += "%%ROM%% %s " % sCore
            sExecLine += "dummy"
            if sExecLine != sCommand and not "force" in sCommand :
                lSysInfo.append(("-- CHANGED exec line for %s" % \
                                 sSystem, "OK"))
                sys.find('command').text = sExecLine
                bCheck = True
    if bCheck:
        oTree.write(p_sFile)
        bReboot = True

def check_miss_systems(p_sFile):

0 Source : config_utils.py
with GNU General Public License v3.0
from krahsdevil

def hide_retropie_menu(p_bEnable = True):
    p_bCheck = False
    TMP = os.path.join(TMP_LAUNCHER_PATH, "myfile.cfg")
    os.system('cp %s %s > /dev/null 2>&1' % (ES_SYSTEMS_PRI_FILE, TMP))
    if p_bEnable: p_sPath = os.path.join(RETROPIE_HOME_PATH, "disabled.retropiemenu")
    else: p_sPath = RETROPIE_MENU
    oTree = ET.parse(TMP)
    oRoot = oTree.getroot()
    try:
        for sys in oRoot.iter('system'):
            if sys.find('name').text == "retropie":
                sys.find('path').text = p_sPath
                p_bCheck = True
                break
        if p_bCheck: oTree.write(TMP)
        os.system('sudo cp %s %s > /dev/null 2>&1' %(TMP, ES_SYSTEMS_PRI_FILE))
        os.system("sudo rm %s > /dev/null 2>&1" % TMP)
    except: return False
    return p_bCheck

def check_retropie_menu():