Exemplo n.º 1
0
def acMain(ac_version):
  global TYREINFO, optimal_spinner_id, optimal_spinner_shown
  appWindow = ac.newApp("Tyre Temperatures")
  ac.drawBackground(appWindow, background)  
  ac.drawBorder(appWindow, background)
  ac.setBackgroundOpacity(appWindow, background)
  ac.setSize(appWindow, x_app_size, y_app_size)
  TYREINFO = Tyre_Info(appWindow, x_start, y_start)
  ac.addRenderCallback(appWindow, onFormRender)
  
  TYREINFO.optimal_temp = d_optimal_temp
  TYREINFO.carinifilepath = inidir + getValidFileName(ac.getCarName(0)) + ".ini"
  TYREINFO.needwriteini = 1
  
  if os.path.exists(TYREINFO.carinifilepath):
    f = open(TYREINFO.carinifilepath, "r")
    TYREINFO.optimal_temp = int(f.readline()[8:])
    f.close()
    TYREINFO.needwriteini = 0
  
  optimal_spinner_id = ac.addSpinner(appWindow, "optimal")
  ac.setPosition(optimal_spinner_id, 0, y_app_size + 28)
  ac.setStep(optimal_spinner_id, 1)
  if inFahrenheit:
    ac.setRange(optimal_spinner_id, int(CelsiusToFahrenheit(50)), int(CelsiusToFahrenheit(150)))
    ac.setValue(optimal_spinner_id, int(CelsiusToFahrenheit(TYREINFO.optimal_temp)))
  else:
    ac.setRange(optimal_spinner_id, 50, 150)
    ac.setValue(optimal_spinner_id, TYREINFO.optimal_temp)
  ac.addOnValueChangeListener(optimal_spinner_id, onValueChanged)
  optimal_spinner_shown = 1
  
  ac.log("Danny Giusa Tyre Temperatures loaded")
  return "Danny Giusa Tyre Temperatures"
Exemplo n.º 2
0
def spinner_config(spinner, x, y, xl, yl, min, step, max, value, evt):
    ac.setPosition(spinner, x, y)
    ac.setSize(spinner, xl, yl)
    ac.setRange(spinner, min, max)
    ac.setStep(spinner, step)
    ac.setValue(spinner, value)
    ac.addOnValueChangeListener(spinner, evt)
def acMain(ac_version):
    global updater, appHeight, appWidth, appWindow, numSecondsSpinner
    appWindow = ac.newApp("Traction Circle")
    ac.setSize(appWindow, appWidth, appHeight)
    ac.drawBorder(appWindow, 0)

    try:
        model = TractionCircleModel()
        assetto_corsa = AssettoCorsa()

        maxTimeSpan = 3
        numSecondsSpinner = ac.addSpinner(appWindow, 'Time Span(s)')
        ac.setPosition(numSecondsSpinner, 0, appHeight - 20)
        ac.setSize(numSecondsSpinner, 100, 20)
        ac.setRange(numSecondsSpinner, 1, 10)
        ac.setValue(numSecondsSpinner, maxTimeSpan)
        ac.addOnValueChangeListener(numSecondsSpinner, updateMaxTimeRange)

        gPlotter = GPlotter(appWidth, appHeight, maxG, maxG)
        view = TractionCircleView(appWindow, model, gPlotter, MovingAveragePlotter(10) )
        updater = TractionCircleUpdater(assetto_corsa, view, model, maxTimeRange=maxTimeSpan)

        ac.addRenderCallback(appWindow, doUpdate)
    except Exception as e:
        ac.log(str(traceback.format_exc()))

    return "Traction Circle"
Exemplo n.º 4
0
 def range(self, value_range: tuple):
     self._range = value_range
     if self.has_id:
         if self._range[2] > 0:
             ac.setRange(self.id, self._range[0], self._range[1],
                         self._range[2])
         else:
             ac.setRange(self.id, self._range[0], self._range[1])
def spinnerConfig(spinner, spin_pos_x, spin_pos_y, spin_size_x, spin_size_y, spin_val_min, spin_val_step, spin_val_max, spin_value, spin_event, vis_value):
    ac.setPosition(spinner, spin_pos_x, spin_pos_y)
    ac.setSize(spinner, spin_size_x, spin_size_y)
    ac.setRange(spinner, spin_val_min, spin_val_max)
    ac.setStep(spinner, spin_val_step)
    ac.setValue(spinner, spin_value)
    ac.addOnValueChangeListener(spinner, spin_event)
    ac.setVisible(spinner, vis_value)
Exemplo n.º 6
0
def spinnerConfig(spinner, spin_pos_x, spin_pos_y, spin_size_x, spin_size_y,
                  spin_val_min, spin_val_step, spin_val_max, spin_value,
                  spin_event, vis_value):
    ac.setPosition(spinner, spin_pos_x, spin_pos_y)
    ac.setSize(spinner, spin_size_x, spin_size_y)
    ac.setRange(spinner, spin_val_min, spin_val_max)
    ac.setStep(spinner, spin_val_step)
    ac.setValue(spinner, spin_value)
    ac.addOnValueChangeListener(spinner, spin_event)
    ac.setVisible(spinner, vis_value)
Exemplo n.º 7
0
 def __init__(self):
     self.window = Window(name="ACTV Delta", icon=False, width=240, height=184, texture="")
     self.cursor = Value(False)
     self.session = Value(-1)
     self.performance = Value(0)
     self.spline = Value(0)
     self.laptime = Value(0)
     self.TimeLeftUpdate = Value(0)
     self.referenceLap = []
     self.referenceLapTime = Value(0)
     self.lastLapTime = Value(0)
     self.lapCount = 0
     self.lastLapIsValid = True
     self.currentLap = []
     self.deltaLoaded = False
     self.thread_save = False
     self.highlight_end = 0
     self.rowHeight = Value(-1)
     self.lbl_delta = (
         Label(self.window.app, "+0.000")
         .setSize(150, 36)
         .setPos(0, 60)
         .setFontSize(26)
         .setAlign("right")
         .setVisible(1)
     )
     self.lbl_lap = (
         Label(self.window.app, "0.000")
         .setSize(150, 32)
         .setPos(0, 86)
         .setFontSize(17)
         .setAlign("right")
         .setVisible(1)
     )
     self.btn_reset = (
         Button(self.window.app, self.onResetPress)
         .setPos(90, 68)
         .setSize(60, 20)
         .setText("Reset")
         .setAlign("center")
         .setBgColor(rgb([255, 12, 12], bg=True))
         .setVisible(0)
     )
     self.spin_row_height = ac.addSpinner(self.window.app, "")
     ac.setRange(self.spin_row_height, 20, 48)
     ac.setPosition(self.spin_row_height, 20, 28)
     ac.setValue(self.spin_row_height, self.__class__.ui_row_height)
     ac.addOnValueChangeListener(self.spin_row_height, self.onSpinRowHeightChanged)
     ac.setVisible(self.spin_row_height, 0)
     fontName = "Segoe UI"
     if ac.initFont(0, fontName, 0, 0) > 0:
         self.lbl_delta.setFont(fontName, 0, 1)
     self.cfg = Config("apps/python/prunn/", "config.ini")
     self.loadCFG()
Exemplo n.º 8
0
    def setup(self):
        # ac.addRenderCallback(self.appWindow, onRender)
        ac.setSize(self.appWindow,800,100)
        ac.drawBorder(self.appWindow,0)
        ac.drawBackground(self.appWindow, 0)
        for el in self.uiElements:
            el.setup()

        ac.setPosition(self.graph, 0, 100)
        ac.setSize(self.graph,800,100)
        ac.setRange(self.graph, 0.0, 600, 2000)
Exemplo n.º 9
0
def acUpdate(deltaT):
    try:
        global Speed, DoPit, FuelMax, InPit, FuelIn, session, delta  # Position,InitialPosition  vars can be removed from the code
        global PitX, PitY, PitZ  # added global variables initiliased as 0,0,0. X,Y,Z co-ords of pit box
        global AppInitialised  # added global variable initiliased as False
        global Notify

        if not AppInitialised:  # First call to app, set variables
            getNotification()
            if AutoUpdate:
                CheckNewUpdate()
            InPit = info.graphics.isInPit
            FuelMax = int(info.static.maxFuel)
            ac.setRange(FuelSelection, 0, FuelMax)
            ReadPreset()
            ac.setValue(Preset1, 1)
            AppInitialised = True

        if abs(PitX) < 1e-5:  # set pit position
            InPit = info.graphics.isInPit
            if InPit:
                PitX, PitY, PitZ = ac.getCarState(0, acsys.CS.WorldPosition)
                ac.log("BoxRadio: Pit position initialized at X:" + str(PitX) +
                       " Y:" + str(PitY) + " Z:" + str(PitZ))

        Speed = ac.getCarState(0, acsys.CS.SpeedKMH)

        if Speed < 0.1 and DoPit == 0:
            session = info.graphics.session  # session number, 2 is race
            InPit = info.graphics.isInPit
            if session == 2:
                PosX, PosY, PosZ = ac.getCarState(
                    0, acsys.CS.WorldPosition)  # current co-ord position
                delta = ((PosX - PitX)**2 + (PosY - PitY)**2 + (PosZ - PitZ)**
                         2)**0.5  # straight line dist between pitbox and car
                FuelIn = int(info.physics.fuel)
                if delta < 8.0 or InPit == 1:  # if InPit or within 8m of pitbox, quite relaxed limit guarantees app trigger on menu appear
                    PitStop()
                    ac.log("BoxRadio: Pit performed at X:" + str(PosX) +
                           " Y:" + str(PosY) + " Z:" + str(PosZ))
                    ac.log("BoxRadio: Delta:" + str(delta))
            DoPit = 1

        if Speed >= 0.1:
            DoPit = 0

    except Exception as e:
        ac.log("BoxRadio: Error in acUpdate: %s" % e)
Exemplo n.º 10
0
def acUpdate(deltaT):
    try:
        global Speed, DoPit, FuelMax, InPit, FuelIn, session, delta  # Position,InitialPosition  vars can be removed from the code
        global PitX, PitY, PitZ  # added global variables initiliased as 0,0,0. X,Y,Z co-ords of pit box
        global AppInitialised  # added global variable initiliased as False
        global Notify

        if not AppInitialised:  # First call to app, set variables
            getNotification()
            if AutoUpdate:
                CheckNewUpdate()
            InPit = info.graphics.isInPit
            FuelMax = int(info.static.maxFuel)
            ac.setRange(FuelSelection, 0, FuelMax)
            ReadPreset()
            ac.setValue(Preset1, 1)
            AppInitialised = True

        if abs(PitX) < 1e-5:  # set pit position
            InPit = info.graphics.isInPit
            if InPit:
                PitX, PitY, PitZ = ac.getCarState(0, acsys.CS.WorldPosition)
                ac.log("BoxRadio: Pit position initialized at X:" + str(PitX) + " Y:" + str(PitY) + " Z:" + str(PitZ))

        Speed = ac.getCarState(0, acsys.CS.SpeedKMH)

        if Speed < 0.1 and DoPit == 0:
            session = info.graphics.session  # session number, 2 is race
            InPit = info.graphics.isInPit
            if session == 2:
                PosX, PosY, PosZ = ac.getCarState(0, acsys.CS.WorldPosition)  # current co-ord position
                delta = ((PosX - PitX) ** 2 + (PosY - PitY) ** 2 + (PosZ - PitZ) ** 2) ** 0.5  # straight line dist between pitbox and car
                FuelIn = int(info.physics.fuel)
                if delta < 8.0 or InPit == 1:  # if InPit or within 8m of pitbox, quite relaxed limit guarantees app trigger on menu appear
                    PitStop()
                    ac.log("BoxRadio: Pit performed at X:" + str(PosX) + " Y:" + str(PosY) + " Z:" + str(PosZ))
                    ac.log("BoxRadio: Delta:" + str(delta))
            DoPit = 1

        if Speed >= 0.1:
            DoPit = 0

    except Exception as e:
        ac.log("BoxRadio: Error in acUpdate: %s" % e)
def acMain(ac_version):
    global mainLabel, audioSpinner, audioLabel, audioList, audioVolSpinner, enableCheck, replayEnableCheck, app
    app = ac.newApp("Ultimate Spotter Settings")
    ac.log("SPOTTER: Initializing UI...")

    audioSpinner = ac.addSpinner(app, "Audio")
    audioLabel = ac.addLabel(app, "{}".format(audio))
    audioVolSpinner = ac.addSpinner(app, "Volume")

    enableCheck = ac.addCheckBox(app, "Enable Spotter")
    replayEnableCheck = ac.addCheckBox(app, "Enabled in Replays")

    ac.setSize(app, 300, 220)

    ac.setPosition(enableCheck, 60, 50)
    ac.setValue(enableCheck, USEnabled)
    ac.addOnCheckBoxChanged(enableCheck, onEnableCheck)

    ac.setPosition(replayEnableCheck, 60, 100)
    ac.setValue(replayEnableCheck, USReplayEnabled)
    ac.addOnCheckBoxChanged(replayEnableCheck, onReplayEnableCheck)

    ac.setFontAlignment(audioLabel, "center")
    ac.setPosition(audioLabel, 90, 150)
    ac.setSize(audioSpinner, 100, 20)
    ac.setPosition(audioSpinner, 40, 150)

    audioList = os.listdir(os.path.join(os.path.dirname(__file__), "audio"))
    ac.setRange(audioSpinner, 0, len(audioList) - 1)
    ac.setStep(audioSpinner, 1)
    #ac.setValue(audioSpinner,audioList.index(audio))
    ac.addOnValueChangeListener(audioSpinner, onAudioSpin)

    ac.setSize(audioVolSpinner, 80, 20)
    ac.setPosition(audioVolSpinner, 180, 150)
    ac.setStep(audioVolSpinner, 1)
    ac.setRange(audioVolSpinner, 1, 10)
    ac.setValue(audioVolSpinner, audioVol)
    ac.addOnValueChangeListener(audioVolSpinner, onAudioVolSpin)
    ac.log("SPOTTER: UI Loaded")
Exemplo n.º 12
0
def acMain(ac_version):
    global TYREINFO, optimal_spinner_id, optimal_spinner_shown
    appWindow = ac.newApp("Tyre Temperatures")
    ac.drawBackground(appWindow, background)
    ac.drawBorder(appWindow, background)
    ac.setBackgroundOpacity(appWindow, background)
    ac.setSize(appWindow, x_app_size, y_app_size)
    TYREINFO = Tyre_Info(appWindow, x_start, y_start)
    ac.addRenderCallback(appWindow, onFormRender)

    TYREINFO.optimal_temp = d_optimal_temp
    TYREINFO.carinifilepath = inidir + getValidFileName(
        ac.getCarName(0)) + ".ini"
    TYREINFO.needwriteini = 1

    if os.path.exists(TYREINFO.carinifilepath):
        f = open(TYREINFO.carinifilepath, "r")
        TYREINFO.optimal_temp = int(f.readline()[8:])
        f.close()
        TYREINFO.needwriteini = 0

    optimal_spinner_id = ac.addSpinner(appWindow, "optimal")
    ac.setPosition(optimal_spinner_id, 0, y_app_size + 28)
    ac.setStep(optimal_spinner_id, 1)
    if inFahrenheit:
        ac.setRange(optimal_spinner_id, int(CelsiusToFahrenheit(50)),
                    int(CelsiusToFahrenheit(150)))
        ac.setValue(optimal_spinner_id,
                    int(CelsiusToFahrenheit(TYREINFO.optimal_temp)))
    else:
        ac.setRange(optimal_spinner_id, 50, 150)
        ac.setValue(optimal_spinner_id, TYREINFO.optimal_temp)
    ac.addOnValueChangeListener(optimal_spinner_id, onValueChanged)
    optimal_spinner_shown = 1

    ac.log("Danny Giusa Tyre Temperatures loaded")
    return "Danny Giusa Tyre Temperatures"
Exemplo n.º 13
0
def acMain(ac_version):
    global appWindow, labelStorage, spinner_y_offset, scale_factor, fov_setting

    appWindow = ac.newApp("VR-Names")
    ac.setTitle(appWindow, "VR-names")
    ac.setSize(appWindow, 200, 200)
    ac.drawBorder(appWindow, 0)
    ac.setBackgroundOpacity(appWindow, 0)

    # ac.setIconPosition(appWindow, -9000, 0)

    spinner_y_offset = ac.addSpinner(appWindow, "Name Height Offset")
    ac.setRange(spinner_y_offset, -100, 100)
    ac.setValue(spinner_y_offset, 0)
    ac.setStep(spinner_y_offset, 1)
    ac.setPosition(spinner_y_offset, 10, 90)
    ac.setSize(spinner_y_offset, 180, 20)

    scale_factor = ac.addSpinner(appWindow, "scale text factor")
    ac.setRange(scale_factor, 1, 30)
    ac.setValue(scale_factor, 10)
    ac.setStep(scale_factor, 1)
    ac.setPosition(scale_factor, 10, 135)
    ac.setSize(scale_factor, 180, 20)

    fov_setting = ac.addSpinner(appWindow, "scale text factor")
    ac.setRange(fov_setting, 0, 360)
    ac.setValue(fov_setting, 110)
    ac.setStep(fov_setting, 1)
    ac.setPosition(fov_setting, 10, 180)
    ac.setSize(fov_setting, 180, 20)

    button_toggle_name = ac.addButton(appWindow, "Toggle name")
    ac.addOnClickedListener(button_toggle_name, toggle_name)
    ac.setSize(button_toggle_name, 180, 20)
    ac.setPosition(button_toggle_name, 10, 40)

    for x in range(ac.getCarsCount()):
        label = ac.addLabel(appWindow, "")
        ac.setPosition(label, 10, 0 + (20 * x))
        labelStorage.append(label)

    setInitialLabel()
    return "vrnames"
Exemplo n.º 14
0
def createUI():
    global uiCreated, x_app_size, y_app_size, defaultFontSize
    global isTimedRace, timedRaceCheckbox, averageFuelPerLapValue, raceTotalLapsText, raceTotalLapsValue, bestLapTimeText, bestLapTimeValue, timedRaceMinutesSpinner, raceLapsSpinner, resetButton, timedRacePlusLapButton, timedRaceMinLapButton
    global extraLiters, extraLitersMinButton, extraLitersPlusButton, extraLitersValue, averageFuelPerLapText, extraLitersText, timedRaceText, toggleAppSizeButton, fuelLapsCountedText, fuelLapsCountedValue, calcTypeText, calcTypeCurrentButton, calcTypeMultipleButton, calcTypeStoredButton, completedLapsText, completedLapsValue, averageLapTimeText, averageLapTimeValue
    global tableCurrentFuel, tableCurrentTime, tableCurrentLaps, tableRaceFuel, tableRaceTime, tableRaceLaps, tableRowRace

    try:
        row = 0
        x_offset = 5
        y_offset = 20

        createLabel("tableHeaderFuel", "Fuel", ((x_app_size)/5) * 2, row * y_offset, defaultFontSize, "center")
        createLabel("tableHeaderTime", "Time", ((x_app_size)/5) * 3, row * y_offset, defaultFontSize, "center")
        createLabel("tableHeaderLaps", "Laps", ((x_app_size)/5) * 4, row * y_offset, defaultFontSize, "center")

        row += 1
        createLabel("tableRowCurrent", "Current", x_offset, row * y_offset, defaultFontSize, "left")

        tableCurrentFuel = createLabel("tableCurrentFuel", "--", ((x_app_size)/5) * 2, row * y_offset, defaultFontSize+2, "center")
        tableCurrentTime = createLabel("tableCurrentTime", "--", ((x_app_size)/5) * 3, row * y_offset, defaultFontSize+2, "center")
        tableCurrentLaps = createLabel("tableCurrentLaps", "--", ((x_app_size)/5) * 4, row * y_offset, defaultFontSize+2, "center")

        row += 1
        tableRowRace = createLabel("tableRowRace", "Total Race", x_offset, row * y_offset, defaultFontSize, "left")

        tableRaceFuel = createLabel("tableRaceFuel", "--", ((x_app_size)/5) * 2, row * y_offset, defaultFontSize+2, "center")
        tableRaceTime = createLabel("tableRaceTime", "--", ((x_app_size)/5) * 3, row * y_offset, defaultFontSize+2, "center")
        tableRaceLaps = createLabel("tableRaceLaps", "--", ((x_app_size)/5) * 4, row * y_offset, defaultFontSize+2, "center")

        toggleAppSizeButton = ac.addButton(mainApp, "+")
        ac.setPosition(toggleAppSizeButton, x_app_size - 20 - x_offset, (row * y_offset) + 5)
        ac.setSize(toggleAppSizeButton, 20, 20)
        ac.addOnClickedListener(toggleAppSizeButton, onToggleAppSizeButtonClickedListener)
        row += 2
        calcTypeText = createLabel("calcTypeText", "Session : ", x_offset, row * y_offset, defaultFontSize, "left")
        calcTypeWidth = 60
        calcTypeOffset = x_offset + 70
        calcTypeCurrentButton = ac.addButton(mainApp, "current")
        ac.setPosition(calcTypeCurrentButton, calcTypeOffset, row * y_offset)
        ac.setSize(calcTypeCurrentButton, calcTypeWidth, 20)
        ac.addOnClickedListener(calcTypeCurrentButton, onCalcTypeCurrentButtonClickedListener)
        calcTypeMultipleButton = ac.addButton(mainApp, "multiple")
        ac.setPosition(calcTypeMultipleButton, calcTypeOffset + calcTypeWidth + 10, row * y_offset)
        ac.setSize(calcTypeMultipleButton, calcTypeWidth, 20)
        ac.addOnClickedListener(calcTypeMultipleButton, onCalcTypeMultipleButtonClickedListener)
        calcTypeStoredButton = ac.addButton(mainApp, "stored")
        ac.setPosition(calcTypeStoredButton, calcTypeOffset + (2*calcTypeWidth) + 20, row * y_offset)
        ac.setSize(calcTypeStoredButton, calcTypeWidth, 20)
        ac.addOnClickedListener(calcTypeStoredButton, onCalcTypeStoredButtonClickedListener)
        row += 2
        averageFuelPerLapText = createLabel("averageFuelPerLapText", "Avg fuel per lap : ", x_offset, row * y_offset, defaultFontSize, "left")
        averageFuelPerLapValue = createLabel("averageFuelPerLapValue", "--", x_app_size - x_offset, row * y_offset, defaultFontSize, "right")
        row += 1
        fuelLapsCountedText = createLabel("fuelLapsCountedText", "Counted laps for fuel average : ", x_offset, row * y_offset, defaultFontSize, "left")
        fuelLapsCountedValue = createLabel("averageFuelPerLapValue", "--", x_app_size - x_offset, row * y_offset, defaultFontSize, "right")
        row += 1
        completedLapsText = createLabel("completedLapsText", "Completed laps : ", x_offset, row * y_offset, defaultFontSize, "left")
        completedLapsValue = createLabel("completedLapsValue", "--", x_app_size - x_offset, row * y_offset, defaultFontSize, "right")
        row += 1
        extraLitersText = createLabel("extraLitersText", "Extra liters : ", x_offset, row * y_offset, defaultFontSize, "left")
        extraLitersValue = createLabel("extraLitersValue", "--", x_app_size - x_offset, row * y_offset, defaultFontSize, "right")
        extraLitersMinButton = ac.addButton(mainApp, "-")
        ac.setPosition(extraLitersMinButton, 180, row * y_offset)
        ac.setSize(extraLitersMinButton, 20, 20)
        ac.addOnClickedListener(extraLitersMinButton, onExtraLitersMinButtonClickedListener)
        extraLitersPlusButton = ac.addButton(mainApp, "+")
        ac.setPosition(extraLitersPlusButton, 205, row * y_offset)
        ac.setSize(extraLitersPlusButton, 20, 20)
        ac.addOnClickedListener(extraLitersPlusButton, onExtraLitersPlusButtonClickedListener)
        row += 1
        timedRaceText = createLabel("timedRaceText", "Is timed race : ", x_offset, row * y_offset, defaultFontSize, "left")
        timedRaceCheckbox = ac.addCheckBox(mainApp, "")
        ac.setPosition(timedRaceCheckbox, x_app_size - (x_offset + 15), row * y_offset + 4)
        ac.setSize(timedRaceCheckbox, 15, 15)
        ac.setValue(timedRaceCheckbox, isTimedRace)
        ac.addOnCheckBoxChanged(timedRaceCheckbox, onTimedRaceChangedListener)
        row += 1

        raceTypeRow = row

        raceTotalLapsText = createLabel("raceTotalLapsText", "Expected race laps : ", x_offset, row * y_offset, defaultFontSize, "left")
        raceTotalLapsValue = createLabel("raceTotalLapsValue", "--", x_app_size - x_offset, row * y_offset, defaultFontSize, "right")
        timedRaceMinLapButton = ac.addButton(mainApp, "-")
        ac.setPosition(timedRaceMinLapButton, 180, row * y_offset)
        ac.setSize(timedRaceMinLapButton, 20, 20)
        ac.addOnClickedListener(timedRaceMinLapButton, onTimedRaceMinLapButtonClickedListener)
        timedRacePlusLapButton = ac.addButton(mainApp, "+")
        ac.setPosition(timedRacePlusLapButton, 205, row * y_offset)
        ac.setSize(timedRacePlusLapButton, 20, 20)
        ac.addOnClickedListener(timedRacePlusLapButton, onTimedRacePlusLapButtonClickedListener)
        row += 1
        averageLapTimeText = createLabel("averageLapTimeText", "Average lap time : ", x_offset, row * y_offset, defaultFontSize, "left")
        averageLapTimeValue = createLabel("averageLapTimeValue", "--", x_app_size - x_offset, row * y_offset, defaultFontSize, "right")
        row += 1
        bestLapTimeText = createLabel("bestLapTimeText", "Best lap time : ", x_offset, row * y_offset, defaultFontSize, "left")
        bestLapTimeValue = createLabel("bestLapTimeValue", "--", x_app_size - x_offset, row * y_offset, defaultFontSize, "right")
        row += 3
        timedRaceMinutesSpinner = ac.addSpinner(mainApp, "Timed race minutes")
        ac.setRange(timedRaceMinutesSpinner, 0, 240)
        ac.setValue(timedRaceMinutesSpinner, timedRaceMinutes)
        ac.setStep(timedRaceMinutesSpinner, 1)
        ac.setPosition(timedRaceMinutesSpinner, x_app_size / 6, row * y_offset)
        ac.addOnValueChangeListener(timedRaceMinutesSpinner, onTimedRaceMinutesChangedListener)
        row += 2
        resetButton = ac.addButton(mainApp, "Reset")
        ac.setPosition(resetButton, x_offset + 5, (row * y_offset) + (y_offset / 2))
        ac.setSize(resetButton, 50, 22)
        ac.addOnClickedListener(resetButton, onResetClickedListener)

        row = raceTypeRow

        row += 5
        raceLapsSpinner = ac.addSpinner(mainApp, "Race laps")
        ac.setRange(raceLapsSpinner, 0, 100)
        ac.setValue(raceLapsSpinner, raceLaps)
        ac.setStep(raceLapsSpinner, 1)
        ac.setPosition(raceLapsSpinner, x_app_size / 6, row * y_offset)
        ac.addOnValueChangeListener(raceLapsSpinner, onRaceLapsChangedListener)

        updateUIVisibility()

        uiCreated = True

    except exception:
        debug(repr(traceback.format_exception(exc_type, exc_value, exc_traceback)))
        showMessage("Error: " + traceback.format_exc())
Exemplo n.º 15
0
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"
Exemplo n.º 16
0
    def __init__(self):
        self.visual_timeout = -1
        self.session = Value(-1)
        self.listen_active = True
        Colors.load_themes()
        Font.load_fonts()

        self.window = Window(name="ACTV Config", icon=False, width=251, height=590, texture="").setBgOpacity(0)

        self.btn_tab1 = Button(self.window.app, self.on_tab1_press)\
            .setPos(0, -22).setSize(126, 22).setText("General")\
            .setAlign("center").setBgColor(rgb([255, 12, 12], bg=True))
        self.btn_tab2 = Button(self.window.app, self.on_tab2_press)\
            .setPos(126, -22).setSize(125, 22).setText("Colors")\
            .setAlign("center").setBgColor(rgb([12, 12, 12], bg=True))

        y = 50
        self.spin_race_mode = ac.addSpinner(self.window.app, "Race tower mode :")
        ac.setRange(self.spin_race_mode, 0, 8)
        ac.setPosition(self.spin_race_mode, 20, y)
        ac.setValue(self.spin_race_mode, self.__class__.race_mode)
        ac.addOnValueChangeListener(self.spin_race_mode, self.on_spin_race_mode_changed)
        self.lbl_race_mode = Label(self.window.app, "Auto")\
            .setSize(120, 26).setPos(186, y - 28)\
            .setFontSize(12).setAlign("left")\
            .setVisible(1)

        y += 70
        self.spin_qual_mode = ac.addSpinner(self.window.app, "Qual tower mode :")
        ac.setRange(self.spin_qual_mode, 0, 4)
        ac.setPosition(self.spin_qual_mode, 20, y)
        ac.setValue(self.spin_qual_mode, self.__class__.qual_mode)
        ac.addOnValueChangeListener(self.spin_qual_mode, self.on_spin_qual_mode_changed)
        self.lbl_qual_mode = Label(self.window.app, "Gaps")\
            .setSize(120, 26).setPos(186, y - 28)\
            .setFontSize(12).setAlign("left")\
            .setVisible(1)

        y += 70
        self.spin_num_cars = ac.addSpinner(self.window.app, "Number cars tower")
        ac.setRange(self.spin_num_cars, 6, 80)
        ac.setPosition(self.spin_num_cars, 20, y)
        ac.setValue(self.spin_num_cars, self.__class__.max_num_cars)
        ac.addOnValueChangeListener(self.spin_num_cars, self.on_spin_num_cars_changed)

        y += 70
        self.spin_num_laps = ac.addSpinner(self.window.app, "Number laps stint mode")
        ac.setRange(self.spin_num_laps, 0, 28)
        ac.setPosition(self.spin_num_laps, 20, y)
        ac.setValue(self.spin_num_laps, self.__class__.max_num_laps_stint)
        ac.addOnValueChangeListener(self.spin_num_laps, self.on_spin_num_laps_changed)

        y += 70
        self.spin_row_height = ac.addSpinner(self.window.app, "Row height")
        ac.setRange(self.spin_row_height, 20, 80)
        ac.setPosition(self.spin_row_height, 20, y)
        ac.setValue(self.spin_row_height, self.__class__.ui_row_height)
        ac.addOnValueChangeListener(self.spin_row_height, self.on_spin_row_height_changed)

        # Names mode
        y += 70
        self.spin_names = ac.addSpinner(self.window.app, "Names :")
        ac.setRange(self.spin_names, 0, 4)
        ac.setPosition(self.spin_names, 20, y)
        ac.setValue(self.spin_names, self.__class__.names)
        ac.addOnValueChangeListener(self.spin_names, self.on_spin_names_changed)
        self.lbl_names = Label(self.window.app, "TLC") \
            .setSize(120, 26).setPos(150, y - 28) \
            .setFontSize(12).setAlign("left") \
            .setVisible(1)

        # Refresh rate
        y += 70
        self.spin_refresh_rate = ac.addSpinner(self.window.app, "Refresh rate / sec")
        ac.setRange(self.spin_refresh_rate, 20, 120)
        ac.setPosition(self.spin_refresh_rate, 20, y)
        ac.setValue(self.spin_refresh_rate, self.__class__.refresh_rate)
        ac.addOnValueChangeListener(self.spin_refresh_rate, self.on_spin_refresh_rate_changed)

        y += 52
        self.chk_invalidated = ac.addCheckBox(self.window.app, "")
        ac.setPosition(self.chk_invalidated, 20, y)
        ac.addOnCheckBoxChanged(self.chk_invalidated, self.on_check_invalidated_changed)
        self.lbl_title_invalidated = Label(self.window.app, "Lap can be invalidated")\
            .setSize(200, 26).setPos(65, y + 1)\
            .setFontSize(16).setAlign("left")\
            .setVisible(1)

        y += 33
        self.chk_force_info = ac.addCheckBox(self.window.app, "")
        ac.setPosition(self.chk_force_info, 20, y)
        ac.addOnCheckBoxChanged(self.chk_force_info, self.on_check_force_info_changed)
        self.lbl_title_force_info = Label(self.window.app, "Info always visible")\
            .setSize(200, 26).setPos(65, y + 1)\
            .setFontSize(16).setAlign("left")\
            .setVisible(1)

        # --------- Theme RGB ----------
        y = 50
        # General theme : 0-Dark 1-white
        self.spin_general_theme = ac.addSpinner(self.window.app, "Theme :")
        ac.setRange(self.spin_general_theme, 0, len(Colors.theme_files))
        ac.setPosition(self.spin_general_theme, 20, y)
        ac.setValue(self.spin_general_theme, 0)
        ac.addOnValueChangeListener(self.spin_general_theme, self.on_spin_general_theme_changed)
        ac.setVisible(self.spin_general_theme, 0)
        self.lbl_general_theme = Label(self.window.app, "Dark").setSize(120, 26).setPos(152, y - 28).setFontSize(
            12).setAlign("left").setVisible(0)

        # Font
        y += 70
        self.spin_font = ac.addSpinner(self.window.app, "Font :")
        ac.setRange(self.spin_font, 0, len(Font.font_files))
        ac.setPosition(self.spin_font, 20, y)
        ac.setValue(self.spin_font, Font.current)
        ac.addOnValueChangeListener(self.spin_font, self.on_spin_font_changed)
        ac.setVisible(self.spin_font, 0)
        self.lbl_font = Label(self.window.app, "Default").setSize(120, 26).setPos(148, y - 28).setFontSize(
            12).setAlign("left").setVisible(0)

        y += 70
        self.spin_theme_red = ac.addSpinner(self.window.app, "Red")
        ac.setRange(self.spin_theme_red, 0, 255)
        ac.setPosition(self.spin_theme_red, 20, y)
        ac.setValue(self.spin_theme_red, self.__class__.theme_red)
        ac.addOnValueChangeListener(self.spin_theme_red, self.on_red_changed)
        y += 70
        self.spin_theme_green = ac.addSpinner(self.window.app, "Green")
        ac.setRange(self.spin_theme_green, 0, 255)
        ac.setPosition(self.spin_theme_green, 20, y)
        ac.setValue(self.spin_theme_green, self.__class__.theme_green)
        ac.addOnValueChangeListener(self.spin_theme_green, self.on_green_changed)
        y += 70
        self.spin_theme_blue = ac.addSpinner(self.window.app, "Blue")
        ac.setRange(self.spin_theme_blue, 0, 255)
        ac.setPosition(self.spin_theme_blue, 20, y)
        ac.setValue(self.spin_theme_blue, self.__class__.theme_blue)
        ac.addOnValueChangeListener(self.spin_theme_blue, self.on_blue_changed)
        ac.setVisible(self.spin_theme_red, 0)
        ac.setVisible(self.spin_theme_green, 0)
        ac.setVisible(self.spin_theme_blue, 0)

        # byClass
        y += 70
        self.spin_colors_by = ac.addSpinner(self.window.app, "Car colors by :")
        ac.setRange(self.spin_colors_by, 0, 1)
        ac.setPosition(self.spin_colors_by, 20, y)
        ac.setValue(self.spin_colors_by, self.__class__.carColorsBy)
        ac.addOnValueChangeListener(self.spin_colors_by, self.on_spin_colors_by_changed)
        ac.setVisible(self.spin_colors_by, 0)
        self.lbl_colors_by = Label(self.window.app, "Brand").setSize(120, 26).setPos(178, y - 28).setFontSize(
            12).setAlign("left").setVisible(0)

        # Border direction - Horizontal vertical none
        y += 70
        self.spin_border_direction = ac.addSpinner(self.window.app, "Border direction :")
        ac.setRange(self.spin_border_direction, 0, 1)
        ac.setPosition(self.spin_border_direction, 20, y)
        ac.setValue(self.spin_border_direction, 0)
        ac.addOnValueChangeListener(self.spin_border_direction, self.on_spin_border_direction_changed)
        ac.setVisible(self.spin_border_direction, 0)
        self.lbl_border_direction = Label(self.window.app, "Horizontal").setSize(120, 26).setPos(192, y - 28).setFontSize(
            12).setAlign("left").setVisible(0)

        self.cfg_loaded = False
        self.cfg = Config("apps/python/prunn/", "config.ini")
        self.load_cfg()

        # thread
        self.key_listener = threading.Thread(target=self.listen_key)
        self.key_listener.daemon = True
        self.key_listener.start()
Exemplo n.º 17
0
 def updateGraphScale(self):
     minFps = 0
     maxFps = self.longAverage * 1.50 # don't stick graph lines to the top, leave some margin
     ac.setRange(self.graph, minFps, maxFps, FramerateWatcher.graphLength)
Exemplo n.º 18
0
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"
Exemplo n.º 19
0
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"
Exemplo n.º 20
0
 def sRange(self, rng1=0, rng2=100):
     ac.setRange(self.dt, rng1, rng2)
Exemplo n.º 21
0
    def __init__(self):
        self.session = Value(-1)
        self.listen_active = True
        self.window = Window(name="ACTV Config", icon=True, width=251, height=480, texture="").setBgOpacity(0.6)

        y = 60
        self.spin_race_mode = ac.addSpinner(self.window.app, "Race tower mode :")
        ac.setRange(self.spin_race_mode, 0, 2)
        ac.setPosition(self.spin_race_mode, 20, y)
        ac.setValue(self.spin_race_mode, self.__class__.race_mode)
        ac.addOnValueChangeListener(self.spin_race_mode, self.onSpinRaceModeChanged)
        self.lbl_race_mode = (
            Label(self.window.app, "Auto")
            .setSize(120, 26)
            .setPos(186, y - 28)
            .setFontSize(12)
            .setAlign("left")
            .setVisible(1)
        )

        y += 80
        self.spin_qual_mode = ac.addSpinner(self.window.app, "Qual tower mode :")
        ac.setRange(self.spin_qual_mode, 0, 1)
        ac.setPosition(self.spin_qual_mode, 20, y)
        ac.setValue(self.spin_qual_mode, self.__class__.qual_mode)
        ac.addOnValueChangeListener(self.spin_qual_mode, self.onSpinQualModeChanged)
        self.lbl_qual_mode = (
            Label(self.window.app, "Gaps")
            .setSize(120, 26)
            .setPos(186, y - 28)
            .setFontSize(12)
            .setAlign("left")
            .setVisible(1)
        )

        y += 80
        self.spin_num_cars = ac.addSpinner(self.window.app, "Number cars tower")
        ac.setRange(self.spin_num_cars, 6, 28)
        ac.setPosition(self.spin_num_cars, 20, y)
        ac.setValue(self.spin_num_cars, self.__class__.max_num_cars)
        ac.addOnValueChangeListener(self.spin_num_cars, self.onSpinNumCarsChanged)

        y += 80
        self.spin_num_laps = ac.addSpinner(self.window.app, "Number laps stint mode")
        ac.setRange(self.spin_num_laps, 2, 28)
        ac.setPosition(self.spin_num_laps, 20, y)
        ac.setValue(self.spin_num_laps, self.__class__.max_num_laps_stint)
        ac.addOnValueChangeListener(self.spin_num_laps, self.onSpinNumLapsChanged)

        y += 80
        self.spin_row_height = ac.addSpinner(self.window.app, "Row height")
        ac.setRange(self.spin_row_height, 20, 48)
        ac.setPosition(self.spin_row_height, 20, y)
        ac.setValue(self.spin_row_height, self.__class__.ui_row_height)
        ac.addOnValueChangeListener(self.spin_row_height, self.onSpinRowHeightChanged)

        y += 60
        self.chk_invalidated = ac.addCheckBox(self.window.app, "")
        ac.setPosition(self.chk_invalidated, 20, y)
        ac.addOnCheckBoxChanged(self.chk_invalidated, self.onCheckInvalidatedChanged)
        self.lbl_title_invalidated = (
            Label(self.window.app, "Lap can be invalidated")
            .setSize(200, 26)
            .setPos(65, y + 1)
            .setFontSize(16)
            .setAlign("left")
            .setVisible(1)
        )

        self.cfg_loaded = False
        self.cfg = Config("apps/python/prunn/", "config.ini")
        self.loadCFG()

        # thread
        self.key_listener = threading.Thread(target=self.listen_key)
        self.key_listener.daemon = True
        self.key_listener.start()
Exemplo n.º 22
0
    def __init__(self):
        self.visual_timeout = -1
        self.session = Value(-1)
        self.listen_active = True
        Colors.load_themes()
        Font.load_fonts()

        self.window = Window(name="ACTV CP Config",
                             icon=False,
                             width=251,
                             height=570,
                             texture="").setBgOpacity(0)

        y = 50
        self.spin_race_mode = ac.addSpinner(self.window.app,
                                            "Race tower mode :")
        ac.setRange(self.spin_race_mode, 0, 8)
        ac.setPosition(self.spin_race_mode, 20, y)
        ac.setValue(self.spin_race_mode, self.__class__.race_mode)
        ac.addOnValueChangeListener(self.spin_race_mode,
                                    self.on_spin_race_mode_changed)
        self.lbl_race_mode = Label(self.window.app, "Auto")\
            .setSize(120, 26).setPos(186, y - 28)\
            .setFontSize(12).setAlign("left")\
            .setVisible(1)

        y += 70
        self.spin_qual_mode = ac.addSpinner(self.window.app,
                                            "Qual tower mode :")
        ac.setRange(self.spin_qual_mode, 0, 4)
        ac.setPosition(self.spin_qual_mode, 20, y)
        ac.setValue(self.spin_qual_mode, self.__class__.qual_mode)
        ac.addOnValueChangeListener(self.spin_qual_mode,
                                    self.on_spin_qual_mode_changed)
        self.lbl_qual_mode = Label(self.window.app, "Gaps")\
            .setSize(120, 26).setPos(186, y - 28)\
            .setFontSize(12).setAlign("left")\
            .setVisible(1)

        y += 70
        self.spin_num_cars = ac.addSpinner(self.window.app,
                                           "Number cars tower")
        ac.setRange(self.spin_num_cars, 6, 80)
        ac.setPosition(self.spin_num_cars, 20, y)
        ac.setValue(self.spin_num_cars, self.__class__.max_num_cars)
        ac.addOnValueChangeListener(self.spin_num_cars,
                                    self.on_spin_num_cars_changed)

        y += 70
        self.spin_row_height = ac.addSpinner(self.window.app, "Row height")
        ac.setRange(self.spin_row_height, 26, 80)
        ac.setPosition(self.spin_row_height, 20, y)
        ac.setValue(self.spin_row_height, self.__class__.ui_row_height)
        ac.addOnValueChangeListener(self.spin_row_height,
                                    self.on_spin_row_height_changed)

        # Names mode
        y += 70
        self.spin_names = ac.addSpinner(self.window.app, "Names :")
        ac.setRange(self.spin_names, 0, 4)
        ac.setPosition(self.spin_names, 20, y)
        ac.setValue(self.spin_names, self.__class__.names)
        ac.addOnValueChangeListener(self.spin_names,
                                    self.on_spin_names_changed)
        self.lbl_names = Label(self.window.app, "TLC") \
            .setSize(120, 26).setPos(150, y - 28) \
            .setFontSize(12).setAlign("left") \
            .setVisible(1)

        # Refresh rate
        y += 70
        self.spin_refresh_rate = ac.addSpinner(self.window.app,
                                               "Refresh rate / sec")
        ac.setRange(self.spin_refresh_rate, 20, 120)
        ac.setPosition(self.spin_refresh_rate, 20, y)
        ac.setValue(self.spin_refresh_rate, self.__class__.refresh_rate)
        ac.addOnValueChangeListener(self.spin_refresh_rate,
                                    self.on_spin_refresh_rate_changed)

        y += 52
        self.chk_force_info = ac.addCheckBox(self.window.app, "")
        ac.setPosition(self.chk_force_info, 20, y)
        ac.addOnCheckBoxChanged(self.chk_force_info,
                                self.on_check_force_info_changed)
        self.lbl_title_force_info = Label(self.window.app, "Info always visible")\
            .setSize(200, 26).setPos(65, y + 1)\
            .setFontSize(16).setAlign("left")\
            .setVisible(1)

        y += 33
        self.chk_save_delta = ac.addCheckBox(self.window.app, "")
        ac.setPosition(self.chk_save_delta, 20, y)
        ac.addOnCheckBoxChanged(self.chk_save_delta,
                                self.on_check_save_delta_changed)
        self.lbl_title_save_delta = Label(self.window.app, "Save delta between sessions")\
            .setSize(200, 26).setPos(65, y + 3)\
            .setFontSize(14).setAlign("left")\
            .setVisible(1)

        y += 33
        self.chk_show_tires = ac.addCheckBox(self.window.app, "")
        ac.setPosition(self.chk_show_tires, 20, y)
        ac.addOnCheckBoxChanged(self.chk_show_tires,
                                self.on_check_show_tires_changed)
        self.lbl_title_show_tires = Label(self.window.app, "Show tires (tower)")\
            .setSize(200, 26).setPos(65, y + 3)\
            .setFontSize(14).setAlign("left")\
            .setVisible(1)

        self.cfg_loaded = False
        self.cfg = Config(Colors.app_path, "config.ini")
        self.load_cfg()

        # thread
        self.key_listener = threading.Thread(target=self.listen_key)
        self.key_listener.daemon = True
        self.key_listener.start()
Exemplo n.º 23
0
 def range(self, value):
     self._range = value
     ac.setRange(self.id, *value)
Exemplo n.º 24
0
Arquivo: acdelta.py Projeto: Nrde/ACTV
 def __init__(self):
     self.window = Window(name="ACTV Delta",
                          icon=False,
                          width=240,
                          height=246,
                          texture="")
     self.cursor = Value(False)
     self.session = Value(-1)
     self.performance = Value(0)
     self.performance_session = Value(0)
     self.spline = Value(0)
     self.laptime = Value(0)
     self.TimeLeftUpdate = Value(0)
     self.referenceLap = []
     self.referenceLap_session = []
     self.referenceLapTime = Value(0)
     self.referenceLapTime_session = Value(0)
     self.lastLapTime = Value(0)
     self.lapCount = 0
     self.lastLapIsValid = True
     self.currentLap = []
     self.deltaLoaded = False
     self.thread_save = False
     self.highlight_end = 0
     self.rowHeight = Value(-1)
     self.lbl_delta = Label(self.window.app, "+0.000")\
         .set(w=150, h=36,
              x=0, y=60,
              font_size=26,
              align="right",
              visible=1)
     self.lbl_session_delta = Label(self.window.app, "+0.000")\
         .set(w=150, h=36,
              x=0, y=40,
              font_size=14,
              align="right",
              visible=1)
     self.lbl_lap = Label(self.window.app, "0.000")\
         .set(w=150, h=32,
              x=0, y=80,
              font_size=17,
              align="right",
              visible=1)
     self.btn_reset = Button(self.window.app, self.on_reset_press)\
         .setPos(90, 68).setSize(60, 20)\
         .setText("Reset")\
         .setAlign("center")\
         .setBgColor(rgb([255, 12, 12], bg=True))\
         .setVisible(0)
     self.spin_row_height = ac.addSpinner(self.window.app, "")
     ac.setRange(self.spin_row_height, 20, 70)
     ac.setPosition(self.spin_row_height, 20, 28)
     ac.setValue(self.spin_row_height, self.__class__.ui_row_height)
     ac.addOnValueChangeListener(self.spin_row_height,
                                 self.on_spin_row_height_changed)
     ac.setVisible(self.spin_row_height, 0)
     font_name = "Segoe UI"
     if ac.initFont(0, font_name, 0, 0) > 0:
         self.lbl_delta.setFont(font_name, 0, 1)
         self.lbl_session_delta.setFont(font_name, 0, 1)
     self.cfg = Config("apps/python/prunn/", "config.ini")
     self.load_cfg()
Exemplo n.º 25
0
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"
Exemplo n.º 26
0
 def setRange(self, minVal, maxVal):
     ac.setRange(self.spinner, minVal, maxVal)
     return self
def create_ui_components():
    global appWindow
    global spinner_ballast, spinner_restrictor, spinner_smoothing, spinner_nonlinearity, spinner_calculation_interval, spinner_posting_interval
    global label_names, label_track_progress, label_penalties, label_last_message

    x_margin = 10
    y_margin = 80
    spacing = 16

    # Spinners
    spinner_ballast = ac.addSpinner(appWindow, "Max. ballast penalty (kg)")
    ac.setRange(spinner_ballast, 0, 5000)
    ac.setStep(spinner_ballast, 500)
    ac.setValue(spinner_ballast, 600)

    spinner_restrictor = ac.addSpinner(appWindow,
                                       "Max. restrictor penalty (pct.)")
    ac.setRange(spinner_restrictor, 0, 100)
    ac.setStep(spinner_restrictor, 10)
    ac.setValue(spinner_restrictor, 100)

    spinner_smoothing = ac.addSpinner(appWindow, "Smoothing (pct. of track)")
    ac.setRange(spinner_smoothing, 0, 100)
    ac.setStep(spinner_smoothing, 5)
    ac.setValue(spinner_smoothing, 10)

    spinner_nonlinearity = ac.addSpinner(appWindow, "Non-linearity")
    ac.setRange(spinner_nonlinearity, 1, 5)
    ac.setStep(spinner_nonlinearity, 1)
    ac.setValue(spinner_nonlinearity, 3)

    spinner_calculation_interval = ac.addSpinner(appWindow,
                                                 "Calculation interval (ms)")
    ac.setRange(spinner_calculation_interval, 500, 5000)
    ac.setStep(spinner_calculation_interval, 500)
    ac.setValue(spinner_calculation_interval, 1000)

    spinner_posting_interval = ac.addSpinner(appWindow,
                                             "Posting interval (ms)")
    ac.setRange(spinner_posting_interval, 1000, 20000)
    ac.setStep(spinner_posting_interval, 100)
    ac.setValue(spinner_posting_interval, 1500)

    # Text output
    label_names = ac.addLabel(appWindow,
                              "Driver names: {}".format(DRIVER_NAMES))
    ac.setFontSize(label_names, 10)

    label_track_progress = ac.addLabel(appWindow, "Track progresses:")
    ac.setFontSize(label_track_progress, 10)

    label_penalties = ac.addLabel(appWindow, "Penalty percentages:")
    ac.setFontSize(label_penalties, 10)

    label_last_message = ac.addLabel(appWindow, "Last message posted:")
    ac.setFontSize(label_last_message, 10)

    # Component positions
    ac.setPosition(spinner_ballast, x_margin, y_margin + (spacing * 0))
    ac.setPosition(spinner_restrictor, x_margin, y_margin + (spacing * 5))
    ac.setPosition(spinner_smoothing, x_margin, y_margin + (spacing * 10))
    ac.setPosition(spinner_nonlinearity, x_margin, y_margin + (spacing * 15))
    ac.setPosition(spinner_calculation_interval, x_margin,
                   y_margin + (spacing * 20))
    ac.setPosition(spinner_posting_interval, x_margin,
                   y_margin + (spacing * 25))
    ac.setPosition(label_names, x_margin, y_margin + (spacing * 30))
    ac.setPosition(label_track_progress, x_margin, y_margin + (spacing * 31))
    ac.setPosition(label_penalties, x_margin, y_margin + (spacing * 32))
    ac.setPosition(label_last_message, x_margin, y_margin + (spacing * 33))