Ejemplo n.º 1
0
	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
Ejemplo n.º 2
0
    def set_custom_font(self, font, italic=0):
        """Set custom font for text label.

        Args:
            font (str): Name of the font, must be initialized.
            italic (0/1): Optional, italics yes/no.
        """
        ac.setCustomFont(self.id, font, italic, 0)
Ejemplo n.º 3
0
	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)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    def font_family(self, font_family):
        if isinstance(font_family, str):
            self._font_family = font_family

            if self._ac_obj is not None:
                ac.setCustomFont(self._ac_obj, self._font_family,
                                 self._font_italic, self._font_bold)

        elif isinstance(font_family, Font):
            self._font_family = font_family.font_name

            if self._ac_obj is not None:
                ac.setCustomFont(self._ac_obj, self._font_family,
                                 self._font_italic, self._font_bold)
Ejemplo n.º 6
0
 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 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
Ejemplo n.º 8
0
    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")
Ejemplo n.º 9
0
def acMain(ac_version):
    # VARIABLES
    global totalDrivers
    global drivers

    global leaderboardWindow, driverWidget, driverComparisonWidget, fastest_lap_banner
    # LABELS
    global leaderboard
    global lapCountTimerLabel, leaderboardBaseLabel, leaderboardInfoBackgroundLabel, leaderboardBackgroundLabel
    global flagLabel

    totalDrivers = ac.getCarsCount()
    n_splits = ac.getTrackLength(0) / FC.TRACK_SECTION_LENGTH
    drivers = [Driver(i, n_splits) for i in range(totalDrivers)] # driver positions and update times

    ac.initFont(0, FC.FONT_NAME, 0, 0)

    leaderboardWindow = ac.newApp(FC.APP_NAME)
    ac.setTitle(leaderboardWindow, "")
    ac.drawBorder(leaderboardWindow, 0)
    ac.setIconPosition(leaderboardWindow, 0, -10000)
    ac.setSize(leaderboardWindow, 200, 200)
    ac.setBackgroundOpacity(leaderboardWindow, 0)

    # ===============================
    # Leaderboard Background
    leaderboardBaseLabel = ac.addLabel(leaderboardWindow, "")
    ac.setPosition(leaderboardBaseLabel, 0, 0)
    w, h = get_image_size(FC.LEADERBOARD_BASE_RACE)
    ac.setSize(leaderboardBaseLabel, w, h)
    ac.setBackgroundTexture(leaderboardBaseLabel, FC.LEADERBOARD_BASE_RACE)

    leaderboardBackgroundLabel = ac.addLabel(leaderboardWindow, "")
    ac.setPosition(leaderboardBackgroundLabel, 0, h)
    ac.setSize(leaderboardBackgroundLabel, w, totalDrivers*LeaderboardRow.ROW_HEIGHT + 2)
    ac.setBackgroundTexture(leaderboardBackgroundLabel, FC.LEADERBOARD_BACKGROUND);
    
    # ===============================
    # Lap Counter / Time
    lapCountTimerLabel = ac.addLabel(leaderboardWindow, "")
    ac.setPosition(lapCountTimerLabel, 74, 52)
    ac.setFontSize(lapCountTimerLabel, 22)
    ac.setCustomFont(lapCountTimerLabel, FC.FONT_NAME, 0, 1)
    ac.setFontAlignment(lapCountTimerLabel, "center")
    ac.setFontColor(lapCountTimerLabel, 0.86, 0.86, 0.86, 1)

    # ===============================
    # Flags
    flagLabel = ac.addLabel(leaderboardWindow, "")
    ac.setPosition(flagLabel, w, 8)
    ac.setSize(flagLabel, 110, h-8)
    ac.setVisible(flagLabel, 0)

    # ===============================
    # Info Background
    leaderboardInfoBackgroundLabel = ac.addLabel(leaderboardWindow, "")
    ac.setPosition(leaderboardInfoBackgroundLabel, w, h)
    ac.setSize(leaderboardInfoBackgroundLabel, 110, totalDrivers*LeaderboardRow.ROW_HEIGHT + 2)
    ac.setBackgroundTexture(leaderboardInfoBackgroundLabel, FC.LEADERBOARD_INFO_BACKGROUNG)

    info_button = ac.addButton(leaderboardWindow, "")
    ac.setPosition(info_button, w, h)
    ac.setSize(info_button, 110, totalDrivers*LeaderboardRow.ROW_HEIGHT + 2)
    ac.addOnClickedListener(info_button, on_click_info)
    ac.setBackgroundOpacity(info_button, 0)
    ac.drawBorder(info_button, 0)

    # ===============================
    # Driver Widget
    driverWidget = DriverWidget(FC.APP_NAME+" Driver")

    # ===============================
    # Driver Comparison Widget
    driverComparisonWidget = DriverComparisonWidget(FC.APP_NAME+" Driver Comparison")

    # ===============================
    # FastestLap Banner
    fastest_lap_banner = FastestLapBanner(FC.APP_NAME+" Top Banner")
    fastest_lap_banner.hide()

    leaderboard = [None] * totalDrivers
    for i in range(totalDrivers):
        leaderboard[i] = LeaderboardRow(leaderboardWindow, i)

    return FC.APP_NAME
Ejemplo n.º 10
0
    def font_bold(self, font_bold):
        self._font_bold = font_bold

        if self._ac_obj is not None:
            ac.setCustomFont(self._ac_obj, self._font_family,
                             self._font_italic, self._font_bold)
Ejemplo n.º 11
0
    def __init__(self, appName):
        self.id = -1
        self.visible = True
        self.extended = False
        self.position = -1

        self.window = ac.newApp(appName)
        ac.setTitle(self.window, "")
        ac.drawBorder(self.window, 0)
        ac.setIconPosition(self.window, 0, -10000)
        ac.setSize(self.window, 300, 100)
        ac.setBackgroundOpacity(self.window, 0)

        self.backgroundTexture = ac.addLabel(self.window, "")
        w, h = get_image_size(FC.DRIVER_WIDGET_BACKGROUND)
        ac.setPosition(self.backgroundTexture, 0, 0)
        ac.setSize(self.backgroundTexture, w, h)
        ac.setBackgroundTexture(self.backgroundTexture,
                                FC.DRIVER_WIDGET_BACKGROUND)

        self.rolexLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.rolexLabel, 0, -72)
        ac.setSize(self.rolexLabel, 123, 70)
        ac.setBackgroundTexture(self.rolexLabel, FC.ROLEX_LOGO)

        self.positionLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.positionLabel, 3, 3)
        ac.setSize(self.positionLabel, 62, 62)

        self.teamLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.teamLabel, 71, 10)
        ac.setSize(self.teamLabel, 6, 45)

        self.nameLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.nameLabel, 90, 11)
        ac.setFontSize(self.nameLabel, 23)
        ac.setCustomFont(self.nameLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.nameLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.nameLabel, "left")

        self.teamNameLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.teamNameLabel, 90, 40)
        ac.setFontSize(self.teamNameLabel, 18)
        ac.setCustomFont(self.teamNameLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.teamNameLabel, 0.66, 0.66, 0.66, 1)
        ac.setFontAlignment(self.teamNameLabel, "left")

        self.numberLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.numberLabel, w - 63, 7)
        ac.setSize(self.numberLabel, 55, 55)

        self.button = ac.addButton(self.window, "")
        ac.setPosition(self.button, 0, 0)
        ac.setSize(self.button, w, h)
        ac.addOnClickedListener(self.button, self.toogle_extended)
        ac.setBackgroundOpacity(self.button, 0)
        ac.drawBorder(self.button, 0)

        self.extendedBackgroundTexture = ac.addLabel(self.window, "")
        ac.setPosition(self.extendedBackgroundTexture, 0, h)
        w, h = get_image_size(FC.DRIVER_WIDGET_EXTENDED_BACKGROUND)
        ac.setSize(self.extendedBackgroundTexture, w, h)
        ac.setBackgroundTexture(self.extendedBackgroundTexture,
                                FC.DRIVER_WIDGET_EXTENDED_BACKGROUND)

        self.startedTextLabel = ac.addLabel(self.window, "STARTED")
        ac.setPosition(self.startedTextLabel, 70, 135)
        ac.setFontSize(self.startedTextLabel, 18)
        ac.setCustomFont(self.startedTextLabel, FC.FONT_NAME, 0, 0)
        ac.setFontColor(self.startedTextLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.startedTextLabel, "center")

        self.placesTextLabel = ac.addLabel(self.window, "PLACES")
        ac.setPosition(self.placesTextLabel, 175, 135)
        ac.setFontSize(self.placesTextLabel, 18)
        ac.setCustomFont(self.placesTextLabel, FC.FONT_NAME, 0, 0)
        ac.setFontColor(self.placesTextLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.placesTextLabel, "center")

        self.tyreTextLabel = ac.addLabel(self.window, "TYRES")
        ac.setPosition(self.tyreTextLabel, 285, 135)
        ac.setFontSize(self.tyreTextLabel, 18)
        ac.setCustomFont(self.tyreTextLabel, FC.FONT_NAME, 0, 0)
        ac.setFontColor(self.tyreTextLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.tyreTextLabel, "center")

        self.pitStopTextLabel = ac.addLabel(self.window, "PIT STOPS")
        ac.setPosition(self.pitStopTextLabel, 395, 135)
        ac.setFontSize(self.pitStopTextLabel, 18)
        ac.setCustomFont(self.pitStopTextLabel, FC.FONT_NAME, 0, 0)
        ac.setFontColor(self.pitStopTextLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.pitStopTextLabel, "center")

        self.startedLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.startedLabel, 70, 86)
        ac.setFontSize(self.startedLabel, 34)
        ac.setCustomFont(self.startedLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.startedLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.startedLabel, "center")

        self.placesLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.placesLabel, 175, 86)
        ac.setFontSize(self.placesLabel, 34)
        ac.setCustomFont(self.placesLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.placesLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.placesLabel, "center")

        self.placesIconLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.placesIconLabel, 135, 84)
        ac.setSize(self.placesIconLabel, 35, 35)

        self.tyreLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.tyreLabel, 263, 78)
        ac.setSize(self.tyreLabel, 46, 46)

        self.pitStopLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.pitStopLabel, 395, 86)
        ac.setFontSize(self.pitStopLabel, 34)
        ac.setCustomFont(self.pitStopLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.pitStopLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.pitStopLabel, "center")

        ac.setVisible(self.extendedBackgroundTexture, 0)
        ac.setVisible(self.startedLabel, 0)
        ac.setVisible(self.startedTextLabel, 0)
        ac.setVisible(self.placesLabel, 0)
        ac.setVisible(self.placesTextLabel, 0)
        ac.setVisible(self.placesIconLabel, 0)
        ac.setVisible(self.tyreTextLabel, 0)
        ac.setVisible(self.tyreLabel, 0)
        ac.setVisible(self.pitStopTextLabel, 0)
        ac.setVisible(self.pitStopLabel, 0)
def acMain(ac_version):
    global app, label, stepBackButton, resetButton, sVer
    global vaoToggleButton, vaoDebugButton, lightsDebugButton, copyCameraCoordsButton
    global doorToggleButton, driverToggleButton

    try:
        app = ac.newApp("Shaders Patch Debug")
        ac.setTitle(app, "  Shaders Patch Debug")
        ac.setSize(app, 180, 358)
        ac.drawBackground(app, 0)

        driverToggleButton = ac.addButton(app, "Driver")
        ac.setPosition(driverToggleButton, 20, 25)
        ac.setSize(driverToggleButton, 40, 20)
        ac.setFontSize(driverToggleButton, 12)
        ac.addOnClickedListener(driverToggleButton, driverToggle)

        doorToggleButton = ac.addButton(app, "🚪")
        ac.setPosition(doorToggleButton, 70, 25)
        ac.setCustomFont(doorToggleButton,
                         "Segoe UI Symbol; Weight=UltraLight", 0, 0)
        ac.setSize(doorToggleButton, 40, 20)
        ac.setFontSize(doorToggleButton, 14)
        ac.addOnClickedListener(doorToggleButton, doorToggle)

        copyCameraCoordsButton = ac.addButton(app, "Copy")
        ac.setPosition(copyCameraCoordsButton, 120, 25)
        ac.setSize(copyCameraCoordsButton, 40, 20)
        ac.setFontSize(copyCameraCoordsButton, 12)
        ac.addOnClickedListener(copyCameraCoordsButton, copyCameraCoords)

        vaoToggleButton = ac.addButton(app, "V +/−")
        ac.setPosition(vaoToggleButton, 20, 45)
        ac.setSize(vaoToggleButton, 40, 20)
        ac.setFontSize(vaoToggleButton, 12)
        ac.addOnClickedListener(vaoToggleButton, vaoToggle)

        vaoDebugButton = ac.addButton(app, "V o/N")
        ac.setPosition(vaoDebugButton, 70, 45)
        ac.setSize(vaoDebugButton, 40, 20)
        ac.setFontSize(vaoDebugButton, 12)
        ac.addOnClickedListener(vaoDebugButton, vaoDebug)

        lightsDebugButton = ac.addButton(app, "🔦")
        ac.setPosition(lightsDebugButton, 120, 45)
        ac.setSize(lightsDebugButton, 40, 20)
        ac.setFontSize(lightsDebugButton, 14)
        ac.addOnClickedListener(lightsDebugButton, lightsDebug)

        stepBackButton = ac.addButton(app, "Step back")
        ac.setPosition(stepBackButton, 20, 65)
        ac.setSize(stepBackButton, 140, 20)
        ac.setFontSize(stepBackButton, 12)
        ac.addOnClickedListener(stepBackButton, takeAStepBack)
        ac.setCustomFont(stepBackButton, "Segoe UI; Weight=UltraBlack", 0, 0)

        resetButton = ac.addButton(app, "Reset")
        ac.setPosition(resetButton, 20, 85)
        ac.setSize(resetButton, 140, 20)
        ac.setFontSize(resetButton, 12)
        ac.addOnClickedListener(resetButton, resetCar)
        ac.setCustomFont(resetButton, "Segoe UI; Weight=UltraBlack", 0, 0)

        label = ac.addLabel(app, "")
        ac.setFontSize(label, 12)
        ac.setPosition(label, 5, 103)

        sVer = "CSP v" + str(ac.ext_patchVersion()) + "-code" + str(
            ac.ext_patchVersionCode())
        # i = 0
        # while i < 1200:
        #     labelTemp = ac.setPosition(ac.addLabel(app, "Label #" + str(i)), 5, 30 + i)
        #     ac.setFontSize(labelTemp, 14 + (i % 10))
        #     i += 1
    except:
        ac.log("Unexpected error:" + traceback.format_exc())
    return "AccExtHelper"
def acMain(ac_version):
    global appWindow, CamberIndicators, CheckBoxes, Buttons, Options, Labels, UIData

    try:
        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)

        # Custom monospace font
        ac.initFont(0, customFont, 0, 0)

        # Target Camber Labels
        Labels["target"] = ac.addLabel(appWindow, "Target:")
        if Options["showDelta"]:
            ac.setText(Labels["target"], "Delta:")
        else:
            ac.setText(Labels["target"], "Target:")
        ac.setPosition(Labels["target"], 85, 100)
        ac.setCustomFont(Labels["target"], customFont, 0, 0)
        ac.setFontSize(Labels["target"], 10)
        Labels["targetCamberF"] = ac.addLabel(appWindow, "")
        ac.setPosition(Labels["targetCamberF"], 65, 76)
        ac.setCustomFont(Labels["targetCamberF"], customFont, 0, 0)
        ac.setFontSize(Labels["targetCamberF"], 24)
        Labels["targetCamberR"] = ac.addLabel(appWindow, "")
        ac.setPosition(Labels["targetCamberR"], 65, 105)
        ac.setCustomFont(Labels["targetCamberR"], customFont, 0, 0)
        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],
                  ["showDelta", "Show Delta", showDeltaHandler]]
        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, 15, 75)
        CamberIndicators["FR"] = CamberIndicator(appWindow, 135, 75)
        CamberIndicators["RL"] = CamberIndicator(appWindow, 15, 175)
        CamberIndicators["RR"] = CamberIndicator(appWindow, 135, 175)
        ac.addRenderCallback(appWindow, onFormRender)

    except Exception:
        ac.log("CamberExtravaganza ERROR: acMain(): %s" %
               traceback.format_exc())

    return "CamberExtravaganza"
Ejemplo n.º 14
0
 def font(self, value):
     ac.setCustomFont(self.id, value, 0, 0)
Ejemplo n.º 15
0
def acMain(acVersion):
    global appName, appWindow, info, imagePath
    global fName, fSmall, fNormal, fLarge, fxLarge, fGear, fSpeed
    global output_speed, speed, gear, output_gear
    global absVal, text_abs, tcsVal, text_tcs
    global output_Fuel_R

    # App Window MAIN
    appWindow = ac.newApp(appName)
    ac.setTitle(appWindow, "")
    ac.setSize(appWindow, 640, 78)
    ac.setIconPosition(appWindow, 0, -10000)
    ac.drawBorder(appWindow, 0)
    ac.initFont(0, fName, 0, 0)

    # Gear
    text_gear = ac.addLabel(appWindow, "gear")
    ac.setFontSize(text_gear, fNormal)
    ac.setPosition(text_gear, 0, 52)
    ac.setFontColor(text_gear, 1, 1, 1, 0.83)
    ac.setCustomFont(text_gear, fName, 0, 0)

    output_gear = ac.addLabel(appWindow, "")
    ac.setFontSize(output_gear, fGear)
    ac.setFontAlignment(output_gear, "center")
    ac.setPosition(output_gear, 26, 4)
    ac.setCustomFont(output_gear, fName, 0, 0)
    ac.setFontColor(output_gear, 0, 0, 0, 0.55)

    # TCS
    text_tcs = ac.addLabel(appWindow, "tcs")
    ac.setPosition(text_tcs, 65, 52)
    ac.setFontSize(text_tcs, fNormal)
    ac.setFontColor(text_tcs, 1, 1, 1, 0.83)
    ac.setCustomFont(text_tcs, fName, 0, 0)

    # ABS
    text_abs = ac.addLabel(appWindow, "abs")
    ac.setPosition(text_abs, 110, 52)
    ac.setFontSize(text_abs, fNormal)
    ac.setFontColor(text_abs, 1, 1, 1, 0.83)
    ac.setCustomFont(text_abs, fName, 0, 0)

    #Speed
    text_speed = ac.addLabel(appWindow, "km\h")
    ac.setPosition(text_speed, 610, 52)
    ac.setFontAlignment(text_speed, "right")
    ac.setFontSize(text_speed, fNormal)
    ac.setFontColor(text_speed, 1, 1, 1, 0.83)
    ac.setCustomFont(text_speed, fName, 0, 0)

    output_speed = ac.addLabel(appWindow, "")
    ac.setFontSize(output_speed, fSpeed)
    ac.setFontAlignment(output_speed, "right")
    ac.setPosition(output_speed, 610, -6)
    ac.setFontColor(output_speed, 1, 1, 1, 0.83)
    ac.setCustomFont(output_speed, fName, 0, 0)

    #Fuel - Remaining litres
    text_Fuel_R = ac.addLabel(appWindow, "Fuel:")
    ac.setFontSize(text_Fuel_R, fNormal)
    ac.setFontAlignment(text_Fuel_R, "right")
    ac.setPosition(text_Fuel_R, 360, 52)
    ac.setFontColor(text_Fuel_R, 1, 1, 1, 0.83)
    ac.setCustomFont(text_Fuel_R, fName, 0, 0)

    output_Fuel_R = ac.addLabel(appWindow, "%01d")
    ac.setFontSize(output_Fuel_R, fNormal)
    ac.setFontAlignment(output_Fuel_R, "right")
    ac.setPosition(output_Fuel_R, 460, 52)
    ac.setFontColor(output_Fuel_R, 1, 1, 1, 0.83)
    ac.setCustomFont(output_Fuel_R, fName, 0, 0)

    return appName
Ejemplo n.º 16
0
    def __init__(self, leaderboardWindow, row):
        # SET SOME VARIABLES
        self.row = row
        px, py = LeaderboardRow.X_BASE, LeaderboardRow.Y_BASE + LeaderboardRow.ROW_HEIGHT * self.row  # position of the names
        self.px = px
        self.py = py
        self.positionLabelId = 0  # 0 white, 1 red, 2 green - to prevent loading the labels all the time
        self.out = False
        self.pit = False

        self.highlightLabel = ac.addLabel(leaderboardWindow, "")
        ac.setPosition(self.highlightLabel, px - 5, py - 6)
        ac.setSize(self.highlightLabel, 258, LeaderboardRow.ROW_HEIGHT + 1)
        ac.setBackgroundTexture(self.highlightLabel,
                                FC.LEADERBOARD_PLAYER_HIGHLIGHT)
        ac.setVisible(self.highlightLabel, 0)

        # CREATE LABELS
        self.positionLabel = ac.addLabel(leaderboardWindow, "")
        ac.setPosition(self.positionLabel, px - 4, py - 7)
        ac.setSize(self.positionLabel, 38, 38)
        ac.setBackgroundTexture(self.positionLabel,
                                FC.LEADERBOARD_POSITION_LABEL[self.row + 1])

        self.driverName = ac.getDriverName(row)
        self.driverId = -1
        self.nameLabel = ac.addLabel(leaderboardWindow,
                                     self.driverName[:3].upper())
        ac.setPosition(self.nameLabel, px + 65, py + 4)
        ac.setFontSize(self.nameLabel, 18)
        ac.setCustomFont(self.nameLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.nameLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.nameLabel, "left")

        self.teamLabel = ac.addLabel(leaderboardWindow, "")
        ac.setPosition(self.teamLabel, px + 47, py + 2)
        ac.setSize(self.teamLabel, 5, 18)
        if FC.TEAM_COLORS:
            try:
                ac.setBackgroundTexture(self.teamLabel,
                                        FC.TEAM_COLORS[self.driverName])
            except KeyError:
                ac.log("%s:Name Missing in teams.txt %s" %
                       (FC.APP_NAME, self.driverName))

        self.infoLabel = ac.addLabel(leaderboardWindow, "Interval")
        ac.setPosition(self.infoLabel, 250, py + 4)
        ac.setFontSize(self.infoLabel, 18)
        ac.setCustomFont(self.infoLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.infoLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.infoLabel, "right")

        self.positionChangeLabel = ac.addLabel(leaderboardWindow, "")
        ac.setPosition(self.positionChangeLabel, 205, py + 4)
        ac.setSize(self.positionChangeLabel, 18, 18)
        ac.setVisible(self.positionChangeLabel, 0)

        self.fastestLapLabel = ac.addLabel(leaderboardWindow, "")
        ac.setPosition(self.fastestLapLabel, px - 41, py - 6)
        ac.setSize(self.fastestLapLabel, 37, 37)
        ac.setBackgroundTexture(self.fastestLapLabel,
                                FC.LEADERBOARD_FASTEST_LAP)
        ac.setVisible(self.fastestLapLabel, 0)

        self.focus_button = ac.addButton(leaderboardWindow, "")
        ac.setPosition(self.focus_button, px, py - 7)
        ac.setSize(self.focus_button, 140, 38)
        self.on_click_focus_func = functools.partial(self.on_click_focus,
                                                     row=self)
        ac.addOnClickedListener(self.focus_button, self.on_click_focus_func)
        ac.setBackgroundOpacity(self.focus_button, 0)
        ac.drawBorder(self.focus_button, 0)
Ejemplo n.º 17
0
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
Ejemplo n.º 18
0
    def __init__(self, appName):
        self.id1 = -1
        self.id2 = -1
        self.visible = True

        self.window = ac.newApp(appName)
        ac.setTitle(self.window, "")
        ac.drawBorder(self.window, 0)
        ac.setIconPosition(self.window, 0, -10000)
        ac.setSize(self.window, 300, 100)
        ac.setBackgroundOpacity(self.window, 0)

        self.backgroundTexture = ac.addLabel(self.window, "")
        ac.setPosition(self.backgroundTexture, 0, 0)
        ac.setSize(self.backgroundTexture, 800, 50)
        ac.setBackgroundTexture(self.backgroundTexture,
                                FC.DRIVER_WIDGET_BACKGROUND_ALTERNATE)

        self.extendedBackgroundTexture = ac.addLabel(self.window, "")
        ac.setPosition(self.extendedBackgroundTexture, 0, 50)
        ac.setSize(self.extendedBackgroundTexture, 800, 92)
        ac.setBackgroundTexture(self.extendedBackgroundTexture,
                                FC.LEADERBOARD_BACKGROUND)

        self.rolexLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.rolexLabel, 0, -72)
        ac.setSize(self.rolexLabel, 123, 70)
        ac.setBackgroundTexture(self.rolexLabel, FC.ROLEX_LOGO)

        self.speedometerIconLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.speedometerIconLabel, 378, 3)
        ac.setSize(self.speedometerIconLabel, 44, 44)
        ac.setBackgroundTexture(self.speedometerIconLabel, FC.SPEEDOMETER_ICON)

        # ==========================================

        self.positionLabel1 = ac.addLabel(self.window, "")
        ac.setPosition(self.positionLabel1, 3, 3)
        ac.setSize(self.positionLabel1, 44, 44)

        self.positionLabel2 = ac.addLabel(self.window, "")
        ac.setPosition(self.positionLabel2, 433, 3)
        ac.setSize(self.positionLabel2, 44, 44)

        # ==========================================

        self.teamLabel1 = ac.addLabel(self.window, "")
        ac.setPosition(self.teamLabel1, 56, 10)
        ac.setSize(self.teamLabel1, 6, 27)

        self.teamLabel2 = ac.addLabel(self.window, "")
        ac.setPosition(self.teamLabel2, 486, 10)
        ac.setSize(self.teamLabel2, 6, 27)

        # ==========================================

        self.nameLabel1 = ac.addLabel(self.window, "")
        ac.setPosition(self.nameLabel1, 74, 15)
        ac.setFontSize(self.nameLabel1, 25)
        ac.setCustomFont(self.nameLabel1, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.nameLabel1, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.nameLabel1, "left")

        self.nameLabel2 = ac.addLabel(self.window, "")
        ac.setPosition(self.nameLabel2, 504, 15)
        ac.setFontSize(self.nameLabel2, 25)
        ac.setCustomFont(self.nameLabel2, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.nameLabel2, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.nameLabel2, "left")

        # ==========================================

        self.carLabel1 = ac.addLabel(self.window, "")
        ac.setPosition(self.carLabel1, 88, 55)
        ac.setSize(self.carLabel1, 195, 85)

        self.carLabel2 = ac.addLabel(self.window, "")
        ac.setPosition(self.carLabel2, 507, 55)
        ac.setSize(self.carLabel2, 195, 85)

        # ==========================================

        self.gapsIconLabelL = ac.addLabel(self.window, "")
        ac.setPosition(self.gapsIconLabelL, 310, 110)
        ac.setSize(self.gapsIconLabelL, 40, 6)
        ac.setBackgroundTexture(self.gapsIconLabelL, FC.GAPS)

        self.gapsIconLabelR = ac.addLabel(self.window, "")
        ac.setPosition(self.gapsIconLabelR, 454, 110)
        ac.setSize(self.gapsIconLabelR, 40, 6)
        ac.setBackgroundTexture(self.gapsIconLabelR, FC.GAPS)

        self.gapLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.gapLabel, 400, 68)
        ac.setFontSize(self.gapLabel, 40)
        ac.setCustomFont(self.gapLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.gapLabel, 0.94, 0.87, 0.17, 1)
        ac.setFontAlignment(self.gapLabel, "center")

        self.secondsLabel = ac.addLabel(self.window, "SECONDS")
        ac.setPosition(self.secondsLabel, 400, 107)
        ac.setFontSize(self.secondsLabel, 16)
        ac.setCustomFont(self.secondsLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.secondsLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.secondsLabel, "center")