コード例 #1
0
ファイル: handler.py プロジェクト: Tasssadar/xboot_netbuild
def generateConfig(req):
    try:
        conf = BuildConfig(defaultconfig)
        conf.importForm(req.form)
        return "0\n" + conf.getValuesString()
    except Exception as e:
        return "-1\nFailed to parse config!\n" + str(e);
コード例 #2
0
ファイル: handler.py プロジェクト: Tasssadar/xboot_netbuild
def buildHexFile(req):
    hash = makeConfigHash(req.form)

    ret = 0
    stderr = ""
    output = ""

    if not hasCache(hash):
        conf = None
        try:
            conf = BuildConfig(defaultconfig)
            conf.importForm(req.form)

            import builder
            ret, output, stderr = builder.build(basedir, os.path.join(cachedir, hash), conf);
        except Exception as e:
            ret = -1
            stderr = "Failed to parse config!\n" + str(e)

    res = str(ret) + "\n"
    if ret == 0:
        res += hash
    else:
        res += output + stderr
    return res
コード例 #3
0
 def __init__(self, name, layers, details):
     self.name = name
     self.layers = layers
     self.build_type = details['build_type']
     self.build_config = BuildConfig(self.build_type)
     self.start = details['start']
     self.start_comment = details['start_comment']
     self.comment = details['comment']
コード例 #4
0
    def trace_outline(self):
        """
        Moves the cursor to the northwest corner, then clockwise to each
        other corner, before returning to the starting position.
        """
        buildconfig = BuildConfig('dig')
        grid = self.layers[0].grid

        plotter = AreaPlotter(grid, buildconfig)
        plotter.expand_fixed_size_areas()  # plot cells of d(5x5) format

        ks = Keystroker(grid, buildconfig)
        keys = []

        # move to each corner beginning with NW, going clockwise, and wait
        # at each one
        lastpos = self.start
        for cornerdir in [
                Direction(d) for d in ['nw', 'ne', 'se', 'sw', 'nw']
        ]:
            (x, y) = cornerdir.delta()
            newpos = (max(0, x) * (grid.width - 1),
                      max(0, y) * (grid.height - 1))

            keys += ks.move(lastpos, newpos, allowjumps=False) + ['%']
            lastpos = newpos
        keys += ks.move(lastpos, self.start, allowjumps=False)

        # trim any pauses off the ends
        while keys and keys[0] == '%':
            keys = keys[1:]
        while keys and keys[-1] == '%':
            keys = keys[:-1]

        # if the result is no keys, return a single wait key
        keys += ['%']

        return keys