def setFont(self, fontName, italic, bold): self.fontName = fontName ac.setCustomFont(self.label, self.fontName, italic, bold) if fontName == "Khula": self.fontSize+=1 ac.setFontSize(self.label, self.fontSize) return self
def __init__(self, app, x, y): self.AverageFuelPerLap = 0.0 self.FuelLastLap = 0.0 self.completedLaps = 0.0 self.fuelAtLapStart = 0.0 self.distanceTraveledAtStart = 0.0 self.fuelAtStart = 0.0 self.lastFuelMeasurement = 0.0 self.lastDistanceTraveled = 0.0 self.counter = 0 self.updatecounter = 0 self.inifilepath = inidir + self.getValidFileName(ac.getCarName(0)) +"_" + self.getValidFileName(ac.getTrackName(0)) + self.getValidFileName(ac.getTrackConfiguration(0)) + ".ini" ##initialize labels self.remainingLabel = ac.addLabel(app, "remainingLabel") self.averageFuelPerLapLabel = ac.addLabel(app, "averageFuelPerLapLabel") self.lapsLeftLabel = ac.addLabel(app, "lapsLeftLabel") self.averageFuelPer100kmLabel = ac.addLabel(app, "averageFuelPer100km") self.instFuelLabel = ac.addLabel(app, "instFuel") ##set label positions ac.setPosition(self.remainingLabel, x, y) ac.setPosition(self.averageFuelPerLapLabel, x + 208, y) ac.setPosition(self.lapsLeftLabel, 150 - x, y) ac.setPosition(self.averageFuelPer100kmLabel, x + 208, y + 19) ac.setPosition(self.instFuelLabel, 150 - x, y + 19) ##set label alignments ac.setFontAlignment(self.remainingLabel, "left") ac.setFontAlignment(self.averageFuelPerLapLabel, "left") ac.setFontAlignment(self.lapsLeftLabel, "right") ac.setFontAlignment(self.averageFuelPer100kmLabel, "left") ac.setFontAlignment(self.instFuelLabel, "right") ##set font size ac.setFontSize(self.remainingLabel, 32) ac.setFontSize(self.averageFuelPerLapLabel, 16) ac.setFontSize(self.lapsLeftLabel, 16) ac.setFontSize(self.averageFuelPer100kmLabel, 16) ac.setFontSize(self.instFuelLabel, 16) if os.path.exists(self.inifilepath): f = open(self.inifilepath, "r") self.AverageFuelPerLap = float(f.readline()[6:]) f.close() ac.setText(self.remainingLabel, "--- l") ac.setText(self.averageFuelPerLapLabel, "--- l/lap") ac.setText(self.lapsLeftLabel, "--- laps") if milesPerGallon: ac.setText(self.averageFuelPer100kmLabel, "--- mpg") else: ac.setText(self.averageFuelPer100kmLabel, "--- l/100km") ac.setText(self.instFuelLabel, "--- inst.")
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], "")
def reinitialize(self): ac.setTitle(self.data.app_id, "") self.hide_app_background() ac.drawBorder(self.data.app_id, 0) ac.setIconPosition(self.data.app_id, 0, -10000) ac.setSize(self.data.app_id, config.APP_WIDTH, config.APP_HEIGHT) # Click on app area handling - used for toggling modes if not hasattr(self.data, 'click_label'): self.data.click_label = ac.addLabel(self.data.app_id, '') ac.addOnClickedListener(self.data.click_label, sys.modules['deltabar'].onClick) ac.setPosition(self.data.click_label, 0, 0) ac.setSize(self.data.click_label, config.APP_WIDTH, config.APP_HEIGHT) # Delta bar main area if not hasattr(self.data, 'bar_area'): self.data.bar_area = ac.addLabel(self.data.app_id, '') ac.setPosition(self.data.bar_area, config.BAR_CORNER_RADIUS, 0) ac.setSize(self.data.bar_area, config.BAR_WIDTH - 2 * config.BAR_CORNER_RADIUS, config.BAR_HEIGHT) ac.setBackgroundColor(self.data.bar_area, *config.BACKGROUND_COLOR.rgb) ac.setBackgroundOpacity(self.data.bar_area, config.BACKGROUND_COLOR.alpha) # Delta label background area if not hasattr(self.data, 'delta_label_area'): self.data.delta_label_area = ac.addLabel(self.data.app_id, '') ac.setPosition(self.data.delta_label_area, config.BAR_WIDTH_HALF - config.DELTA_LABEL_WIDTH_HALF, config.DELTA_LABEL_Y) ac.setSize(self.data.delta_label_area, config.DELTA_LABEL_WIDTH, config.DELTA_LABEL_HEIGHT) ac.setBackgroundTexture(self.data.delta_label_area, 'apps/python/deltabar/background_delta.png') # Delta label text if not hasattr(self.data, 'delta_label'): self.data.delta_label = ac.addLabel(self.data.app_id, '') ac.setPosition(self.data.delta_label, config.BAR_WIDTH_HALF - config.DELTA_LABEL_WIDTH_HALF, config.DELTA_LABEL_TEXT_Y) ac.setSize(self.data.delta_label, config.DELTA_LABEL_WIDTH, config.DELTA_LABEL_FONT_SIZE) ac.setFontAlignment(self.data.delta_label, 'center') ac.setFontSize(self.data.delta_label, config.DELTA_LABEL_FONT_SIZE) # Banner label (displays current selected mode) if not hasattr(self.data, 'banner_label'): self.data.banner_label = ac.addLabel(self.data.app_id, '') ac.setPosition(self.data.banner_label, config.BAR_WIDTH_HALF - config.BANNER_TEXT_WIDTH / 2, config.BANNER_Y) ac.setSize(self.data.banner_label, config.BANNER_TEXT_WIDTH, config.BANNER_FONT_SIZE) ac.setFontAlignment(self.data.banner_label, 'center') ac.setFontSize(self.data.banner_label, config.BANNER_FONT_SIZE) ac.setFontColor(self.data.banner_label, *config.SLOW_COLOR.rgba)
def size(self, size): _w, _h = size if isinstance(_w, int) and isinstance(_h, int): self._font_size = min(self.getFontSizeFromText(), _h) self._size = (_w, _h) if self.ac_obj != 0: ac.setFontSize(self.ac_obj, self._font_size)
def __init__(self, parent, text, size, posx, posy, font, align): self.lbl = ac.addLabel(parent, str(text)) ac.setPosition(self.lbl, posx, posy) if size: ac.setFontSize(self.lbl, size) if font: ac.setCustomFont(self.lbl, font, 0, 0) if align: ac.setFontAlignment(self.lbl, align)
def set_font_size(self, size): """Set text label font size. Args: size (float): Fontsize in PIXELS (not pt) Important: Fontsize in Assetto Corsa is done in pixels, not pt. Therefore vertically it scales linearly. """ ac.setFontSize(self.id, size)
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
def size(self, size): _w, _h = size if isinstance(_w, int) and isinstance(_h, int): if self._parent is not None: if not (self._pos[0] + _w <= self._parent.size[0] and self._pos[1] + _h <= self._parent.size[1]): _w = self._parent.size[0] _h = self._parent.size[1] self._font_size = min(self.getFontSizeFromText(), _h) self._size = (_w, _h) ac.setFontSize(self.ac_obj, self._font_size)
def setupButtons(self): ac.setSize(self.btn1, 165, 26) ac.setSize(self.btn2 , 165, 26) ac.setFontSize(self.btn1, 18) ac.setFontSize(self.btn2 , 18) ac.setFontAlignment(self.btn1, "center") ac.setFontAlignment(self.btn2, "center") ac.setPosition(self.btn1, 1 , 398) ac.setPosition(self.btn2 , 168, 398) ac.addOnClickedListener(self.btn1, btn1_clicked) ac.addOnClickedListener(self.btn2 , btn2_clicked)
def font(self, font: Font): if font: if self._font: self._font.remove_observer(self) self._font = font self._font.add_observer(self) if self.has_id: ac.setFontSize(self.id, font.size) ac.setFontColor(self.id, font.color.r, font.color.g, font.color.b, font.color.a) ac.setCustomFont(self.id, font.name, font.italic, font.bold)
def __init__(self, name, tyre=None, render_function=None): self.window = ac.newApp(name) self.tyre = tyre ac.setIconPosition(self.window, 9999999, 99999999) # hide the icon ac.setSize(self.window, TyreWindow.width, TyreWindow.height) self.opt_label = ac.addLabel(self.window, "Opt:") ac.setPosition(self.opt_label, 5, 50) self.slip_label = ac.addLabel(self.window, "Slip:\nSkid:") ac.setPosition(self.slip_label, 5, 70) self.starting_label_no = ac.addLabel(self.window, "") ac.addRenderCallback(self.window, render_function) ac.setFontSize(self.starting_label_no, 25) ac.setPosition(self.starting_label_no, 35, 20)
def initGui(self): width = 400 height = (self.historySize * self.CHAT_LINE_HEIGHT) height += 40 # Title area height += 40 # Text input height += 10 # Padding between text input and messages ac.setSize(self.appWindow, width, height) ac.setPosition(self.textInput, 15, height - 40) ac.setSize(self.textInput, 360, 30) if self.firstLayout: ac.setPosition(self.shrinkButton, width - 50, 40) ac.setSize(self.shrinkButton, 20, 20) ac.setPosition(self.expandButton, width - 25, 40) ac.setSize(self.expandButton, 20, 20) self.firstLayout = False for row in self.labels: ac.setVisible(row['author'], 0) ac.setVisible(row['message'], 0) self.unusedLabels = self.labels self.labels = [] nameX = 10 nameWidth = 70 messageX = nameX + nameWidth + 5 labelY = 40 for i in range(0, self.historySize): row = self.getUnusedRow() ac.setPosition(row['author'], nameX, labelY) ac.setSize(row['author'], nameWidth, 20) ac.setFontColor(row['author'], 1, 1, 0, 1) ac.setFontSize(row['author'], 12) ac.setFontAlignment(row['author'], "right") ac.setPosition(row['message'], messageX, labelY) ac.setSize(row['message'], width - messageX, 20) ac.setFontSize(row['message'], 12) ac.setVisible(row['author'], 1) ac.setVisible(row['message'], 1) self.labels.append(row) labelY += self.CHAT_LINE_HEIGHT self.update_messages()
def addLabel(self, options): options.x = options.x | 0 options.y = options.y | 0 options.fontSize = options.fontSize | 10 options.fontFamily = options.fontFamily | "Roboto" options.fontAlignment = options.fontAlignment | "center" options.color = options.color | [0.8, 0.8, 0.8, 1] item = ac.addLabel(self.appWindow, options.content) ac.setPosition(item, self.x + options.x * self.scale, self.y + options.y * self.scale) ac.setFontSize(item, self.fontSize) ac.setFontAlignment(item, self.fontAlignment) ac.setCustomFont(item, options.fontFamily, 1, 0) ac.setFontColor(item, options.color[0], options.color[1], options.color[2], options.color[3]) return item
def addButton(self, event, options): options.x = options.x | 0 options.y = options.y | 0 options.fontSize = options.fontSize | 10 options.border = options.border | 0 options.opacity = options.opacity | 1 item = ac.addButton(self.appWindow, "") ac.setPosition(item, self.x + options.x * self.scale, self.y + options.y * self.scale) ac.setFontSize(item, options.fontSize) ac.drawBorder(item, options.border) ac.setBackgroundOpacity(item, options.opacity) ac.addonClickListener(item, event) ac.setText(item, options.content) return item
def add(self, text, x1, x2, x3): single_column = not any((x2, x3)) for column_number, col in enumerate((x1, x2, x3)): if col is None: continue if not hasattr(self.data, col): setattr(self.data, col, ac.addLabel(self.window_id, "")) ident = getattr(self.data, col) ac.setPosition(ident, column_number * 100, self._next_line) width = 300 if single_column else 100 ac.setSize(ident, width, self._line_size) ac.setFontSize(ident, self._font_size) if not single_column: ac.setFontAlignment(ident, 'right') ac.setFontColor(ident, 1.0, 1.0, 1.0, 1.0) self._next_line += self._line_size self.set(x1, text)
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, '')
def acMain(ac_version): global AngleLabel, PeakAngleLabel, PeakKMHLabel # init Window appWindow = ac.newApp("D_Angle") ac.setSize(appWindow, 200, 113) ac.setTitle(appWindow, "D_Angle") ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0.1) # label configure AngleLabel = ac.addLabel(appWindow, "0°") ac.setPosition(AngleLabel, 100, 20) ac.setFontAlignment(AngleLabel, "center") ac.setFontSize(AngleLabel, 55) ac.setFontColor(AngleLabel, 1, 1, 1, 1) PeakAngleLabel = ac.addLabel(appWindow, "0°") ac.setPosition(PeakAngleLabel, 110, 87) ac.setFontAlignment(PeakAngleLabel, "right") ac.setFontSize(PeakAngleLabel, 12) ac.setFontColor(PeakAngleLabel, 1, 1, 1, 0.6) PeakKMHLabel = ac.addLabel(appWindow, "0") ac.setPosition(PeakKMHLabel, 130, 87) ac.setFontAlignment(PeakKMHLabel, "right") ac.setFontSize(PeakKMHLabel, 12) ac.setFontColor(PeakKMHLabel, 1, 1, 1, 0.6) peakTitleLabel = ac.addLabel(appWindow, "peak :") ac.setPosition(peakTitleLabel, 50, 87) ac.setFontAlignment(peakTitleLabel, "left") ac.setFontSize(peakTitleLabel, 10) ac.setFontColor(peakTitleLabel, 1, 1, 1, 0.6) peakKMHUnitLabel = ac.addLabel(appWindow, "km/h") ac.setPosition(peakKMHUnitLabel, 135, 90) ac.setFontAlignment(peakKMHUnitLabel, "left") ac.setFontSize(peakKMHUnitLabel, 8) ac.setFontColor(peakKMHUnitLabel, 1, 1, 1, 0.6)
def acMain(ac_version): global appWindow, carCount, playerModule1, cars ac.log("trainingHelper - start") ac.console("trainingHelper - start") appWindow = ac.newApp("Training Helper") ac.setSize(appWindow, 400, 400) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0) ac.setFontSize(appWindow, 15) generalData = getGeneralData() carCount = generalData['carCount'] playerModule1 = Module1( appWindow, generalData['trackName'] + generalData['trackConfiguration'], carCount) for i in range(carCount): playerData = getGeneralDataForCar(i) car = Car(playerData['carName'], playerData['driverName'], i) cars.append(car) #ac.log(playerData['carName']) #ac.setText(playerModule1.labelCarName, "{0}".format(playerData['carName'])) ac.addRenderCallback(appWindow, onFormRender) return "Training Helper"
def acMain(ac_version): global textInput, appWindow, inputWindow, messages, lines, maxLines appWindow = ac.newApp('nChat') inputWindow = ac.newApp('nInput') ac.setSize(appWindow, 500, 100) ac.drawBorder(appWindow, 0) ac.setTitle(appWindow, '') ac.setIconPosition(appWindow, -9000, 0) ac.setBackgroundOpacity(appWindow, 0) ac.setSize(inputWindow, 435, 62) ac.drawBorder(inputWindow, 0) ac.setTitle(inputWindow, '') ac.setIconPosition(inputWindow, -9000, 0) ac.setBackgroundOpacity(inputWindow, 0) textInput = ac.addTextInput(inputWindow, 'TEXT_INPUT') ac.setPosition(textInput, 1, 32) ac.setSize(textInput, 435, 30) ac.addOnChatMessageListener(appWindow, onChatMessage) ac.addOnClickedListener(appWindow, onWindowClick) ac.addOnValidateListener(textInput, onValidateListener) ac.addOnClickedListener(inputWindow, onWindowClick) for i in range(0, maxLines): lines.append([ac.addLabel(appWindow, ''), ac.addLabel(appWindow, '')]) for x in range(0, 2): ac.setSize(lines[i][x], 14*60, 14) ac.setPosition(lines[i][x], 0, i*14+5) ac.setFontSize(lines[i][x], 14) # Maybe add back in later #lines.reverse() onChatMessage('Loaded...', 'nChat') return "nChat"
def acMain(ac_version): global shadow, label, appWindow appWindow = ac.newApp("SimpleSpeedo") ac.setSize(appWindow, 120, 60) ac.setBackgroundOpacity(appWindow, 0) ac.drawBorder(appWindow, 0) ac.setIconPosition(appWindow, 0, -9000) -ac.setTitlePosition(appWindow, 0, -9000) shadow = ac.addLabel(appWindow, "?") ac.setFontSize(shadow, 44) ac.setPosition(shadow, 61, 1) ac.setFontColor(shadow, 0.2, 0.2, 0.2, 0.2) ac.setFontAlignment(shadow, "center") label = ac.addLabel(appWindow, "?") ac.setFontSize(label, 44) ac.setPosition(label, 60, 0) ac.setFontColor(label, 1, 1, 1, 0.4) ac.setFontAlignment(label, "center") return "SimpleSpeedo"
def __init__(self, parent, number): self.back = defbutton(parent, "", 320, 34, 0, number*34) ac.drawBorder(self.back.btn, 0) ac.setBackgroundTexture(self.back.btn, "apps/python/HoschTV/img/tower-back.png") ac.drawBorder(self.back.btn, 0) ac.setBackgroundOpacity(self.back.btn, 0) self.pos = deflabel(parent, str(number +1), 32, 17, 2+number*34, "voxbox", "center") ac.setFontColor(self.pos.lbl, 0, 0, 0, 1) if number>18: ac.setFontSize(self.pos.lbl, 19) ac.setPosition(self.pos.lbl, 17, 8+number*34) elif number>8: ac.setFontSize(self.pos.lbl, 26) ac.setPosition(self.pos.lbl, 17, 5+number*34) # ac.addOnClickedListener(self.back, focus(i)) # ac.addOnClickedListener(self.back, focus(p[i+1])) # ac.addOnClickedListener(id, func) """ self.pos = ac.addLabel(ACtower, str(i+1)) ac.setPosition(self.pos, 19, (40*i)+6) ac.setFontSize(self.pos, 25) ac.setCustomFont(self.pos, "Arial", 0, 0) ac.setFontAlignment(self.pos, "center") ac.setFontColor(self.pos, 0, 0, 0, 1) self.name = ac.addLabel(ACtower, "BSP") ac.setPosition(self.name, 40, (40*i)+4) ac.setFontSize(self.name, 29) ac.setCustomFont(self.name, "Arial", 0, 0) self.info = ac.addLabel(ACtower, "0:00.000") ac.setPosition(self.info, 116, (40*i)+6) ac.setFontSize(self.info, 25) ac.setCustomFont(self.info, "Arial", 0, 0) """
def acMain(ac_version): global ui_flag, flag, appWindow, font_size width = 8 * font_size height = 2 * font_size appName = "Better Flags" appWindow = ac.newApp(appName) ac.setTitle(appWindow, "") ac.setSize(appWindow, int(width), int(height)) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0) ac.setIconPosition(appWindow, 0, -10000) ui_flag = ac.addLabel(appWindow, "") ac.setCustomFont(ui_flag, "Roboto", 0, 1) ac.setFontAlignment(ui_flag, "center") ac.setPosition(ui_flag, int(width / 2), (int(height / 2) - int(font_size / 2))) ac.setFontSize(ui_flag, int(font_size)) ac.setText(ui_flag, "") return appName
def setup(self): ac.setFontSize(self.label, self.fontSize) ac.setFontAlignment(self.label, self.alignment) ac.setFontSize(self.unitLabel, self.fontSize//2) ac.setPosition(self.label, self.x, self.y) ac.setPosition(self.unitLabel, self.x+self.fontSize//10, self.y+self.fontSize//2) if self.title is not None: ac.setFontAlignment(self.titleLabel, "right") ac.setFontSize(self.titleLabel, self.fontSize//2) ac.setPosition(self.titleLabel, self.x, self.y + self.fontSize)
def acMain(ac_version): global appWindow, CamberIndicators, CheckBoxes, Buttons, Options, Labels, UIData loadOptions() appWindow = ac.newApp("CamberExtravaganza") ac.setSize(appWindow, 200, 200) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0) ac.setIconPosition(appWindow, 0, -10000) # Only enable rendering if app is activated ac.addOnAppActivatedListener(appWindow, onAppActivated) ac.addOnAppDismissedListener(appWindow, onAppDismissed) # Target Camber Labels Labels["target"] = ac.addLabel(appWindow, "Target:") ac.setPosition(Labels["target"], 85, 100) ac.setFontSize(Labels["target"], 10) Labels["targetCamberF"] = ac.addLabel(appWindow, "") ac.setPosition(Labels["targetCamberF"], 75, 76) ac.setFontSize(Labels["targetCamberF"], 24) Labels["targetCamberR"] = ac.addLabel(appWindow, "") ac.setPosition(Labels["targetCamberR"], 75, 105) ac.setFontSize(Labels["targetCamberR"], 24) # Options Checkbox CheckBoxes["options"] = ac.addCheckBox(appWindow, "Options") ac.setPosition(CheckBoxes["options"], 50, 225) ac.addOnCheckBoxChanged(CheckBoxes["options"], checkboxHandler) # Option Buttons uidata = [ ["drawGraphs", "Draw Graphs", drawGraphsHandler], ["normalize", "Normalize", normalizeHandler], ["useSpectrum", "Use Spectrum", useSpectrumHandler] ] x = 50 y = 255 dy = 30 for d in uidata: Buttons[d[0]] = ac.addButton(appWindow, d[1]) ac.setPosition(Buttons[d[0]], x, y) ac.setSize(Buttons[d[0]], 100, 25) ac.addOnClickedListener(Buttons[d[0]], d[2]) ac.setVisible(Buttons[d[0]], 0) y += dy # Get optimal camber from files loadTireData() CamberIndicators["FL"] = CamberIndicator(appWindow, 25, 75) CamberIndicators["FR"] = CamberIndicator(appWindow,125, 75) CamberIndicators["RL"] = CamberIndicator(appWindow, 25,175) CamberIndicators["RR"] = CamberIndicator(appWindow,125,175) ac.addRenderCallback(appWindow, onFormRender) return "CamberExtravaganza"
def acMain(ac_version): global appWindow, Labels, gearSpacing, fontSize, gears, PxPer1000RPM, RPMdivs appWindow = ac.newApp("Reventach") ac.setSize(appWindow, appWidth, appHeight) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0) ac.setIconPosition(appWindow, 0, -10000) ac.setTitle(appWindow, "") # Only enable rendering if app is activated ac.addOnAppActivatedListener(appWindow, onAppActivated) ac.addOnAppDismissedListener(appWindow, onAppDismissed) loadCarData() PxPer1000RPM = 1000 * appHeight / CarData["maxRPM"] RPMdivs = CarData["maxRPM"] // 10000 + 1 #~ fontSize = PxPer1000RPM * 0.5 * RPMdivs fontSize = appHeight / 15 y = appHeight - PxPer1000RPM * RPMdivs count = RPMdivs while y > -1: dx = (appHeight - y) / lineSlope Labels["rpmL" + str(count)] = ac.addLabel(appWindow, str(count)) ac.setPosition(Labels["rpmL" + str(count)], dx - fontSize, y - fontSize / 2) ac.setFontSize(Labels["rpmL" + str(count)], fontSize) ac.setFontAlignment(Labels["rpmL" + str(count)], "center") Labels["rpmR" + str(count)] = ac.addLabel(appWindow, str(count)) ac.setPosition(Labels["rpmR" + str(count)], appWidth - dx + fontSize, y - fontSize / 2) ac.setFontSize(Labels["rpmR" + str(count)], fontSize) ac.setFontAlignment(Labels["rpmR" + str(count)], "center") if y < PxPer1000RPM * RPMdivs - 1: ac.setFontColor(Labels["rpmL" + str(count)], 0.7, 0.0, 0.0, 0.9) ac.setFontColor(Labels["rpmR" + str(count)], 0.7, 0.0, 0.0, 0.9) y -= (PxPer1000RPM * RPMdivs) count += RPMdivs for n in range(CarData["totalGears"]): gears.insert(0, str(n + 1)) gearSpacing = appHeight / (CarData["totalGears"] + 2) fontSize = gearSpacing * 0.8 for n, c in enumerate(gears): Labels["gear" + c] = ac.addLabel(appWindow, c) ac.setPosition(Labels["gear" + c], appWidth / 2, (n * gearSpacing)) ac.setFontSize(Labels["gear" + c], fontSize) ac.setFontAlignment(Labels["gear" + c], "center") ac.addRenderCallback(appWindow, onFormRender) return "Reventach"
def acMain(ac_version): global app, rainStrengthValue, rainWiperSpeedValue app = ac.newApp("Shaders Patch Rain") ac.setTitle(app, "Rain") ac.setSize(app, 174, 108) y = 40 rainStrengthLabel = ac.addLabel(app, "Strength") ac.setPosition(rainStrengthLabel, 110, y) rainStrengthValue = ac.addLabel(app, "") ac.setPosition(rainStrengthValue, 48, y) rainStrengthDownButton = ac.addButton(app, "-") ac.setPosition(rainStrengthDownButton, 16, y) ac.setSize(rainStrengthDownButton, 24, 24) ac.setFontSize(rainStrengthDownButton, 14) ac.addOnClickedListener(rainStrengthDownButton, rainStrengthDown) rainStrengthUpButton = ac.addButton(app, "+") ac.setPosition(rainStrengthUpButton, 80, y) ac.setSize(rainStrengthUpButton, 24, 24) ac.setFontSize(rainStrengthUpButton, 14) ac.addOnClickedListener(rainStrengthUpButton, rainStrengthUp) y = 72 rainWiperSpeedLabel = ac.addLabel(app, "Wiper") ac.setPosition(rainWiperSpeedLabel, 110, y) rainWiperSpeedValue = ac.addLabel(app, "") ac.setPosition(rainWiperSpeedValue, 48, y) rainWiperSpeedDownButton = ac.addButton(app, "-") ac.setPosition(rainWiperSpeedDownButton, 16, y) ac.setSize(rainWiperSpeedDownButton, 24, 24) ac.setFontSize(rainWiperSpeedDownButton, 14) ac.addOnClickedListener(rainWiperSpeedDownButton, rainWiperSpeedDown) rainWiperSpeedUpButton = ac.addButton(app, "+") ac.setPosition(rainWiperSpeedUpButton, 80, y) ac.setSize(rainWiperSpeedUpButton, 24, 24) ac.setFontSize(rainWiperSpeedUpButton, 14) ac.addOnClickedListener(rainWiperSpeedUpButton, rainWiperSpeedUp) return "AccExtRain"
def __init__(self, appName): self.timer = 0 self.window = ac.newApp(appName) ac.setTitle(self.window, "") ac.drawBorder(self.window, 0) ac.setIconPosition(self.window, 0, -10000) ac.setSize(self.window, 367, 73) ac.setBackgroundOpacity(self.window, 0) self.fastestLapBanner = ac.addLabel(self.window, "") ac.setPosition(self.fastestLapBanner, 0, 0) w, h = get_image_size(FC.FASTEST_LAP_BANNER) ac.setSize(self.fastestLapBanner, w, h) ac.setBackgroundTexture(self.fastestLapBanner, FC.FASTEST_LAP_BANNER) self.fastestLapBackground = ac.addLabel(self.window, "") ac.setPosition(self.fastestLapBackground, w, 0) ac.setSize(self.fastestLapBackground, 400, h) ac.setBackgroundTexture(self.fastestLapBackground, FC.DRIVER_WIDGET_BACKGROUND) self.nameLabel = ac.addLabel(self.window, "") ac.setPosition(self.nameLabel, w + 10, 11) ac.setFontSize(self.nameLabel, 22) ac.setCustomFont(self.nameLabel, FC.FONT_NAME, 0, 0) ac.setFontColor(self.nameLabel, 0.86, 0.86, 0.86, 1) ac.setFontAlignment(self.nameLabel, "left") self.lastNameLabel = ac.addLabel(self.window, "") ac.setPosition(self.lastNameLabel, w + 10, 37) ac.setFontSize(self.lastNameLabel, 28) ac.setCustomFont(self.lastNameLabel, FC.FONT_NAME, 0, 1) ac.setFontColor(self.lastNameLabel, 0.86, 0.86, 0.86, 1) ac.setFontAlignment(self.lastNameLabel, "left") self.timeLabel = ac.addLabel(self.window, "") ac.setPosition(self.timeLabel, w + 385, 22) ac.setFontSize(self.timeLabel, 35) ac.setCustomFont(self.timeLabel, FC.FONT_NAME, 0, 1) ac.setFontColor(self.timeLabel, 0.86, 0.86, 0.86, 1) ac.setFontAlignment(self.timeLabel, "right")
def acMain(ac_version): global appWindow,FuelSelection,label1,label2,label3,NoChange,SuperSoft global SoftSlick,MediumSlick,HardSlick,SuperHard,Body,Engine,Suspension global DoOnce,ahk,response if DoOnce == 0: ahk = subprocess.Popen(["apps\python\PitVoice\Pitvoice.exe"]) DoOnce = 1 # appWindow = ac.newApp("PitVoice") ac.setSize(appWindow,350,250) ac.setTitle(appWindow,"") ac.setBackgroundOpacity(appWindow,0.5) ac.setBackgroundTexture(appWindow,"apps/python/PitVoice/PitMenu.png") # FuelSelection = ac.addSpinner(appWindow,"")#Fuel ac.setPosition(FuelSelection,87,110) ac.setSize(FuelSelection,175,25) ac.setFontColor(FuelSelection,1,1,0,1) ac.setFontSize(FuelSelection, 15) ac.setRange(FuelSelection,0,190) ac.setStep(FuelSelection,1) ac.addOnValueChangeListener(FuelSelection,FuelEvent) # NoChange = ac.addCheckBox(appWindow,"") ac.setPosition(NoChange,22,86) ac.setSize(NoChange,15,15) ac.addOnCheckBoxChanged(NoChange,NoChangeEvent) # SuperSoft = ac.addCheckBox(appWindow,"") ac.setPosition(SuperSoft,82,86) ac.setSize(SuperSoft,15,15) ac.addOnCheckBoxChanged(SuperSoft,SuperSoftEvent) # SoftSlick = ac.addCheckBox(appWindow,"") ac.setPosition(SoftSlick,138,86) ac.setSize(SoftSlick,15,15) ac.addOnCheckBoxChanged(SoftSlick,SoftSlickEvent) # MediumSlick = ac.addCheckBox(appWindow,"") ac.setPosition(MediumSlick,197,86) ac.setSize(MediumSlick,15,15) ac.addOnCheckBoxChanged(MediumSlick,MediumSlickEvent) # HardSlick = ac.addCheckBox(appWindow,"") ac.setPosition(HardSlick,255,86) ac.setSize(HardSlick,15,15) ac.addOnCheckBoxChanged(HardSlick,HardSlickEvent) # SuperHard = ac.addCheckBox(appWindow,"") ac.setPosition(SuperHard,313,86) ac.setSize(SuperHard,15,15) ac.addOnCheckBoxChanged(SuperHard,SuperHardEvent) # Body = ac.addCheckBox(appWindow,"") ac.setPosition(Body,59,229) ac.setSize(Body,15,15) ac.addOnCheckBoxChanged(Body,BodyEvent) # Engine = ac.addCheckBox(appWindow,"") ac.setPosition(Engine,169,229) ac.setSize(Engine,15,15) ac.addOnCheckBoxChanged(Engine,EngineEvent) # Suspension = ac.addCheckBox(appWindow,"") ac.setPosition(Suspension,276,229) ac.setSize(Suspension,15,15) ac.addOnCheckBoxChanged(Suspension,SuspensionEvent) # label1=ac.addLabel(appWindow,"Fuel +") ac.setPosition(label1,275,113) ac.setFontColor(label1,1,1,0,1) ac.setFontSize(label1, 15) # label2=ac.addLabel(appWindow,"Fuel -") ac.setPosition(label2,30,113) ac.setFontColor(label2,1,1,0,1) ac.setFontSize(label2, 15) # label3=ac.addLabel(appWindow,"0") ac.setPosition(label3,166,110) ac.setFontColor(label3,1,1,0,0) ac.setFontSize(label3, 15) # ResponseWit() return "PitVoice"
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()
def setFontSize(self, fontSize): self.fontSize = fontSize ac.setFontSize(self.label, self.fontSize) return self
def __init__(self, app, x, y): x_pressure = x x_dirt = x_pressure x_maxt = x + 80 x_maxp = x_maxt y_pressure = y + 20 y_dirt = y_pressure + 20 y_maxt = y + 8 y_maxp = y_maxt + 20 self.maxtFL = 0 self.maxtFR = 0 self.maxtRL = 0 self.maxtRR = 0 self.maxpFL = 0 self.maxpFR = 0 self.maxpRL = 0 self.maxpRR = 0 self.unitChar = "C" if inFahrenheit: self.unitChar = "F" ##initialize labels self.tFLValue = ac.addLabel(app, "temp fl") self.tFRValue = ac.addLabel(app, "temp fr") self.tRLValue = ac.addLabel(app, "temp rl") self.tRRValue = ac.addLabel(app, "temp rr") self.pFLValue = ac.addLabel(app, "psi fl") self.pFRValue = ac.addLabel(app, "psi fr") self.pRLValue = ac.addLabel(app, "psi rl") self.pRRValue = ac.addLabel(app, "psi rr") self.dFLValue = ac.addLabel(app, "dirt fl") self.dFRValue = ac.addLabel(app, "dirt fr") self.dRLValue = ac.addLabel(app, "dirt rl") self.dRRValue = ac.addLabel(app, "dirt rr") self.maxFont = ac.addLabel(app, "Max") self.maxtFont = ac.addLabel(app, self.unitChar) self.maxpFont = ac.addLabel(app, "psi") self.maxtFontBottom = ac.addLabel(app, self.unitChar) self.maxpFontBottom = ac.addLabel(app, "psi") self.maxtFLValue = ac.addLabel(app, "maxtemp fl") self.maxtFRValue = ac.addLabel(app, "maxtemp fr") self.maxtRLValue = ac.addLabel(app, "maxtemp rl") self.maxtRRValue = ac.addLabel(app, "maxtemp rr") self.maxpFLValue = ac.addLabel(app, "maxpress fl") self.maxpFRValue = ac.addLabel(app, "maxpress fr") self.maxpRLValue = ac.addLabel(app, "maxpress rl") self.maxpRRValue = ac.addLabel(app, "maxpress rr") ##set label positions ac.setPosition(self.tFLValue, x - 152, y) ac.setPosition(self.tFRValue, x + x_space, y) ac.setPosition(self.tRLValue, x - 152, y + y_space) ac.setPosition(self.tRRValue, x + x_space, y + y_space) ac.setPosition(self.pFLValue, x_pressure - 152, y_pressure) ac.setPosition(self.pFRValue, x_pressure + x_space, y_pressure) ac.setPosition(self.pRLValue, x_pressure - 152, y_pressure + y_space) ac.setPosition(self.pRRValue, x_pressure + x_space, y_pressure + y_space) ac.setPosition(self.dFLValue, x_dirt - 152, y_dirt) ac.setPosition(self.dFRValue, x_dirt + x_space, y_dirt) ac.setPosition(self.dRLValue, x_dirt - 152, y_dirt + y_space) ac.setPosition(self.dRRValue, x_dirt + x_space, y_dirt + y_space) ac.setPosition(self.maxFont, 137, 28) ac.setPosition(self.maxtFont, 145, 48) ac.setPosition(self.maxpFont, 140, 68) ac.setPosition(self.maxtFontBottom, 145, 123) ac.setPosition(self.maxpFontBottom, 140, 143) ac.setPosition(self.maxtFLValue, x_maxt, y_maxt) ac.setPosition(self.maxtFRValue, x_maxt - 96, y_maxt) ac.setPosition(self.maxtRLValue, x_maxt, y_maxt + y_space) ac.setPosition(self.maxtRRValue, x_maxt - 96, y_maxt + y_space) ac.setPosition(self.maxpFLValue, x_maxp, y_maxp) ac.setPosition(self.maxpFRValue, x_maxp - 96, y_maxp) ac.setPosition(self.maxpRLValue, x_maxp, y_maxp + y_space) ac.setPosition(self.maxpRRValue, x_maxp - 96, y_maxp + y_space) ##set label alignments ac.setFontAlignment(self.tFLValue, "right") ac.setFontAlignment(self.tRLValue, "right") ac.setFontAlignment(self.pFLValue, "right") ac.setFontAlignment(self.pRLValue, "right") ac.setFontAlignment(self.dFLValue, "right") ac.setFontAlignment(self.dRLValue, "right") ac.setFontAlignment(self.maxtFLValue, "left") ac.setFontAlignment(self.maxtFRValue, "right") ac.setFontAlignment(self.maxtRLValue, "left") ac.setFontAlignment(self.maxtRRValue, "right") ac.setFontAlignment(self.maxpFLValue, "left") ac.setFontAlignment(self.maxpFRValue, "right") ac.setFontAlignment(self.maxpRLValue, "left") ac.setFontAlignment(self.maxpRRValue, "right") ##set font size ac.setFontSize(self.maxFont, 12) ac.setFontSize(self.maxtFont, 12) ac.setFontSize(self.maxpFont, 12) ac.setFontSize(self.maxtFontBottom, 12) ac.setFontSize(self.maxpFontBottom, 12) ac.setFontSize(self.maxtFLValue, 12) ac.setFontSize(self.maxtFRValue, 12) ac.setFontSize(self.maxtRLValue, 12) ac.setFontSize(self.maxtRRValue, 12) ac.setFontSize(self.maxpFLValue, 12) ac.setFontSize(self.maxpFRValue, 12) ac.setFontSize(self.maxpRLValue, 12) ac.setFontSize(self.maxpRRValue, 12)
def setFontSize(self, fontSize): self.fontSize = fontSize ac.setFontSize(self.button, self.fontSize) return self
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 font_size(self, value): self._font_size = value ac.setFontSize(self.id, value)
def setFontSize(self, fontSize): ac.setFontSize(self.button, fontSize) return self
def setFontSize(self, fontSize): ac.setFontSize(self.label, fontSize) return self
def acMain(ac_version): global Status global appWindow, FuelSelection, FuelLabel, NoChange, Option1 global Option2, Option3, Option4, Option5, Body, Engine, Suspension, Fill, FuelOption, NotificationLabel, StatusLabel, Status global Preset1, Preset2, Preset3, Preset4 # appWindow = ac.newApp("BoxRadio") ac.setSize(appWindow, 180 * UiSize, 220 * UiSize) ac.setTitle(appWindow, "BoxRadio") ac.setBackgroundOpacity(appWindow, 0.5) ac.drawBorder(appWindow, 0) # FuelSelection = ac.addSpinner(appWindow, "") ac.setPosition(FuelSelection, 10 * UiSize, 99 * UiSize) ac.setSize(FuelSelection, 80 * UiSize, 18 * UiSize) ac.setFontColor(FuelSelection, 1, 1, 1, 1) ac.setFontSize(FuelSelection, 12 * UiSize) ac.setRange(FuelSelection, 0, int(FuelMax)) ac.setStep(FuelSelection, 1) ac.addOnValueChangeListener(FuelSelection, FuelEvent) # if FuelOption == True: FuelLabel = ac.addLabel(appWindow, "Fuel Add") ac.setPosition(FuelLabel, 10 * UiSize, 80 * UiSize) ac.setFontColor(FuelLabel, 1, 1, 1, 1) ac.setFontSize(FuelLabel, 13 * UiSize) else: FuelLabel = ac.addLabel(appWindow, "Fuel Total") ac.setPosition(FuelLabel, 10 * UiSize, 80 * UiSize) ac.setFontColor(FuelLabel, 1, 1, 1, 1) ac.setFontSize(FuelLabel, 13 * UiSize) # Fill = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Fill, 0) ac.drawBorder(Fill, 0) ac.setSize(Fill, 20 * UiSize, 20 * UiSize) ac.setPosition(Fill, 95 * UiSize, 98 * UiSize) ac.setBackgroundTexture(Fill, "apps/python/BoxRadio/img/fuel_fill_OFF.png") ac.addOnClickedListener(Fill, FillEvent) # NoChange = ac.addButton(appWindow, "") ac.setBackgroundOpacity(NoChange, 0) ac.drawBorder(NoChange, 0) ac.setSize(NoChange, 25 * UiSize, 25 * UiSize) ac.setPosition(NoChange, 125 * UiSize, 27 * UiSize) ac.setBackgroundTexture(NoChange, "content/gui/pitstop/tyre_no_change_ON.png") ac.addOnClickedListener(NoChange, NoChangeEvent) # Nochangelabel = ac.addLabel(appWindow, "No") ac.setPosition(Nochangelabel, 153 * UiSize, 31 * UiSize) ac.setFontColor(Nochangelabel, 1, 1, 1, 1) ac.setFontSize(Nochangelabel, 12 * UiSize) # Option1 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option1, 0) ac.drawBorder(Option1, 0) ac.setSize(Option1, 25 * UiSize, 25 * UiSize) ac.setPosition(Option1, 125 * UiSize, 52 * UiSize) ac.setBackgroundTexture(Option1, "content/gui/pitstop/tyre_1_OFF.png") ac.addOnClickedListener(Option1, Option1Event) if OptionLabel[1] == '': ac.setVisible(Option1, 0) # Option1label = ac.addLabel(appWindow, OptionLabel[1].upper()) ac.setPosition(Option1label, 153 * UiSize, 56 * UiSize) ac.setFontColor(Option1label, 1, 1, 1, 1) ac.setFontSize(Option1label, 13 * UiSize) # Option2 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option2, 0) ac.drawBorder(Option2, 0) ac.setSize(Option2, 25 * UiSize, 25 * UiSize) ac.setPosition(Option2, 125 * UiSize, 77 * UiSize) ac.setBackgroundTexture(Option2, "content/gui/pitstop/tyre_2_OFF.png") ac.addOnClickedListener(Option2, Option2Event) if OptionLabel[2] == '': ac.setVisible(Option2, 0) # Option2label = ac.addLabel(appWindow, OptionLabel[2].upper()) ac.setPosition(Option2label, 153 * UiSize, 81 * UiSize) ac.setFontColor(Option2label, 1, 1, 1, 1) ac.setFontSize(Option2label, 13 * UiSize) # Option3 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option3, 0) ac.drawBorder(Option3, 0) ac.setSize(Option3, 25 * UiSize, 25 * UiSize) ac.setPosition(Option3, 125 * UiSize, 102 * UiSize) ac.setBackgroundTexture(Option3, "content/gui/pitstop/tyre_3_OFF.png") ac.addOnClickedListener(Option3, Option3Event) if OptionLabel[3] == '': ac.setVisible(Option3, 0) # Option3label = ac.addLabel(appWindow, OptionLabel[3].upper()) ac.setPosition(Option3label, 153 * UiSize, 106 * UiSize) ac.setFontColor(Option3label, 1, 1, 1, 1) ac.setFontSize(Option3label, 13 * UiSize) # Option4 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option4, 0) ac.drawBorder(Option4, 0) ac.setSize(Option4, 25 * UiSize, 25 * UiSize) ac.setPosition(Option4, 125 * UiSize, 127 * UiSize) ac.setBackgroundTexture(Option4, "content/gui/pitstop/tyre_4_OFF.png") ac.addOnClickedListener(Option4, Option4Event) if OptionLabel[4] == '': ac.setVisible(Option4, 0) # Option4label = ac.addLabel(appWindow, OptionLabel[4].upper()) ac.setPosition(Option4label, 153 * UiSize, 131 * UiSize) ac.setFontColor(Option4label, 1, 1, 1, 1) ac.setFontSize(Option4label, 13 * UiSize) # Option5 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option5, 0) ac.drawBorder(Option5, 0) ac.setSize(Option5, 25 * UiSize, 25 * UiSize) ac.setPosition(Option5, 125 * UiSize, 152 * UiSize) ac.setBackgroundTexture(Option5, "content/gui/pitstop/tyre_5_OFF.png") ac.addOnClickedListener(Option5, Option5Event) if OptionLabel[5] == '': ac.setVisible(Option5, 0) # Option5label = ac.addLabel(appWindow, OptionLabel[5].upper()) ac.setPosition(Option5label, 153 * UiSize, 156 * UiSize) ac.setFontColor(Option5label, 1, 1, 1, 1) ac.setFontSize(Option5label, 13 * UiSize) # Suspension = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Suspension, 0) ac.drawBorder(Suspension, 0) ac.setSize(Suspension, 30 * UiSize, 30 * UiSize) ac.setPosition(Suspension, 10 * UiSize, 136 * UiSize) ac.setBackgroundTexture(Suspension, "content/gui/pitstop/repair_sus_OFF.png") ac.addOnClickedListener(Suspension, SuspensionEvent) # Body = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Body, 0) ac.drawBorder(Body, 0) ac.setSize(Body, 30 * UiSize, 30 * UiSize) ac.setPosition(Body, 48 * UiSize, 136 * UiSize) ac.setBackgroundTexture(Body, "content/gui/pitstop/repair_body_OFF.png") ac.addOnClickedListener(Body, BodyEvent) # Engine = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Engine, 0) ac.drawBorder(Engine, 0) ac.setSize(Engine, 30 * UiSize, 30 * UiSize) ac.setPosition(Engine, 85 * UiSize, 136 * UiSize) ac.setBackgroundTexture(Engine, "content/gui/pitstop/repair_engine_OFF.png") ac.addOnClickedListener(Engine, EngineEvent) # Preset1 = ac.addCheckBox(appWindow, "") ac.setPosition(Preset1, 10 * UiSize, 50 * UiSize) ac.setSize(Preset1, 20 * UiSize, 20 * UiSize) ac.drawBorder(Preset1, 1) ac.addOnCheckBoxChanged(Preset1, Preset1Event) # Preset2 = ac.addCheckBox(appWindow, "") ac.setPosition(Preset2, 37 * UiSize, 50 * UiSize) ac.setSize(Preset2, 20 * UiSize, 20 * UiSize) ac.drawBorder(Preset2, 1) ac.addOnCheckBoxChanged(Preset2, Preset2Event) # Preset3 = ac.addCheckBox(appWindow, "") ac.setPosition(Preset3, 65 * UiSize, 50 * UiSize) ac.setSize(Preset3, 20 * UiSize, 20 * UiSize) ac.drawBorder(Preset3, 1) ac.addOnCheckBoxChanged(Preset3, Preset3Event) # Preset4 = ac.addCheckBox(appWindow, "") ac.setPosition(Preset4, 93 * UiSize, 50 * UiSize) ac.setSize(Preset4, 20 * UiSize, 20 * UiSize) ac.drawBorder(Preset4, 1) ac.addOnCheckBoxChanged(Preset4, Preset4Event) # PresetLabel = ac.addLabel(appWindow, "Preset") ac.setPosition(PresetLabel, 10 * UiSize, 30 * UiSize) ac.setFontColor(PresetLabel, 1, 1, 1, 1) ac.setFontSize(PresetLabel, 13 * UiSize) # Preset1Label = ac.addLabel(appWindow, "1") ac.setPosition(Preset1Label, 16 * UiSize, 50 * UiSize) ac.setFontColor(Preset1Label, 0, 0, 0, 1) ac.setFontSize(Preset1Label, 15 * UiSize) # Preset2Label = ac.addLabel(appWindow, "2") ac.setPosition(Preset2Label, 43 * UiSize, 50 * UiSize) ac.setFontColor(Preset2Label, 0, 0, 0, 1) ac.setFontSize(Preset2Label, 15 * UiSize) # Preset3Label = ac.addLabel(appWindow, "3") ac.setPosition(Preset3Label, 71 * UiSize, 50 * UiSize) ac.setFontColor(Preset3Label, 0, 0, 0, 1) ac.setFontSize(Preset3Label, 15 * UiSize) # Preset4Label = ac.addLabel(appWindow, "4") ac.setPosition(Preset4Label, 99 * UiSize, 50 * UiSize) ac.setFontColor(Preset4Label, 0, 0, 0, 1) ac.setFontSize(Preset4Label, 15 * UiSize) # StatusLabel = ac.addLabel(appWindow, Status) ac.setPosition(StatusLabel, 10 * UiSize, 175 * UiSize) ac.setFontColor(StatusLabel, 1, 1, 1, 1) ac.setFontSize(StatusLabel, 10 * UiSize) # NotificationLabel = ac.addLabel(appWindow, Notify) ac.setPosition(NotificationLabel, 10 * UiSize, 195 * UiSize) ac.setFontColor(NotificationLabel, 1, 1, 1, 1) ac.setFontSize(NotificationLabel, 9 * UiSize) # return "BoxRadio"
def acMain(ac_version): global DRS_ALLOWED_CARS, SOUND_ON, SERVERS global tyreLabels, tyrePressureLabels global drsLabel, ersLabel, ersModeLabel, ersRecoveryLabel, fuelLabel, drsPenaltyLabel, drsPenaltyBackgroundLabel global drsZones, totalDrivers, trackLength, drsAvailableZones, driversList global carValue, trackConfigValue, trackValue global compounds, modCompounds carValue = ac.getCarName(0) trackValue = ac.getTrackName(0) trackConfigValue = ac.getTrackConfiguration(0) settings = configparser.ConfigParser() settings.read("apps/python/%s/config.ini" % APP_NAME) if settings.has_section('CARS'): DRS_ALLOWED_CARS.extend( [c for c in settings['CARS'] if settings['CARS'][c] == '1']) if settings.has_section('SETTINGS'): SOUND_ON = True if 'sound' in settings['SETTINGS'] and settings[ 'SETTINGS']['sound'] == '1' else False if settings.has_section('SERVERS'): SERVERS = list(settings['SERVERS'].values()) drsZones = loadDRSZones() totalDrivers = ac.getCarsCount() trackLength = getTrackLength() driversList = [Driver(i, len(drsZones)) for i in range(totalDrivers)] drsAvailableZones = [False] * len(drsZones) compounds = configparser.ConfigParser() compounds.read(COMPOUNDSPATH + "compounds.ini") modCompounds = configparser.ConfigParser() modCompounds.read(COMPOUNDSPATH + carValue + ".ini") ac.initFont(0, FONT_NAME, 0, 0) appWindow = ac.newApp(APP_NAME) ac.setTitle(appWindow, "") ac.drawBorder(appWindow, 0) ac.setIconPosition(appWindow, 0, -10000) ac.setSize(appWindow, 280, 70) ac.setBackgroundOpacity(appWindow, 0.2) # ================================================================================================================= # TYRE LABELS # ================================================================================================================= tyreLabelFL = ac.addLabel(appWindow, "") tyreLabelFR = ac.addLabel(appWindow, "") tyreLabelRL = ac.addLabel(appWindow, "") tyreLabelRR = ac.addLabel(appWindow, "") tyreLabels = [tyreLabelFL, tyreLabelFR, tyreLabelRL, tyreLabelRR] for label in tyreLabels: ac.setFontSize(label, 15) ac.setFontColor(label, 0, 0, 0, 1) ac.setFontAlignment(label, "center") ac.setSize(label, 15, 23) tyrePressureLabelFL = ac.addLabel(appWindow, "PFL") tyrePressureLabelFR = ac.addLabel(appWindow, "PFR") tyrePressureLabelRL = ac.addLabel(appWindow, "PRL") tyrePressureLabelRR = ac.addLabel(appWindow, "PRR") tyrePressureLabels = [ tyrePressureLabelFL, tyrePressureLabelFR, tyrePressureLabelRL, tyrePressureLabelRR ] for label in tyrePressureLabels: ac.setFontSize(label, 15) ac.setFontColor(label, 0.86, 0.86, 0.86, 1) ac.setCustomFont(label, FONT_NAME, 0, 0) ac.setFontAlignment(tyrePressureLabels[0], "right") ac.setFontAlignment(tyrePressureLabels[1], "left") ac.setFontAlignment(tyrePressureLabels[2], "right") ac.setFontAlignment(tyrePressureLabels[3], "left") #position all the labels tlpx = 180 tlpy = 10 ac.setPosition(tyreLabels[0], tlpx + 5, tlpy + 0) ac.setPosition(tyreLabels[1], tlpx + 25, tlpy + 0) ac.setPosition(tyreLabels[2], tlpx + 5, tlpy + 28) ac.setPosition(tyreLabels[3], tlpx + 25, tlpy + 28) ac.setPosition(tyrePressureLabels[0], tlpx, tlpy + 2) ac.setPosition(tyrePressureLabels[1], tlpx + 43, tlpy + 2) ac.setPosition(tyrePressureLabels[2], tlpx, tlpy + 30) ac.setPosition(tyrePressureLabels[3], tlpx + 43, tlpy + 30) # ================================================================================================================= # ERS MODES LABELS # ================================================================================================================= elpx = 15 elpy = 10 ersModeLabel = ac.addLabel(appWindow, "🗲0") ac.setPosition(ersModeLabel, elpx + 50, elpy) ac.setFontSize(ersModeLabel, 18) ac.setCustomFont(ersModeLabel, FONT_NAME, 0, 0) ac.setFontColor(ersModeLabel, 1.0, 1.0, 0.2, 1) ac.setFontAlignment(ersModeLabel, "left") ersRecoveryLabel = ac.addLabel(appWindow, "") ac.setPosition(ersRecoveryLabel, elpx + 85, elpy) ac.setFontSize(ersRecoveryLabel, 18) ac.setCustomFont(ersRecoveryLabel, FONT_NAME, 0, 0) ac.setFontColor(ersRecoveryLabel, 1.0, 1.0, 0.2, 1) ac.setFontAlignment(ersRecoveryLabel, "left") ersLabel = ac.addLabel(appWindow, "ERS:") ac.setPosition(ersLabel, elpx, elpy) ac.setFontSize(ersLabel, 18) ac.setCustomFont(ersLabel, FONT_NAME, 0, 0) ac.setFontColor(ersLabel, 1.0, 1.0, 0.2, 1) ac.setFontAlignment(ersLabel, "left") # ================================================================================================================= # FUEL LABEL # ================================================================================================================= fuelLabel = ac.addLabel(appWindow, "💧 --.- Laps") ac.setPosition(fuelLabel, 15, 36) ac.setFontSize(fuelLabel, 18) ac.setCustomFont(fuelLabel, FONT_NAME, 0, 0) ac.setFontColor(fuelLabel, 0.86, 0.86, 0.86, 1) ac.setFontAlignment(fuelLabel, "left") # ================================================================================================================= # DRS LABELS # ================================================================================================================= drsLabel = ac.addLabel(appWindow, "") ac.setPosition(drsLabel, -70, 0) ac.setSize(drsLabel, 70, 70) ac.setVisible(drsLabel, 0) drsPenaltyBackgroundLabel = ac.addLabel(appWindow, "") ac.setPosition(drsPenaltyBackgroundLabel, 0, 70) ac.setSize(drsPenaltyBackgroundLabel, 280, 25) ac.setBackgroundTexture(drsPenaltyBackgroundLabel, DRS_PENALTY_TEXTURE) ac.setVisible(drsPenaltyBackgroundLabel, 0) drsPenaltyLabel = ac.addLabel(appWindow, "") ac.setPosition(drsPenaltyLabel, 150, 70) ac.setFontSize(drsPenaltyLabel, 18) ac.setCustomFont(drsPenaltyLabel, FONT_NAME, 0, 1) ac.setFontColor(drsPenaltyLabel, 0.86, 0.86, 0.86, 1) ac.setFontAlignment(drsPenaltyLabel, "center") ac.setVisible(drsPenaltyLabel, 0) # Announce Start timer = threading.Timer(10, announceStart) timer.start() return APP_NAME
def acMain(ac_version): global appWindow global sound_player, SoundPackSpinner, VolumeSpinner global Beforerace, Overtake, Suspense, Win, Lose, labeldesc, Hotlap global StatusLabel, NotificationLabel, audio, audiolist, BeforeraceLabel, OvertakeLabel, SuspenseLabel global WinLabel, LoseLabel, audiolabel, position, debuglabel # DEBUG INFO global enable_overtake, enable_lose, enable_win, enable_hotlap global enable_before_race, enable_suspense, suspense_laps, log global audio, overtake, position, newposition, start_time, finish_time, count_overtake global session, sessionTime, numberOfLaps, completedLaps appWindow = ac.newApp("Epic Race") ac.setSize(appWindow, 430, 350) ac.setTitle(appWindow, "Epic Race") ac.setBackgroundOpacity(appWindow, 0.5) ac.drawBorder(appWindow, 0) # SoundPackSpinner = ac.addSpinner(appWindow, "") ac.setFontColor(SoundPackSpinner, 1, 1, 1, 1) ac.setFontSize(SoundPackSpinner, 12) spinner_config(SoundPackSpinner, 10, 55, 80, 18, 0, 1, 10, 0, onSoundPackChanged) # VolumeSpinner = ac.addSpinner(appWindow, "") ac.setFontColor(VolumeSpinner, 1, 1, 1, 1) ac.setFontSize(VolumeSpinner, 12) spinner_config(VolumeSpinner, 10, 105, 80, 18, 0, 1, 100, audio_volume, onVolumeChanged) # audiolabel = ac.addLabel(appWindow, "") ac.setPosition(audiolabel, 10, 30) ac.setFontColor(audiolabel, 1, 1, 1, 1) ac.setFontSize(audiolabel, 15) # volumelabel = ac.addLabel(appWindow, "Volume") ac.setPosition(volumelabel, 10, 80) ac.setFontColor(volumelabel, 1, 1, 1, 1) ac.setFontSize(volumelabel, 15) Beforerace = ac.addCheckBox(appWindow, "") ac.setValue(Beforerace, enable_before_race) ac.setPosition(Beforerace, 10, 130) ac.setSize(Beforerace, 20, 20) ac.drawBorder(Beforerace, 1) ac.addOnCheckBoxChanged(Beforerace, onEnableBeforeRace) # Overtake = ac.addCheckBox(appWindow, "") ac.setValue(Overtake, enable_overtake) ac.setPosition(Overtake, 10, 160) ac.setSize(Overtake, 20, 20) ac.drawBorder(Overtake, 1) ac.addOnCheckBoxChanged(Overtake, onEnableOverTake) # Suspense = ac.addCheckBox(appWindow, "") ac.setValue(Suspense, enable_suspense) ac.setPosition(Suspense, 10, 190) ac.setSize(Suspense, 20, 20) ac.drawBorder(Suspense, 1) ac.addOnCheckBoxChanged(Suspense, onEnableSuspense) # Win = ac.addCheckBox(appWindow, "") ac.setValue(Win, enable_win) ac.setPosition(Win, 10, 220) ac.setSize(Win, 20, 20) ac.drawBorder(Win, 1) ac.addOnCheckBoxChanged(Win, onEnableWin) # Lose = ac.addCheckBox(appWindow, "") ac.setValue(Lose, enable_lose) ac.setPosition(Lose, 10, 250) ac.setSize(Lose, 20, 20) ac.drawBorder(Lose, 1) ac.addOnCheckBoxChanged(Lose, onEnableLose) # Hotlap = ac.addCheckBox(appWindow, "") ac.setValue(Hotlap, enable_hotlap) ac.setPosition(Hotlap, 10, 280) ac.setSize(Hotlap, 20, 20) ac.drawBorder(Hotlap, 1) ac.addOnCheckBoxChanged(Hotlap, onEnableHotlap) # BeforeraceLabel = ac.addLabel(appWindow, "Enable before race") ac.setPosition(BeforeraceLabel, 40, 130) ac.setFontColor(BeforeraceLabel, 1, 1, 1, 1) ac.setFontSize(BeforeraceLabel, 15) # OvertakeLabel = ac.addLabel(appWindow, "Enable overtake") ac.setPosition(OvertakeLabel, 40, 160) ac.setFontColor(OvertakeLabel, 1, 1, 1, 1) ac.setFontSize(OvertakeLabel, 15) # SuspenseLabel = ac.addLabel(appWindow, "Enable suspense") ac.setPosition(SuspenseLabel, 40, 190) ac.setFontColor(SuspenseLabel, 1, 1, 1, 1) ac.setFontSize(SuspenseLabel, 15) # WinLabel = ac.addLabel(appWindow, "Enable win") ac.setPosition(WinLabel, 40, 220) ac.setFontColor(WinLabel, 1, 1, 1, 1) ac.setFontSize(WinLabel, 15) # LoseLabel = ac.addLabel(appWindow, "Enable lose") ac.setPosition(LoseLabel, 40, 250) ac.setFontColor(LoseLabel, 1, 1, 1, 1) ac.setFontSize(LoseLabel, 15) # HotlapLabel = ac.addLabel(appWindow, "Enable hotlap") ac.setPosition(HotlapLabel, 40, 280) ac.setFontColor(HotlapLabel, 1, 1, 1, 1) ac.setFontSize(HotlapLabel, 15) # labeldesc = ac.addLabel(appWindow, "Something is broken") ac.setPosition(labeldesc, 180, 40) ac.setSize(labeldesc, 200, 200) # StatusLabel = ac.addLabel(appWindow, Status) ac.setPosition(StatusLabel, 10, 305) ac.setFontColor(StatusLabel, 1, 1, 1, 1) ac.setFontSize(StatusLabel, 15) # NotificationLabel = ac.addLabel(appWindow, Notify) ac.setPosition(NotificationLabel, 10, 325) ac.setFontColor(NotificationLabel, 1, 1, 1, 1) ac.setFontSize(NotificationLabel, 12) ac.setSize(NotificationLabel, 24, 310) # # DEBUG INFO # debuglabel = ac.addLabel(appWindow, "") ac.setPosition(debuglabel, 215, 30) ac.setSize(debuglabel, 200, 200) # # # box.FModSystem.init() sound_player = box.SoundPlayer(box.FModSystem) sound_player.set_volume(audio_volume / 100) sound_player.set_gain(2.0) audiolist = os.listdir(os.path.join(os.path.dirname(__file__), "SoundPacks")) ac.setRange(SoundPackSpinner, 0, len(audiolist) - 1) ac.setStep(SoundPackSpinner, 1) ac.setValue(SoundPackSpinner, audiolist.index(audio)) getNotification() if AutoUpdate: CheckNewUpdate() position = ac.getCarRealTimeLeaderboardPosition(0) return "EpicRace"