예제 #1
0
def enableOnboardPiboyControllerInESInput():
    uid = 1000
    gid = 1000

    # in ES input
    pathEsInput = tools.EMULATIONSTATION_CONFIG_FOLDER + 'es_input.cfg'

    # check if config file exits
    if (not os.path.exists(pathEsInput)):
        return -1

    pathPiboyEsInput = tools.EMULATIONSTATION_CONFIG_FOLDER + 'piboy_es_input.cfg'

    # check if config file exits
    if (not os.path.exists(pathPiboyEsInput)):
        #print(pathPiboyEsInput + " is not exists")
        return -1

    treeOptions = ET.parse(pathPiboyEsInput)
    inputConfigPiboy = treeOptions.getroot()

    esInput = ET.parse(pathEsInput)
    inputList = esInput.getroot()

    already_here = False
    for inputConfig in inputList.iter('inputConfig'):
        if inputConfig.get("deviceName") == tools.PIBOY_CONTROLLER_NAME:
            already_here = True

    if not already_here:
        inputList.insert(1, inputConfigPiboy)
        tools.indent(inputList)
        esInput.write(pathEsInput, encoding="utf-8", xml_declaration=True)
 def __repr__(self):
     return os.linesep.join([
         os.linesep.join(["{}:",
                          "{}"]).format(name,
                                        indent(repr(value))).encode('utf-8')
         for name, value in self._children.iteritems()
     ])
예제 #3
0
파일: ast.py 프로젝트: Werkov/urbi
def visit(nodes, const):
    """Return a string to declare the visit methods for the 'nodes'.
  If 'const' is True, then these are const visits.
  If 'const' is False, then these are non const visits.
  Otherwise use 'const' as the macro to invoke the list upon."""
    if const == True:
        res = "CONST_VISITOR_VISIT_NODES"
    elif const == False:
        res = "VISITOR_VISIT_NODES"
    else:
        res = const
    width = len(res)
    res += "(\n"
    # The list of nodes to override.
    list = ""
    for node in nodes:
        list += " (" + node.name + ")\n"
    list += ")\n"
    res += tools.indent(width, list)
    return res
예제 #4
0
파일: ast.py 프로젝트: ondrapCZE/urbi
def visit(nodes, const):
    """Return a string to declare the visit methods for the 'nodes'.
  If 'const' is True, then these are const visits.
  If 'const' is False, then these are non const visits.
  Otherwise use 'const' as the macro to invoke the list upon."""
    if const == True:
        res = "CONST_VISITOR_VISIT_NODES"
    elif const == False:
        res = "VISITOR_VISIT_NODES"
    else:
        res = const
    width = len(res)
    res += "(\n"
    # The list of nodes to override.
    list = ''
    for node in nodes:
        list += " (" + node.name + ")\n"
    list += ")\n"
    res += tools.indent(width, list)
    return res
 def __repr__(self):
     return os.linesep.join(
         ['-' + indent(repr(bracket))[1:] for bracket in self.brackets])
예제 #6
0
파일: stmt.py 프로젝트: Neppord/py2py
 def handle_body(self, body, *a, **k):
   body = (self.visit(stmt, *a, **k) for stmt in body)
   body = chain.from_iterable(body)
   body = indent(body, self.level)
   return body
 def __repr__(self):
     return indent(os.linesep.join([
         '- threshold: {}{}  rate: {}'.format(threshold, os.linesep, rate)
         for (threshold, rate) in zip(self.thresholds, self.rates)
         ]))
 def __repr__(self):
     from .parameters import indent  # Need to import here to avoid a circular dependency
     return indent(os.linesep.join([
         '- threshold: {}{}  amount: {}'.format(threshold, os.linesep, amount)
         for (threshold, amount) in zip(self.thresholds, self.amounts)
         ]))