コード例 #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)
コード例 #2
0
 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
コード例 #5
0
 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
コード例 #7
0
 def __repr__(self):
     return indent(os.linesep.join([
         '- threshold: {}{}  rate: {}'.format(threshold, os.linesep, rate)
         for (threshold, rate) in zip(self.thresholds, self.rates)
         ]))
コード例 #8
0
 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)
         ]))