def setValue(self, value, deltaT, optimal):
        global Options

        try:
            self.value = value
            deg = math.degrees(self.value)
            #~ otherdeg = math.degrees(othervalue)
            #~ diff = deg - otherdeg
            ac.setText(self.valueLabel, "{0:.3f}°".format(deg))
            #~ text = getGripFactor(Options["dcamber0"], Options["dcamber1"], value)
            #~ ac.setText(self.valueLabel,"{0:.1f}%".format(text)

            self.color = getColor(deg, optimal)
            self.serie.append({"value": deg, "color": self.color})

            serieSum = 0
            for s in self.serie:
                serieSum += s["value"]
            self.avgValue = serieSum / len(self.serie)
            ac.setFontColor(self.avgValueLabel, self.color['r'],
                            self.color['g'], self.color['b'], self.color['a'])
            ac.setText(self.avgValueLabel, "{0:.3f}°".format(self.avgValue))
        except Exception:
            ac.log("CamberExtravaganza ERROR: setValue(): %s" %
                   traceback.format_exc())
Beispiel #2
0
 def onValidateInput(self, string):
     text = ac.getText(self.textInput)
     ac.setText(self.textInput, "")
     ac.setFocus(self.textInput, 1)
     if len(text) > 0:
         if ac.sendChatMessage(text) == -1:
             self.delayedChat = text
Beispiel #3
0
def acUpdate(deltaT):
    global l_velocity, last_rec, f, first
    curr_milliseconds = time.time() * 1000

    if curr_milliseconds - last_rec >= 250:
        if first:
            first = False
        else:
            f.write(',')
    
        last_rec = curr_milliseconds
        
        timestamp = datetime.utcnow()
        
        acceleration_g = ac.getCarState(0, acsys.CS.AccG)
        local_angular_velocity = ac.getCarState(0, acsys.CS.LocalAngularVelocity)
        
        ac.setText(l_velocity, "Velocity: {}".format(acceleration_g))   

        f.write('\n\t("0x610-0", "' + str(clamp(acceleration_g[0], -16, 16)) + '", "' + str(timestamp) + '"),')
        f.write('\n\t("0x610-1", "' + str(clamp(acceleration_g[1], -16, 16)) + '", "' + str(timestamp) + '"),')
        f.write('\n\t("0x610-2", "' + str(clamp(acceleration_g[2], -16, 16)) + '", "' + str(timestamp) + '"),')
        f.write('\n\t("0x611-0", "' + str(local_angular_velocity[0]) + '", "' + str(timestamp) + '"),')
        f.write('\n\t("0x611-1", "' + str(local_angular_velocity[1]) + '", "' + str(timestamp) + '"),')
        f.write('\n\t("0x611-2", "' + str(local_angular_velocity[2]) + '", "' + str(timestamp) + '")')
Beispiel #4
0
def acMain(ac_version):
    global appWindow, label1, logPrefix, appName, cfg, ui_enableButton
    ac.console(logPrefix + "acMain")
    try:
        appWindow = ac.newApp(appName)

        cfg = Configuration()
        cfg.load()

        ac.setTitle(appWindow, "")
        ac.setSize(appWindow, 400, 200)
        ac.drawBorder(appWindow, 0)
        ac.setBackgroundOpacity(appWindow, 0)

        ac.addRenderCallback(appWindow, onRender)

        ui_enableButton = ac.addButton(appWindow, "Enable")
        ac.setPosition(ui_enableButton, 0, 30)
        ac.setSize(ui_enableButton, 70, 30)
        ac.addOnClickedListener(ui_enableButton, onEnableButtonClicked)

        label1 = ac.addLabel(appWindow, "____")
        ac.setPosition(label1, 0, 65)

        if cfg.enable > 0:
            ac.setText(ui_enableButton, "Disable")
            startTelemetry()

        ac.console(logPrefix + "Initialized")
    except:
        printExceptionInfo("acMain")

    return appName
Beispiel #5
0
def acUpdate(delta_t):
    ac.setBackgroundOpacity(toe_app, 0)
    ac.setBackgroundOpacity(rpm_app, 0)

    rpm = ac.getCarState(0, acsys.CS.RPM)
    boost = ac.getCarState(0, acsys.CS.TurboBoost)
    fuel = simInfo.physics.fuel
    ac.setText(rpm_label, str(round(rpm)) + "\n" + str(round(boost, 3)) + "\n" + str(round(fuel, 1)))

    value_fl = ac.getCarState(0, acsys.CS.ToeInDeg, acsys.WHEELS.FL)
    value_fr = ac.getCarState(0, acsys.CS.ToeInDeg, acsys.WHEELS.FR)
    value_rl = ac.getCarState(0, acsys.CS.ToeInDeg, acsys.WHEELS.RL)
    value_rr = ac.getCarState(0, acsys.CS.ToeInDeg, acsys.WHEELS.RR)

    toeP(prev_fl, value_fl)
    toeP(prev_fr, value_fr)
    toeP(prev_rl, value_rl)
    toeP(prev_rr, value_rr)

    ac.setText(
        toe_label,
        toeSl(prev_fl, value_fl)
        + "\t"
        + toeSr(prev_fr, value_fr)
        + "\n"
        + toeSl(prev_rl, value_rl)
        + "\t"
        + toeSr(prev_rr, value_rr),
    )
Beispiel #6
0
def acUpdate(deltaT):
    global l_lapcount, lapcount, l_laptime, laptime

    # Don't write anything to the console from here unless it's in an if statement - it causes a crash, deltaT must
    # be approx every ms

    # Update current lap time in app window
    laptime = (ac.getCarState(0, acsys.CS.LapTime)) / 1000
    ac.setText(l_laptime, "Current lap (s): {}".format(laptime))

    # if statement using difference between lapcount and the laps output from AC to record data

    laps = ac.getCarState(0, acsys.CS.LapCount)

    if laps > lapcount:
        # Uses the difference between laps and lap count to limit recording to once per lap
        lapcount = laps
        ac.setText(l_lapcount, "Laps Completed: {}".format(lapcount))

        # Write last lap data to csv
        last_lap_raw = ((ac.getCarState(0, acsys.CS.LastLap))) / 1000
        ac.console("**Last_lap recorded")
        last_lap_m = last_lap_raw // 60
        last_lap_s = last_lap_raw % 60
        ac.console("**Last_lap split into minutes and seconds")
        with open('stintoutputfile.csv', 'a') as f:
            f.write("{},{:.0f}:{:.3f}\n".format(lapcount, last_lap_m,
                                                last_lap_s))
            ac.console("** stint tracker: lap written to file")
            ac.console("{},{:.0f}:{:.3f}\n".format(lapcount, last_lap_m,
                                                   last_lap_s))
Beispiel #7
0
def getDriverInformation(detectionArea):
    global labelStorage, appPosX, appPosY, spinner_y_offset, fov_setting
    triangle = Triangle(detectionArea[0], detectionArea[1], detectionArea[2])
    setLabel = 0
    for x in range(ac.getCarsCount()):
        posX, posZ, posY = ac.getCarState(x, acsys.CS.WorldPosition)
        if triangle.isInside((posX, posY)) and x != 0:
            vect_x = posX - detectionArea[0][0]
            vect_y = posY - detectionArea[0][1]
            distance = math.sqrt(math.pow(vect_x, 2) + math.pow(vect_y, 2))
            newPosition = getRenderPosition(x, detectionArea, (posX, posY))
            ac.setText(labelStorage[setLabel], ac.getDriverName(x))
            fov_angle = ac.getValue(fov_setting)
            xPos = (((newPosition * windowSizeX) / fov_angle) - appPosX)
            yOffset = ac.getValue(spinner_y_offset)
            yPos = (((windowSizeY / 2) - 20) - appPosY) + int(yOffset)
            fontSize = (10 *
                        (1 /
                         (distance / 100))) * (ac.getValue(scale_factor) / 10)
            ac.setPosition(labelStorage[setLabel], xPos, yPos)
            ac.setFontSize(labelStorage[setLabel], fontSize)
            setLabel += 1

    for z in range(ac.getCarsCount() - setLabel):
        ac.setText(labelStorage[setLabel + z], "")
Beispiel #8
0
def acUpdate(ms):
    global BEST_LOGGED_LAP, LAP_HISTORY, UPDATE_DELTA, CURRENT_LAP_VALID, LAP_VALID_INDICATOR

    if ACTIVE:
        if CURRENT_LAP_VALID and info.physics.numberOfTyresOut > TIRES_THRESHOLD:
            ac.setText(LAP_VALID_INDICATOR, 'Dirty')
            CURRENT_LAP_VALID = False

        #UPDATE_DELTA += ms
        #if UPDATE_DELTA < UPDATE_THRESHOLD:
        #    return
        #UPDATE_DELTA = 0

        last_lap = ac.getCarState(DRIVER_ID_SELF, acsys.CS.LastLap)
        valid = CURRENT_LAP_VALID and not ac.getCarState(
            DRIVER_ID_SELF, acsys.CS.LapInvalidated)

        if last_lap and (not LAP_HISTORY or not last_lap == LAP_HISTORY[-1]):
            ac.console('Last lap: %s%s' %
                       (last_lap, '' if valid else ' (invalid)'))

            reportLap({
                'driver': DRIVER,
                'track': TRACK,
                'car': CAR,
                'lap': last_lap
            })

            refreshLapDisplay()

            # reset lap tracking
            ac.setText(LAP_VALID_INDICATOR, 'Clean')
            CURRENT_LAP_VALID = True
            LAP_HISTORY.append(last_lap)
Beispiel #9
0
def setDelta(label, delta):
    ac.setText(label, deltaToString(delta))

    if delta >= redAt:
        ac.setFontColor(label, 1, 0, 0, 1)
    elif delta <= greenAt:
        ac.setFontColor(label, 0, 1, 0, 1)
    else:
        if deltaColor == "yellow":
            if delta > 0:
                # color factor [0..1]
                colorFactor = float(delta)/redAt
                ac.setFontColor(label, 1, 1-colorFactor, 0, 1)
            else:
                # color factor [0..1]
                colorFactor = float(delta)/greenAt
                ac.setFontColor(label, 1-colorFactor, 1, 0, 1)

        elif deltaColor == "white":
            if delta > 0:
                # color factor [0..1]
                colorFactor = float(delta)/redAt
                ac.setFontColor(label, 1, 1-colorFactor, 1-colorFactor, 1)
            else:
                # color factor [0..1]
                colorFactor = float(delta)/greenAt
                ac.setFontColor(label, 1-colorFactor, 1, 1-colorFactor, 1)
Beispiel #10
0
def FuelEvent(x):
    global FuelSelection,amount,Gas

    amount = ac.getValue(FuelSelection)
    ac.setText(label3,"{}".format(round(amount)))
    Gas = ac.getText(label3)
    WriteData()
Beispiel #11
0
def onChatMessage(message, author) :
    global messages, lines, maxLines, currentText

    currentText = 1
    messages.append([author, message])
    if len(messages) > maxLines:
        messages = messages[len(messages)-maxLines:]

    for i in range(0, maxLines):
        if i < len(messages):
            msg = messages[len(messages)-1-i]
            scale = abs(float(-2))
            n_width = 14*len(msg[0])/scale
            m_width = 14*len(msg[1])/scale

            ac.setText(lines[maxLines-1-i][1], msg[1])
            ac.setSize(lines[maxLines-1-i][0], n_width, 14*1.4)
            ac.setSize(lines[maxLines-1-i][1], m_width, 14*1.4)
            if msg[0].strip().find(driver) > -1:
                ac.setFontColor(lines[maxLines-1-i][0], 0, 1, 0, 1)
            else:
                ac.setFontColor(lines[maxLines-1-i][0], random.random(), random.random(), random.random(), 1)
            ac.setFontColor(lines[maxLines-1-i][1], 1, 1, 1, 1)
            ac.setVisible(lines[maxLines-1-i][0], 1)
            ac.setVisible(lines[maxLines-1-i][1], 1)
            ac.setPosition(lines[maxLines-1-i][0], 0, ac.getPosition(lines[maxLines-1-i][0])[1])
            ac.setFontAlignment(lines[maxLines-1-i][0], "left")
            ac.setPosition(lines[maxLines-1-i][1], n_width+5, ac.getPosition(lines[maxLines-1-i][1])[1])
            ac.setFontAlignment(lines[maxLines-1-i][1], "left")
            ac.setText(lines[maxLines-1-i][0], msg[0]+":")
def rainStrengthDown(*args):
    try:
        ac.ext_rainParamsAdjust(-0.1, 0.0)
    except:
        ac.setText(
            debug, "AccExtRain: Shaders Patch not active? : \n" +
            traceback.format_exc())
def rainWiperSpeedUp(*args):
    try:
        ac.ext_rainParamsAdjust(0.0, 1.0)
    except:
        ac.setText(
            debug, "AccExtRain: Shaders Patch not active? : \n" +
            traceback.format_exc())
Beispiel #14
0
def acUpdate(delta_t):
    global error, timer, day_offset, gWrapDebugText, gAppsize, gHideBG, gHideWeather
    timer += delta_t
    day_offset += speed * delta_t
    if timer > 0.075:
        timer = 0.0
        if abs(day_offset) > 1:
            try:
                ac.ext_weatherTimeOffset(24 * 60 * 60 * day_offset / abs(day_offset))
            except:
                ac.log("AccExtWeatherFX: Unexpected error:" + traceback.format_exc())
            day_offset = 0
        if error < 1:
            try:
                if not gHideWeather:
                    s = ac.ext_weatherDebugText()
                    s = s.replace('current day:', ' > current day:              ')
                    if gWrapDebugText==True:
                        s = '\n'.join(s.strip() for s in re.findall(r'.{1,80}(?:\s+|$)', s))
                        s = s.replace('>>> Sol weather: v', '\n>>> Sol weather: v')
                    ac.setText(label, s)
                if gHideBG==True:
                    ac.setBackgroundOpacity(app,0)
                    ac.drawBorder(app,0)
            except:
                error = error + 1
                ac.log("AccExtWeatherFX: Unexpected error:" + traceback.format_exc())
                ac.setText(label, "Shaders patch not installed? Error: \n" + traceback.format_exc())
    def updateLaps(self, lapsData):
        self.__clear_labels()

        for i, lapData in enumerate(lapsData):
            if i >= len(self.labels):
                break

            lapLabels = self.labels[i]

            time = lapData["time"]
            lap = lapData["lap"]

            lapHeaderText = "#{:2d} {:02d}:{:02d}.{:03d}".format(
                lap, int(time / 60000), int(time / 1000 % 60),
                int(time % 1000))
            ac.setText(lapLabels[0], lapHeaderText)

            for j, splitData in enumerate(lapData["splits"]):
                if j >= len(lapLabels) - 1:
                    break

                time = splitData["time"]
                splitText = "<{:3d}\r\n{:02d}.{:02d}\r\n {:3d}>".format(
                    int(splitData["enter_speed"]), int(time / 1000),
                    int(time % 1000 / 10), int(splitData["exit_speed"]))
                ac.setText(lapLabels[j + 1], splitText)
Beispiel #16
0
    def set_text(self, text):
        """Set label text, making use of set pre/postfixes.

        Args:
            text (str): Label text.
        """
        text = self.prefix + text + self.postfix
        ac.setText(self.id, text)
Beispiel #17
0
 def update(self, state):
     value = int(getattr(state, self.valueName))
    
     h = value // 3600
     m = (value - 3600*h) // 60
     s = (value - 3600*h - 60*m)
     disp = (("{0}:{1:02d}:{2:02d}".format(h,m,s)))
     ac.setText(self.label, disp)
Beispiel #18
0
 def mark_left_pits(self):
     if self.out or not self.pit: return
     self.pit = False
     if LeaderboardRow.update_type == INFO_TYPE.POSITIONS:
         ac.setVisible(self.positionChangeLabel, 1)
     if self.driverId == 0:
         ac.setText(self.infoLabel, "Interval")
     ac.setFontColor(self.infoLabel, 0.86, 0.86, 0.86, 1)
    def draw(self, data, delta_t: float) -> None:
        psi = data.tire_p
        ac.setText(self.__lb, "{:3.1f} psi".format(psi))

        color = self.__calc.interpolate_color(psi)
        ac.setFontColor(self.__lb, color[0], color[1], color[2], color[3])
        self._back.color = color
        self._draw(Pressure.texture_id)
Beispiel #20
0
def getNotification():
    global Notify, NotificationLabel, StatusLabel
    try:
        Notify = box.notification('186810231:AAGvhq85_lqUb3wPOStvazULUsmN5ET37gM')
        ac.setText(NotificationLabel, Notify)
    except:
        ac.log('EpicRace: No internet connection')
        Status = "No internet connection"
        ac.setText(StatusLabel, Status)
Beispiel #21
0
def getNotification():
    global Notify, NotificationLabel, StatusLabel
    try:
        Notify = box.notification('243075740:AAEuscXHE-VaQCwZuWpytMzmC3Iwhopub6E')
        ac.setText(NotificationLabel, Notify)
    except:
        ac.log('BoxRadio: No internet connection')
        Status = "No internet connection"
        ac.setText(StatusLabel, Status)
Beispiel #22
0
def CheckNewUpdate():
    global Status, StatusLabel, branch
    try:
        Status = box.github_newupdate('Marocco2/BoxRadio', branch)
        ac.setText(StatusLabel, Status)
    except:
        ac.log('BoxRadio: No internet connection')
        Status = "No internet connection"
        ac.setText(StatusLabel, Status)
Beispiel #23
0
	def setText(self, text, hidden=False):
		self.text = text
		if hidden :
			ac.setText(self.label, "")
			self.isTextVisible.setValue(False)
		else:
			ac.setText(self.label, self.text)
			self.isTextVisible.setValue(True)
		return self
Beispiel #24
0
def CheckNewUpdate():
    global Status, StatusLabel, branch
    try:
        Status = box.github_newupdate('Marocco2/BoxRadio', branch)
        ac.setText(StatusLabel, Status)
    except:
        ac.log('BoxRadio: No internet connection')
        Status = "No internet connection"
        ac.setText(StatusLabel, Status)
Beispiel #25
0
def set_drs_penalty(totalPenalty):
    global drsPenaltyLabel, drsPenaltyBackgroundLabel
    if totalPenalty > 1:
        ac.setText(drsPenaltyLabel, "Penalty: +%ds" % totalPenalty)
        ac.setVisible(drsPenaltyLabel, 1)
        ac.setVisible(drsPenaltyBackgroundLabel, 1)
    else:
        ac.setVisible(drsPenaltyLabel, 0)
        ac.setVisible(drsPenaltyBackgroundLabel, 0)
Beispiel #26
0
	def animate(self):
		#adjust size +1
		self.adjustParam("w").adjustParam("h")		
		#adjust position +3
		self.adjustParam("x").adjustParam("y")	
		#adjust background
		self.adjustParam("br").adjustParam("bg").adjustParam("bb").adjustParam("o")		
		#adjust colors + 0.02
		self.adjustParam("r").adjustParam("g").adjustParam("b").adjustParam("a")
			
		#commit changes
		if self.params["x"].hasChanged() or self.params["y"].hasChanged():
			ac.setPosition(self.label, self.params["x"].value, self.params["y"].value)
		if self.params["w"].hasChanged() or self.params["h"].hasChanged():
			ac.setSize(self.label, self.params["w"].value, self.params["h"].value)
			if self.params["h"].value == 0:
				self.isVisible.setValue(False)
			else:
				self.isVisible.setValue(True)
		if self.params["br"].hasChanged() or self.params["bg"].hasChanged() or self.params["bb"].hasChanged():
			ac.setBackgroundColor(self.label, self.params["br"].value, self.params["bg"].value, self.params["bb"].value)			
			if self.f_params["o"].value > 0:			
				ac.setBackgroundOpacity(self.label, self.params["o"].value)
		if self.params["o"].hasChanged():	
			if self.params["o"].value == 0:
				self.isVisible.setValue(False)
			else:
				self.isVisible.setValue(True)
			changed=self.isVisible.hasChanged()
			if changed and self.params["o"].value > 0:
				self.setVisible(1)  
			elif changed:
				self.setVisible(0)
			#fg opacity
			ac.setBackgroundOpacity(self.label, self.params["o"].value)
			if self.params["o"].value >= 0.4 :
				self.isTextVisible.setValue(True)
			else:
				self.isTextVisible.setValue(False)
			if self.isTextVisible.hasChanged():
				if self.isTextVisible.value:
					ac.setText(self.label, self.text)
				else:
					ac.setText(self.label, "")
					
		if self.params["r"].hasChanged() or self.params["g"].hasChanged() or self.params["b"].hasChanged() or self.params["a"].hasChanged():
			ac.setFontColor(self.label, self.params["r"].value, self.params["g"].value, self.params["b"].value, self.params["a"].value)				
			if self.params["a"].value == 0:
				self.isVisible.setValue(False)
			else:
				self.isVisible.setValue(True)
			changed=self.isVisible.hasChanged()
			if changed and self.params["a"].value > 0:
				self.setVisible(1)  
			elif changed:
				self.setVisible(0)
def acUpdate(deltaT):

    global l_lapcount, lapcount

    laps = ac.getCarState(0, acsys.CS.LapCount)

    # updating lap count
    if laps > lapcount:
        lapcount = laps
        ac.setText(l_lapcount, "Laps: {}".format(lapcount))
Beispiel #28
0
 def mark_out(self):
     if self.out: return
     self.out = True
     ac.setVisible(self.positionLabel, 0)
     ac.setVisible(self.positionChangeLabel, 0)
     ac.setPosition(self.teamLabel, self.px + 12, self.py + 2)
     ac.setPosition(self.nameLabel, self.px + 30, self.py + 4)
     ac.setFontColor(self.nameLabel, .58, .53, .53, 1)
     ac.setText(self.infoLabel, "OUT")
     ac.setFontColor(self.infoLabel, .58, .53, .53, 1)
Beispiel #29
0
def getNotification():
    global Notify, NotificationLabel, StatusLabel
    try:
        Notify = box.notification(
            '243075740:AAEuscXHE-VaQCwZuWpytMzmC3Iwhopub6E')
        ac.setText(NotificationLabel, Notify)
    except:
        ac.log('BoxRadio: No internet connection')
        Status = "No internet connection"
        ac.setText(StatusLabel, Status)
Beispiel #30
0
def onToggleAppSizeButtonClickedListener(*args):
    global minimised, toggleAppSizeButton

    minimised = not minimised
    if minimised:
        ac.setText(toggleAppSizeButton, "+")
    else:
        ac.setText(toggleAppSizeButton, "-")

    updateUIVisibility()
Beispiel #31
0
def createLabel(name, text, x, y, font_size = 14, align = "center"):
    global mainApp

    label = ac.addLabel(mainApp, name)
    ac.setText(label, text)
    ac.setPosition(label, x, y)
    ac.setFontSize(label, font_size)
    ac.setFontAlignment(label, align)

    return label
Beispiel #32
0
def toggle(dummy, var):
    global recording, seq_num, frame_num, recButton

    if recording:
        recording = False
        ac.setText(recButton, "Start Recording")
    else:
        recording = True
        seq_num += 1
        frame_num = 1
        ac.setText(recButton, "Stop Recording")
Beispiel #33
0
def acUpdate(deltaT):
    global appName, appWindow, info, imagePath
    global output_speed, speed, gear, output_gear, max_rpm, rpm
    global output_Fuel_R
    global absVal, text_abs, tcsVal, text_tcs

    #Speed
    speed = ac.getCarState(0, acsys.CS.SpeedKMH)
    ac.setText(output_speed, "%01d" % (speed))

    #Gear
    gear = ac.getCarState(0, acsys.CS.Gear) - 1

    if gear == -1:
        ac.setText(output_gear, "R")
    elif gear == 0:
        ac.setText(output_gear, "N")
    else:
        ac.setText(output_gear, "%01d" % (gear))

#ABS
    absVal = info.physics.abs

    if absVal == 0:
        ac.setFontColor(text_abs, 1, 1, 1, 0.4)
    else:
        ac.setFontColor(text_abs, 1, 1, 1, 0.83)

#TCS
    tcsVal = info.physics.tc

    if tcsVal == 0:
        ac.setFontColor(text_tcs, 1, 1, 1, 0.4)
    else:
        ac.setFontColor(text_tcs, 1, 1, 1, 0.83)

# RPM Actions
    rpm = info.physics.rpms
    max_rpm = info.static.maxRpm
    max_rpm_remap = round(((rpm) * (20) / (max_rpm)))

    # Assign image per Rounded RPM
    for i in hud20:
        ac.setBackgroundTexture(
            appWindow, imagePath + "hud/h" + str(max_rpm_remap) + ".png")

# max_rpm_remap gets rounded to a solid number (based on the amount of images)
# That number gets used as the image number

# Fuel_Remaining
    fuel_R = info.physics.fuel
    ac.setText(output_Fuel_R, "{:.2f} l".format(fuel_R))

    ac.setBackgroundOpacity(appWindow, 0)
Beispiel #34
0
def onSoundPackChanged(x):
    global audiolist, audiolabel, config, audio, SoundPackSpinner
    audio = audiolist[int(ac.getValue(SoundPackSpinner))]
    ac.setText(audiolabel, audio)
    config['Audio']['source'] = str(audio)
    initSoundPack(audio)
    setDescription(SoundPackSpinner, '''
      Select the audio set that you
      would like to use.
      This refers to a folder in the
      app's /SoundPacks/ directory.''')
    def draw(self, data, delta_t: float) -> None:
        if data.height < 0.02:
            self.__warn_time = WARNING_TIME_S

        if self.__warn_time - delta_t > 0.0:
            self._back.color = Colors.red
            self.__warn_time -= delta_t
        else:
            self._back.color = Colors.white

        self._draw(Height.texture_id)
        ac.setText(self.__lb, "{:03.1f} mm".format(data.height))
Beispiel #36
0
def UpdateScores():
    global server_connection_ok, client_version
    params = "?track=" + ac.getTrackName(0) + "-" + ac.getTrackConfiguration(
        0) + "&mode=drift&client_version=" + str(client_version)
    scorejson = GetScoresFromServer(params)
    scores = ''
    for (key) in scorejson:
        scores += key + ':' + scorejson[key]['score'] + '\n'
    ac.setText(scorelabel, scores)
    server_connection_ok = 1
    #ac.console("update scores");
    return
def HideVirtControls():
    global virt
    virt = False
    ac.setText(fovLabel, "FOV")
    ac.setVisible(fovValue, 0)
    ac.setVisible(fovLabel, 0)
    ac.setVisible(fovUpButton, 0)
    ac.setVisible(fovDownButton, 0)
    ac.setVisible(leftButton, 0)
    ac.setVisible(rightButton, 0)
    ac.setVisible(upButton, 0)
    ac.setVisible(downButton, 0)
def ShowVirtControls():
    global virt
    virt = True
    ac.setText(fovLabel, "Size")
    ac.setVisible(fovValue, 1)
    ac.setVisible(fovLabel, 1)
    ac.setVisible(fovUpButton, 1)
    ac.setVisible(fovDownButton, 1)
    ac.setVisible(leftButton, 1)
    ac.setVisible(rightButton, 1)
    ac.setVisible(upButton, 1)
    ac.setVisible(downButton, 1)
Beispiel #39
0
 def run(self):
     global antManagerExecutable, uiElements
     ac.console("Starting executable")
     ac.setText(uiElements.btn1, "starting...")
     time.sleep(0.5)
     try:
         antManagerExecutable = subprocess.Popen(r".\apps\python\ACSimCyclingDash\bin\SimCycling.exe", cwd=os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin"))
         ac.console("Executable launched : " + str(antManagerExecutable))
     except Exception as e:
         ac.log(repr(e))
         ac.console(str(antManagerExecutable))
         ac.setText(uiElements.btn1, "start")
def acUpdate(deltaT):
    global l_lapcount, lapcount, b_benzina, benzina

    laps = ac.getCarState(0, acsys.CS.LapCount)
    info = sim_info.SimInfo()
    remaining = info.physics.fuel

    if laps > lapcount:
        lapcount = laps
        ac.setText(l_lapcount, "Laps: {}".format(lapcount))

    if remaining < benzina:
        benzina = remaining
        ac.setText(b_benzina, "Fuel: {}".format(benzina))
Beispiel #41
0
    def __init__(self, name, headerName):    
        self.headerName = headerName
        self.window = ac.newApp(name)

        self.lapNumberLabel = []
        self.timeLabel = []
        self.deltaLabel = []
        self.lastLapDataRefreshed = -1
        self.lastLapViewRefreshed = 0
        self.total = 0
        self.bestLapAc = 0
        self.bestLapTimeSession = 0
        self.bestLapTime = 0
        self.referenceTime = 0
        self.laps = []
        self.bestLapData = []
        self.currentLapData = [(0.0,0.0)]
        self.sfCrossed = 0
        self.session = info.graphics.session
        self.lastSession = 0
        self.lapInvalidated = 0
        self.justCrossedSf = False
        self.position = 0
        self.lastPosition = 0
        self.currentTime = 0
        self.lastCurrentTime = 0
        self.pitExitState = 0
        self.pitExitDeltaOffset = 0
        self.pitExitLap = 0

        self.readBestLap()

        self.currLabelId = lapLabelCount
        self.refLabelId = lapLabelCount+1
        self.totalLabelId = lapLabelCount+2

        for index in range(lapLabelCount+3):
            self.lapNumberLabel.append(ac.addLabel(self.window, "%d." % (index+1)))
            ac.setFontAlignment(self.lapNumberLabel[index], 'left')

            self.timeLabel.append(ac.addLabel(self.window, timeToString(0)))
            ac.setFontAlignment(self.timeLabel[index], 'right')

            self.deltaLabel.append(ac.addLabel(self.window, "-.---"))
            ac.setFontAlignment(self.deltaLabel[index], 'right')

        ac.setText(self.lapNumberLabel[self.currLabelId],  "Curr.")
        ac.setText(self.lapNumberLabel[self.totalLabelId], "Tot.")
 def updateLabelValues(self):
     def getBasicStatsStr():
         result = ""
         result += "%.1f FPS instant framerate\n"         %(self.instantFramerate)
         result += "%.1f FPS short running avg (%.1fs)\n" %(self.shortAverage, FramerateWatcher.shortAveragePeriod)
         result += "%.1f FPS long running avg (%.1fs)\n"  %(self.longAverage,  FramerateWatcher.longAveragePeriod)
         return result
     def getSpikesStr():
         result = "---- Recent major spikes (>%.1f%%)----\n" %(FramerateWatcher.spikeThreshold)
         for spike in reversed(self.spikes):
             result += "%.1f FPS"            % spike["framerate"]
             result += "(%.1f%% deviation)" % (spike["deviation"] * 100.)
             result += "at %s"          % (str(spike["timestamp"].time())[:-3])
             result += "\n"
         return result
     ac.setText(self.infoLabel, getBasicStatsStr() + getSpikesStr())
Beispiel #43
0
    def update_ui(self):
        # Order cars
        cars = self._get_sorted_cars()

        # Clear labels
        for dummy, label in self.ui.labels.items():
            ac.setText(label, '')

        if cars is None:
            # In pits
            label = self.ui.labels['line_0']
            ac.setFontColor(label, *WHITE)
            ac.setText(label, 'In Pits')
            return

        for i, car in enumerate(cars):
            try:
                label = self.ui.labels['line_%d' % i]
                label_delta = self.ui.labels['line_%d_delta' % i]
            except KeyError:
                break

            text = '%2d (%d) %s' % (car.position, car.lap, car.get_name())
            text_delta = ''
            color = WHITE

            status = car.status(self.player)

            if status == 'player':
                color = GREY_60
            elif status == 'lapping-behind':
                text_delta = '%.1f' % (car.delta / 1000)
                color = RED
            elif status == 'lapped-behind':
                text_delta = '%.1f' % (car.delta / 1000)
                color = DARK_GREEN
            elif status == 'lapped-ahead':
                text_delta = '+%.1f' % (car.delta / 1000)
                color = GREEN
            elif status == 'lapping-ahead':
                text_delta = '+%.1f' % (car.delta / 1000)
                color = DARK_RED
            elif status == 'racing-behind':
                text_delta = '%.1f' % (car.delta / 1000)
            elif status == 'racing-ahead':
                text_delta = '+%.1f' % (car.delta / 1000)

            if info.graphics.session != 2 and color != GREY_60:
                # Only use colors in race mode
                color = WHITE

            ac.setFontColor(label, *color)
            ac.setFontColor(label_delta, *color)
            ac.setText(label, text)
            ac.setText(label_delta, text_delta)
  def reinitialize_app(self):

    # Initialize all 'data' fields we use.
    if not hasattr(self.data, 'frame_count'):
      self.data.frame_count = 0

    # Only create the text label once.
    if not hasattr(self.data, 'banner'):
      self.data.banner = ac.addLabel(self.data.app_id, '')

    # But set the size and positioning every time the app is hot reloaded.
    ac.setPosition(self.data.banner, 0, 0)  # X, Y relative to main app window
    ac.setSize(self.data.banner, config.LABEL_WIDTH, config.LABEL_HEIGHT)

    ac.setFontAlignment(self.data.banner, 'center')
    ac.setFontSize(self.data.banner, config.FONT_SIZE)
    ac.setFontColor(self.data.banner, 0.945, 0.933, 0.102, 1.0) # yellow

    ac.setText(self.data.banner, '')
Beispiel #45
0
 def setMaxP(self, pFL, pFR, pRL, pRR):
   if self.maxpFL < pFL:
     self.maxpFL = pFL
     ac.setText(self.maxpFLValue, "{0}".format(round(self.maxpFL)))
   if self.maxpFR < pFR:
     self.maxpFR = pFR
     ac.setText(self.maxpFRValue, "{0}".format(round(self.maxpFR)))
   if self.maxpRL < pRL:
     self.maxpRL = pRL
     ac.setText(self.maxpRLValue, "{0}".format(round(self.maxpRL)))
   if self.maxpRR < pRR:
     self.maxpRR = pRR
     ac.setText(self.maxpRRValue, "{0}".format(round(self.maxpRR)))
Beispiel #46
0
 def setMaxT(self, tFL, tFR, tRL, tRR):
   if self.maxtFL < tFL:
     self.maxtFL = tFL
     ac.setText(self.maxtFLValue, "{0}".format(round(self.maxtFL)))
   if self.maxtFR < tFR:
     self.maxtFR = tFR
     ac.setText(self.maxtFRValue, "{0}".format(round(self.maxtFR)))
   if self.maxtRL < tRL:
     self.maxtRL = tRL
     ac.setText(self.maxtRLValue, "{0}".format(round(self.maxtRL)))
   if self.maxtRR < tRR:
     self.maxtRR = tRR
     ac.setText(self.maxtRRValue, "{0}".format(round(self.maxtRR)))
  def acUpdate(self, delta_t):
    if sim_info.info.graphics.status != sim_info.AC_LIVE:
      # You probably do not want to do anything until the sim is active.
      return

    if self.first_update:
      # App was just hot reloaded, or is otherwise running for the first time.
      self.first_update = False
      self.reinitialize_app()

    new_text = (
      """
      Total Frames: {frame_count}
      Since Reload: {local_frame_count}
      TRY CHANGING THIS AND RUN 'client_debug.py send'
      Current Lap: {current_lap}
      Lap Time: {lap_time}
      """.format(frame_count = self.data.frame_count,
                 local_frame_count = self.local_frame_count,
                 current_lap = ac.getCarState(0, acsys.CS.LapCount),
                 lap_time = ac.getCarState(0, acsys.CS.LapTime)))

    ac.setText(self.data.banner, new_text)
Beispiel #48
0
def CheckNewUpdate():
    global Status, StatusLabel, branch
    try:
        Status = update.update()
        if Status == 0:
            Status = "New update is installed. Restart to see changes"
            ac.log('EpicRace: ' + Status)
            ac.setText(StatusLabel, Status)
        if Status == 2:
            Status = "No new update."
            ac.log('EpicRace: ' + Status)
            ac.setText(StatusLabel, Status)
        else:
            Status = "There was an error while installing new update.\nError code: " + str(Status)
            ac.log('EpicRace: Error Update ' + Status)
            ac.setText(StatusLabel, Status)
    except:
        Status = "no internet connection"
        ac.log('EpicRace: Autoupdate ' + Status + traceback.format_exc())
        ac.setText(StatusLabel, Status)
Beispiel #49
0
    def updateViewFast(self):
        # Refresh current lap projection and performance
        if self.sfCrossed and len(self.bestLapData) > 0 and info.graphics.status != 1 and self.position > 0.00001:
            ac.setText(self.timeLabel[self.currLabelId], timeToString(self.projection))
            if self.pitExitState == PIT_EXIT_STATE_APPLY_OFFSET:
                setDelta(self.deltaLabel[self.currLabelId], self.performance-self.pitExitDeltaOffset)
            else:
                setDelta(self.deltaLabel[self.currLabelId], self.performance)
        else:
            ac.setText(self.timeLabel[self.currLabelId], timeToString(self.currentTime))
            ac.setText(self.deltaLabel[self.currLabelId], "-.---")
            ac.setFontColor(self.deltaLabel[self.currLabelId], 1, 1, 1, 1)

        if self.lapInvalidated:
            ac.setFontColor(self.timeLabel[self.currLabelId], 1, 0, 0, 1)
        else:
            ac.setFontColor(self.timeLabel[self.currLabelId], 1, 1, 1, 1)
Beispiel #50
0
def acUpdate(deltaT):
    global tick, trackname, lapcount, l_lapcount, l_distance, l_fuel, distance, in_tank, fuel
    tick += 1

    # info.physics.fuel is 0 until the outlap begins
    if in_tank == 0:
        in_tank = info.physics.fuel

    current_tank = info.physics.fuel
    difference = in_tank - round(current_tank, 2)
    if difference > 0.01:
        in_tank = current_tank
        fuel += difference
        ac.setText(l_fuel, "Fuel used: {:.3f}".format(fuel))

    laps = ac.getCarState(0, acsys.CS.LapCount)
    if laps > lapcount:
        lapcount = laps
        distance += tracklength[trackname]
        ac.log("{} laps of {}. That's {:.3f} kilometers this session".format(lapcount, trackname, distance))
        ac.console("{} laps of {}. That's {:.3f} kilometers this session".format(lapcount, trackname, distance))
        ac.setText(l_lapcount, "Laps: {}".format(lapcount))
        ac.setText(l_distance, "Kilometers: {:.3f}".format(distance))
Beispiel #51
0
    def updateView(self):
        ac.setText(self.centerLabel[self.showHeaderId], yesOrNo(showHeader))
        ac.setText(self.centerLabel[self.fontSizeId],   str(fontSize))
        ac.setText(self.centerLabel[self.opacityId],   "{0} %".format(opacity))
        ac.setText(self.centerLabel[self.showBorderId], yesOrNo(showBorder))
        ac.setText(self.centerLabel[self.lapCountId],   str(lapDisplayedCount))
        ac.setText(self.centerLabel[self.showDeltaId],  yesOrNo(showDelta))
        ac.setText(self.centerLabel[self.deltaColorId], deltaColor.title())
        ac.setText(self.centerLabel[self.redAtId],      "{:+.1f} s".format(float(redAt)/1000))
        ac.setText(self.centerLabel[self.greenAtId],    "{:+.1f} s".format(float(greenAt)/1000))
        ac.setText(self.centerLabel[self.showCurrentId], yesOrNo(showCurrent))

        if reference == "best":
            ac.setText(self.centerLabel[self.referenceId], "Best lap")
        elif reference == "median":
            ac.setText(self.centerLabel[self.referenceId], "Median")
        elif reference == "top25":
            ac.setText(self.centerLabel[self.referenceId], "Top 25%")
        elif reference == "top50":
            ac.setText(self.centerLabel[self.referenceId], "Top 50%")
        elif reference == "top75":
            ac.setText(self.centerLabel[self.referenceId], "Top 75%")

        ac.setText(self.centerLabel[self.showReferenceId], yesOrNo(showReference))
        ac.setText(self.centerLabel[self.showTotalId], yesOrNo(showTotal))

        if updateTime == 0:
            ac.setText(self.centerLabel[self.refreshId], "Min")
        elif updateTime == 50:
            ac.setText(self.centerLabel[self.refreshId], "0.05 s")
        else:
            ac.setText(self.centerLabel[self.refreshId], "{:.1f} s".format(float(updateTime)/1000))

        ac.setText(self.centerLabel[self.logLapsId], yesOrNo(logLaps))
        ac.setText(self.centerLabel[self.logBestId], logBest.title())
        ac.setText(self.centerLabel[self.resetBestLapId], timeToString(multiLapsApp.bestLapTime))

        if lockBest:
            ac.setText(self.centerLabel[self.lockBestId], "Locked")
        else:
            ac.setText(self.centerLabel[self.lockBestId], "Unlocked")
 def setText(self, text):
     ac.setText(self.button, text)
     return self
 def setText(self, text):
     ac.setText(self.label, text)
     return self
 def set(self, col, text):
   ac.setText(getattr(self.data, col), text)
Beispiel #55
0
 def _create_label(self, name, text, x, y):
     label = ac.addLabel(self.widget, name)
     ac.setText(label, text)
     ac.setPosition(label, x, y)
     self.labels[name] = label
Beispiel #56
0
    def refreshParameters(self):
        if showHeader:
            ac.setTitle(self.window, self.headerName)
            ac.setIconPosition(self.window, 0, 0)
            self.firstSpacing = firstSpacing
        else:
            ac.setTitle(self.window, "")
            ac.setIconPosition(self.window, -10000, -10000)
            self.firstSpacing = 0

        widthNumber     = fontSize*2
        widthTime       = fontSize*5
        widthDelta      = fontSize*5

        self.width  = widthNumber + widthTime + widthDelta*showDelta + 2*spacing
        self.height = self.firstSpacing + (fontSize + spacing)*(lapDisplayedCount + showCurrent + showTotal + showReference)

        ac.setSize(self.window, self.width, self.height)

        for index in range(lapLabelCount+3):
            ac.setFontSize(self.lapNumberLabel[index], fontSize)
            ac.setPosition(self.lapNumberLabel[index], spacing, self.firstSpacing + index*(fontSize+spacing))
            ac.setSize(self.lapNumberLabel[index], widthNumber, fontSize+spacing)

            ac.setFontSize(self.timeLabel[index], fontSize)
            ac.setPosition(self.timeLabel[index], spacing + widthNumber, self.firstSpacing + index*(fontSize+spacing))
            ac.setSize(self.timeLabel[index], widthTime, fontSize+spacing)

            ac.setFontSize(self.deltaLabel[index], fontSize)
            ac.setPosition(self.deltaLabel[index], spacing + widthNumber + widthTime, self.firstSpacing + index*(fontSize+spacing))
            ac.setSize(self.deltaLabel[index], widthTime, fontSize+spacing)

        for index in range(lapLabelCount):
            if index < lapDisplayedCount:
                ac.setVisible(self.lapNumberLabel[index], 1)
                ac.setVisible(self.timeLabel[index], 1)
                ac.setVisible(self.deltaLabel[index], showDelta)
            else:
                ac.setVisible(self.lapNumberLabel[index], 0)
                ac.setVisible(self.timeLabel[index], 0)
                ac.setVisible(self.deltaLabel[index], 0)

        rowIndex = lapDisplayedCount

        # Current time position
        ac.setPosition(self.lapNumberLabel[self.currLabelId], spacing, self.firstSpacing + rowIndex*(fontSize+spacing))
        ac.setPosition(self.timeLabel[self.currLabelId], spacing + widthNumber, self.firstSpacing + rowIndex*(fontSize+spacing))
        ac.setPosition(self.deltaLabel[self.currLabelId], spacing + widthNumber + widthTime, self.firstSpacing + rowIndex*(fontSize+spacing))

        ac.setVisible(self.lapNumberLabel[self.currLabelId], showCurrent)
        ac.setVisible(self.timeLabel[self.currLabelId], showCurrent)
        ac.setVisible(self.deltaLabel[self.currLabelId], showCurrent and showDelta)

        rowIndex += showCurrent

        # Reference time name and position
        if reference == "best":
            ac.setText(self.lapNumberLabel[self.refLabelId], "Best")
        elif reference == "median":
            ac.setText(self.lapNumberLabel[self.refLabelId], "Med.")
        elif reference == "top25":
            ac.setText(self.lapNumberLabel[self.refLabelId], "25%")
        elif reference == "top50":
            ac.setText(self.lapNumberLabel[self.refLabelId], "50%")
        elif reference == "top75":
            ac.setText(self.lapNumberLabel[self.refLabelId], "75%")

        ac.setVisible(self.lapNumberLabel[self.refLabelId], showReference)
        ac.setVisible(self.timeLabel[self.refLabelId], showReference)
        ac.setVisible(self.deltaLabel[self.refLabelId], 0)
        
        ac.setPosition(self.lapNumberLabel[self.refLabelId], spacing, self.firstSpacing + rowIndex*(fontSize+spacing))
        ac.setPosition(self.timeLabel[self.refLabelId], spacing + widthNumber, self.firstSpacing + rowIndex*(fontSize+spacing))
        ac.setPosition(self.deltaLabel[self.refLabelId], spacing + widthNumber + widthTime, self.firstSpacing + rowIndex*(fontSize+spacing))

        rowIndex += showReference

        # Total time position
        ac.setVisible(self.lapNumberLabel[self.totalLabelId], showTotal)
        ac.setVisible(self.timeLabel[self.totalLabelId], showTotal)
        ac.setVisible(self.deltaLabel[self.totalLabelId], 0)

        ac.setPosition(self.lapNumberLabel[self.totalLabelId], spacing, self.firstSpacing + rowIndex*(fontSize+spacing))
        ac.setPosition(self.timeLabel[self.totalLabelId], spacing + widthNumber, self.firstSpacing + rowIndex*(fontSize+spacing))
        ac.setPosition(self.deltaLabel[self.totalLabelId], spacing + widthNumber + widthTime, self.firstSpacing + rowIndex*(fontSize+spacing))

        # Force full refresh
        self.updateDataFast()
        self.updateDataRef()
        self.updateViewFast()
        self.updateViewNewLap()
Beispiel #57
0
    def updateViewNewLap(self):
        for index in range(lapDisplayedCount):
            lapIndex = index
            if len(self.laps) > lapDisplayedCount:
                lapIndex += len(self.laps)-lapDisplayedCount

            # Refresh lap number
            if (self.pitExitLap > 0) and (self.pitExitLap <= lapIndex < self.lapDone):
                ac.setText(self.lapNumberLabel[index], "{0}. ({1})".format(lapIndex+1, lapIndex-self.pitExitLap+1))
            else:
                ac.setText(self.lapNumberLabel[index], "%d." % (lapIndex+1))

            # Refresh lap times and deltas
            if lapIndex < len(self.laps):
                ac.setText(self.timeLabel[index], timeToString(self.laps[lapIndex]))
                
                # Best lap in green
                if self.laps[lapIndex] == self.bestLapAc:
                    ac.setFontColor(self.timeLabel[index], 0, 1, 0, 1)
                else:
                    ac.setFontColor(self.timeLabel[index], 1, 1, 1, 1)
                
                # Refresh delta label
                setDelta(self.deltaLabel[index], self.laps[lapIndex] - self.referenceTime)

            else:
                ac.setText(self.timeLabel[index], timeToString(0))
                ac.setFontColor(self.timeLabel[index], 1, 1, 1, 1)
                ac.setText(self.deltaLabel[index], "-.---")
                ac.setFontColor(self.deltaLabel[index], 1, 1, 1, 1)

        # Refresh Total
        ac.setText(self.timeLabel[self.totalLabelId], timeToString(self.total))

        # Refresh reference
        ac.setText(self.timeLabel[self.refLabelId], timeToString(self.referenceTime))

        self.lastLapViewRefreshed = self.lastLapDataRefreshed
Beispiel #58
0
    def __init__(self, name, headerName, fontSize, showHeader):
        self.headerName = headerName
        self.window = ac.newApp(name)
        if showHeader == 1:
            ac.setTitle(self.window, "")
            ac.setIconPosition(self.window, -10000, -10000)
            self.firstSpacing = 0
        else:
            ac.setTitle(self.window, headerName)
            self.firstSpacing = firstSpacing

        self.fontSize = fontSize

        widthLeft       = fontSize*8
        widthCenter     = fontSize*5
        widthRight      = fontSize*5
        self.width      = widthLeft + widthCenter + widthRight + 2*spacing
        height          = self.firstSpacing + (fontSize*1.5 + spacing)*20

        ac.setSize(self.window, self.width, height)

        self.leftLabel = []
        self.centerLabel = []
        self.changeButton = []
        self.plusButton = []
        self.minusButton = []

        for index in range(20):
            self.leftLabel.append(ac.addLabel(self.window, ""))
            ac.setFontSize(self.leftLabel[index], fontSize)
            ac.setPosition(self.leftLabel[index], spacing, self.firstSpacing + index*(fontSize*1.5+spacing))
            ac.setSize(self.leftLabel[index], widthLeft, fontSize+spacing)
            ac.setFontAlignment(self.leftLabel[index], 'left')

            self.centerLabel.append(ac.addLabel(self.window, ""))
            ac.setFontSize(self.centerLabel[index], fontSize)
            ac.setPosition(self.centerLabel[index], spacing + widthLeft, self.firstSpacing + index*(fontSize*1.5+spacing))
            ac.setSize(self.centerLabel[index], widthCenter, fontSize+spacing)
            ac.setFontAlignment(self.centerLabel[index], 'left')

            self.changeButton.append(ac.addButton(self.window, "Change"))
            ac.setFontSize(self.changeButton[index], self.fontSize)
            ac.setPosition(self.changeButton[index], spacing + widthLeft + widthCenter, self.firstSpacing + index*(fontSize*1.5+spacing))
            ac.setSize(self.changeButton[index], fontSize*4, fontSize*1.5)

            self.plusButton.append(ac.addButton(self.window, "+"))
            ac.setFontSize(self.plusButton[index], self.fontSize)
            ac.setPosition(self.plusButton[index], spacing + widthLeft + widthCenter, self.firstSpacing + index*(fontSize*1.5+spacing))
            ac.setSize(self.plusButton[index], fontSize*1.5, fontSize*1.5)

            self.minusButton.append(ac.addButton(self.window, "-"))
            ac.setFontSize(self.minusButton[index], self.fontSize)
            ac.setPosition(self.minusButton[index], spacing + widthLeft + widthCenter + fontSize*2.5, self.firstSpacing + index*(fontSize*1.5+spacing))
            ac.setSize(self.minusButton[index], fontSize*1.5, fontSize*1.5)
            
        rowIndex = 0

        ac.setText(self.leftLabel[rowIndex], "Show header:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleHeader)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.showHeaderId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Font size:")
        ac.setVisible(self.changeButton[rowIndex], 0)
        ac.addOnClickedListener(self.plusButton[rowIndex], fontSizePlus)
        ac.addOnClickedListener(self.minusButton[rowIndex], fontSizeMinus)
        self.fontSizeId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Opacity:")
        ac.setVisible(self.changeButton[rowIndex], 0)
        ac.addOnClickedListener(self.plusButton[rowIndex], opacityPlus)
        ac.addOnClickedListener(self.minusButton[rowIndex], opacityMinus)
        self.opacityId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Show border:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleBorder)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.showBorderId = rowIndex

        rowIndex += 1

        ac.setVisible(self.changeButton[rowIndex], 0)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Lap count:")
        ac.setVisible(self.changeButton[rowIndex], 0)
        ac.addOnClickedListener(self.plusButton[rowIndex], lapCountPlus)
        ac.addOnClickedListener(self.minusButton[rowIndex], lapCountMinus)
        self.lapCountId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Show delta:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleDelta)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.showDeltaId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Delta color:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleColor)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.deltaColorId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Red at:")
        ac.setVisible(self.changeButton[rowIndex], 0)
        ac.addOnClickedListener(self.plusButton[rowIndex], redAtPlus)
        ac.addOnClickedListener(self.minusButton[rowIndex], redAtMinus)
        self.redAtId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Green at:")
        ac.setVisible(self.changeButton[rowIndex], 0)
        ac.addOnClickedListener(self.plusButton[rowIndex], greenAtPlus)
        ac.addOnClickedListener(self.minusButton[rowIndex], greenAtMinus)
        self.greenAtId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Show curr.:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleCurrent)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.showCurrentId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Reference:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleRefSource)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.referenceId = rowIndex

        rowIndex += 1
        
        ac.setText(self.leftLabel[rowIndex], "Show ref.:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleRef)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.showReferenceId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Show total:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleTotal)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.showTotalId = rowIndex

        rowIndex += 1
        
        ac.setVisible(self.changeButton[rowIndex], 0)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Refresh every:")
        ac.setVisible(self.changeButton[rowIndex], 0)
        ac.addOnClickedListener(self.plusButton[rowIndex], refreshPlus)
        ac.addOnClickedListener(self.minusButton[rowIndex], refreshMinus)
        self.refreshId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Log sessions:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleLogLaps)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.logLapsId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Remember best:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleLogBest)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.logBestId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Best lap:")
        ac.addOnClickedListener(self.changeButton[rowIndex], resetBestLap)
        ac.setText(self.changeButton[rowIndex], "Reset")
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.resetBestLapId = rowIndex

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Lock best:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleLockBest)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.lockBestId = rowIndex
def onFormRender(deltaT):
	global timeLabel
	theTime=datetime.now()
	ac.setText(timeLabel, "{}".format(theTime.strftime("%H:%M")))