def updateGenericScript(self, ignored=None):
        runs = ExtendedParameter.findParam(ExtendedParameter, 'runs', self.traceParams)
        atraces = ExtendedParameter.findParam(ExtendedParameter, 'atraces', self.traceParams)
        strace = ExtendedParameter.findParam(ExtendedParameter, 'strace', self.traceParams)
        ri = ExtendedParameter.findParam(ExtendedParameter, 'reportinterval', self.traceParams)

        #print "runs = %d\natraces= %d\nstrace = %d\n"%(runs.value(), atraces.value(), strace.value())

        if (runs.value() * atraces.value() + strace.value()) > (self.traceMax):
            solv = (self.traceMax - strace.value()) / runs.value()
            solv = int(solv)
            atraces.setValue(solv)
            atraces.setLimits((1, solv))
            self.singleEmit = True
        else:
            lim = (1, self.traceMax)
            #WORK-AROUND: need to emit an extra sigLimitsChanged???
            if atraces.setLimits(lim) is None and self.singleEmit:
                self.singleEmit = False
                atraces.sigLimitsChanged.emit(atraces, lim)

        pointrng = (self.findParam('startpoint', self.pointsParams).value(), self.findParam('endpoint', self.pointsParams).value())

        self.addFunction("init", "setTraceStart", "%d" % strace.value())
        self.addFunction("init", "setTracesPerAttack", "%d" % atraces.value())
        self.addFunction("init", "setIterations", "%d" % runs.value())
        self.addFunction("init", "setReportingInterval", "%d" % ri.value())
        self.addFunction("init", "setPointRange", "(%d,%d)" % (pointrng[0], pointrng[1]))
    def updateGenericScript(self, ignored=None):
        runs = ExtendedParameter.findParam(ExtendedParameter, 'runs',
                                           self.traceParams)
        atraces = ExtendedParameter.findParam(ExtendedParameter, 'atraces',
                                              self.traceParams)
        strace = ExtendedParameter.findParam(ExtendedParameter, 'strace',
                                             self.traceParams)
        ri = ExtendedParameter.findParam(ExtendedParameter, 'reportinterval',
                                         self.traceParams)

        #print "runs = %d\natraces= %d\nstrace = %d\n"%(runs.value(), atraces.value(), strace.value())

        if (runs.value() * atraces.value() + strace.value()) > (self.traceMax):
            solv = (self.traceMax - strace.value()) / runs.value()
            solv = int(solv)
            atraces.setValue(solv)
            atraces.setLimits((1, solv))
            self.singleEmit = True
        else:
            lim = (1, self.traceMax)
            #WORK-AROUND: need to emit an extra sigLimitsChanged???
            if atraces.setLimits(lim) is None and self.singleEmit:
                self.singleEmit = False
                atraces.sigLimitsChanged.emit(atraces, lim)

        pointrng = (self.findParam('startpoint', self.pointsParams).value(),
                    self.findParam('endpoint', self.pointsParams).value())

        self.addFunction("init", "setTraceStart", "%d" % strace.value())
        self.addFunction("init", "setTracesPerAttack", "%d" % atraces.value())
        self.addFunction("init", "setIterations", "%d" % runs.value())
        self.addFunction("init", "setReportingInterval", "%d" % ri.value())
        self.addFunction("init", "setPointRange",
                         "(%d,%d)" % (pointrng[0], pointrng[1]))
    def setTraceLimits(self, traces, points):
        self.setGenericPointRange(0, points, setlimits=True)
        self.traceMax = traces

        self.addFunction("init", "setPointRange", "(%d,%d)" % (0, points))

        # self.addFunction("init", "setTraceStart", "%d" % 0)
        # self.addFunction("init", "setTracesPerAttack", "%d" % traces)
        # self.addFunction("init", "setIterations", "%d" % 1)

        strace = ExtendedParameter.findParam(ExtendedParameter, 'strace', self.traceParams)
        ExtendedParameter.findParam(ExtendedParameter, 'runs', self.traceParams).setValue(1)
        atrace = ExtendedParameter.findParam(ExtendedParameter, 'atraces', self.traceParams)

        strace.setValue(0)
        strace.setLimits((0,traces))
        atrace.setValue(traces)
        atrace.setLimits((1, traces))

        self.traceLimitsChanged.emit(traces, points)
    def setTraceLimits(self, traces, points):
        self.setGenericPointRange(0, points, setlimits=True)
        self.traceMax = traces

        self.addFunction("init", "setPointRange", "(%d,%d)" % (0, points))

        # self.addFunction("init", "setTraceStart", "%d" % 0)
        # self.addFunction("init", "setTracesPerAttack", "%d" % traces)
        # self.addFunction("init", "setIterations", "%d" % 1)

        strace = ExtendedParameter.findParam(ExtendedParameter, 'strace',
                                             self.traceParams)
        ExtendedParameter.findParam(ExtendedParameter, 'runs',
                                    self.traceParams).setValue(1)
        atrace = ExtendedParameter.findParam(ExtendedParameter, 'atraces',
                                             self.traceParams)

        strace.setValue(0)
        strace.setLimits((0, traces))
        atrace.setValue(traces)
        atrace.setLimits((1, traces))

        self.traceLimitsChanged.emit(traces, points)