Esempio n. 1
0
File: nChat.py Progetto: nuggs/nChat
def onWindowClick(x, y):
    global currentTrans, currentText, lines, maxLines
    currentTrans = 1
    currentText = 1
    for i in range(0, maxLines):
        for x in range(0, 2):
            ac.setVisible(lines[i][x], 1)
Esempio n. 2
0
    def visible(self, visible: bool):
        self._visible = visible

        if self.has_id:
            ac.setVisible(self.id, visible)

        self.fire(ACWidget.EVENT.VISIBILITY_CHANGED, self)
Esempio n. 3
0
def onFormRender(deltaT):
  global TYREINFO, optimal_spinner_id, optimal_spinner_shown
  tFL, tFR, tRL, tRR = ac.getCarState(0, acsys.CS.CurrentTyresCoreTemp)
  pFL, pFR, pRL, pRR = ac.getCarState(0, acsys.CS.DynamicPressure)
  dFL, dFR, dRL, dRR = ac.getCarState(0, acsys.CS.TyreDirtyLevel)
  wFL, wFR, wRL, wRR = readTyreWear()
  drawTyresAll(w_tyre, h_tyre, round(tFL, 4), round(tFR, 4), round(tRL, 4), round(tRR, 4), dFL, dFR, dRL, dFR)
  if inFahrenheit:
    tFL = CelsiusToFahrenheit(tFL)
    tFR = CelsiusToFahrenheit(tFR)
    tRL = CelsiusToFahrenheit(tRL)
    tRR = CelsiusToFahrenheit(tRR)
  TYREINFO.setTemp(tFL, tFR, tRL, tRR)
  TYREINFO.setPressure(pFL, pFR, pRL, pRR)
  #TYREINFO.setDirt(dFL, dFR, dRL, dRR)
  TYREINFO.setWear(wFL, wFR, wRL, wRR)
  TYREINFO.setMaxT(tFL, tFR, tRL, tRR)
  TYREINFO.setMaxP(pFL, pFR, pRL, pRR)
  
  isInPit = readIsInPit()
  if isInPit == 1 and optimal_spinner_shown == 0:
    ac.setVisible(optimal_spinner_id, 1)
    optimal_spinner_shown = 1
  elif isInPit == 0 and optimal_spinner_shown == 1:
    ac.setVisible(optimal_spinner_id, 0)
    optimal_spinner_shown = 0
Esempio n. 4
0
def onFormRender(deltaT):
    global TYREINFO, optimal_spinner_id, optimal_spinner_shown
    tFL, tFR, tRL, tRR = ac.getCarState(0, acsys.CS.CurrentTyresCoreTemp)
    pFL, pFR, pRL, pRR = ac.getCarState(0, acsys.CS.DynamicPressure)
    dFL, dFR, dRL, dRR = ac.getCarState(0, acsys.CS.TyreDirtyLevel)
    wFL, wFR, wRL, wRR = readTyreWear()
    drawTyresAll(w_tyre, h_tyre, round(tFL, 4), round(tFR, 4), round(tRL, 4),
                 round(tRR, 4), dFL, dFR, dRL, dFR)
    if inFahrenheit:
        tFL = CelsiusToFahrenheit(tFL)
        tFR = CelsiusToFahrenheit(tFR)
        tRL = CelsiusToFahrenheit(tRL)
        tRR = CelsiusToFahrenheit(tRR)
    TYREINFO.setTemp(tFL, tFR, tRL, tRR)
    TYREINFO.setPressure(pFL, pFR, pRL, pRR)
    #TYREINFO.setDirt(dFL, dFR, dRL, dRR)
    TYREINFO.setWear(wFL, wFR, wRL, wRR)
    TYREINFO.setMaxT(tFL, tFR, tRL, tRR)
    TYREINFO.setMaxP(pFL, pFR, pRL, pRR)

    isInPit = readIsInPit()
    if isInPit == 1 and optimal_spinner_shown == 0:
        ac.setVisible(optimal_spinner_id, 1)
        optimal_spinner_shown = 1
    elif isInPit == 0 and optimal_spinner_shown == 1:
        ac.setVisible(optimal_spinner_id, 0)
        optimal_spinner_shown = 0
 def hide(self):
     if self.timer > 0: return
     ac.setVisible(self.fastestLapBackground, 0)
     ac.setVisible(self.fastestLapBanner, 0)
     ac.setVisible(self.nameLabel, 0)
     ac.setVisible(self.lastNameLabel, 0)
     ac.setVisible(self.timeLabel, 0)
Esempio n. 6
0
 def manage_window(self, game_data):
     win_x = self.window.getPos().x
     win_y = self.window.getPos().y
     if win_x > 0:
         self.window.last_x = win_x
         self.window.last_y = win_y
     else:
         self.window.setLastPos()
         win_x = self.window.getPos().x
         win_y = self.window.getPos().y
     if win_x < game_data.cursor_x < win_x + self.window.width and win_y < game_data.cursor_y < win_y + self.window.height:
         self.cursor.setValue(True)
     else:
         self.cursor.setValue(False)
     session_changed = self.session.hasChanged()
     if session_changed:
         self.reset_data()
     if self.cursor.hasChanged() or session_changed:
         if self.cursor.value:
             self.window.setBgOpacity(0.4).border(0)
             self.window.showTitle(True)
             self.btn_reset.setVisible(1)
             ac.setVisible(self.spin_row_height, 1)
         else:
             self.window.setBgOpacity(0).border(0)
             self.window.showTitle(False)
             self.btn_reset.setVisible(0)
             ac.setVisible(self.spin_row_height, 0)
Esempio n. 7
0
File: nChat.py Progetto: nuggs/nChat
def onChatMessage(message, author) :
    global messages, lines, maxLines, currentText

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

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

            ac.setText(lines[maxLines-1-i][1], msg[1])
            ac.setSize(lines[maxLines-1-i][0], n_width, 14*1.4)
            ac.setSize(lines[maxLines-1-i][1], m_width, 14*1.4)
            if msg[0].strip().find(driver) > -1:
                ac.setFontColor(lines[maxLines-1-i][0], 0, 1, 0, 1)
            else:
                ac.setFontColor(lines[maxLines-1-i][0], random.random(), random.random(), random.random(), 1)
            ac.setFontColor(lines[maxLines-1-i][1], 1, 1, 1, 1)
            ac.setVisible(lines[maxLines-1-i][0], 1)
            ac.setVisible(lines[maxLines-1-i][1], 1)
            ac.setPosition(lines[maxLines-1-i][0], 0, ac.getPosition(lines[maxLines-1-i][0])[1])
            ac.setFontAlignment(lines[maxLines-1-i][0], "left")
            ac.setPosition(lines[maxLines-1-i][1], n_width+5, ac.getPosition(lines[maxLines-1-i][1])[1])
            ac.setFontAlignment(lines[maxLines-1-i][1], "left")
            ac.setText(lines[maxLines-1-i][0], msg[0]+":")
Esempio n. 8
0
File: acdelta.py Progetto: Nrde/ACTV
 def manage_window(self):
     pt = POINT()
     result = ctypes.windll.user32.GetCursorPos(ctypes.byref(pt))
     win_x = self.window.getPos().x
     win_y = self.window.getPos().y
     if win_x > 0:
         self.window.last_x = win_x
         self.window.last_y = win_y
     else:
         self.window.setLastPos()
         win_x = self.window.getPos().x
         win_y = self.window.getPos().y
     if result and pt.x > win_x and pt.x < win_x + self.window.width and pt.y > win_y and pt.y < win_y + self.window.height:
         self.cursor.setValue(True)
     else:
         self.cursor.setValue(False)
     session_changed = self.session.hasChanged()
     if session_changed:
         self.reset_data()
     if self.cursor.hasChanged() or session_changed:
         if self.cursor.value:
             self.window.setBgOpacity(0.4).border(0)
             self.window.showTitle(True)
             self.btn_reset.setVisible(1)
             ac.setVisible(self.spin_row_height, 1)
         else:
             self.window.setBgOpacity(0).border(0)
             self.window.showTitle(False)
             self.btn_reset.setVisible(0)
             ac.setVisible(self.spin_row_height, 0)
Esempio n. 9
0
	def setVisible(self, value):
		self.visible=value
		self.isVisible.setValue(bool(value))
		ac.setVisible(self.label, value)
		#self.params = self.o_params
		#self.f_params = self.o_params
		return self	
Esempio n. 10
0
 def mark_left_pits(self):
     if self.out or not self.pit: return
     self.pit = False
     if LeaderboardRow.update_type == INFO_TYPE.POSITIONS:
         ac.setVisible(self.positionChangeLabel, 1)
     if self.driverId == 0:
         ac.setText(self.infoLabel, "Interval")
     ac.setFontColor(self.infoLabel, 0.86, 0.86, 0.86, 1)
def 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)
Esempio n. 12
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)
Esempio n. 13
0
 def mark_out(self):
     if self.out: return
     self.out = True
     ac.setVisible(self.positionLabel, 0)
     ac.setVisible(self.positionChangeLabel, 0)
     ac.setPosition(self.teamLabel, self.px + 12, self.py + 2)
     ac.setPosition(self.nameLabel, self.px + 30, self.py + 4)
     ac.setFontColor(self.nameLabel, .58, .53, .53, 1)
     ac.setText(self.infoLabel, "OUT")
     ac.setFontColor(self.infoLabel, .58, .53, .53, 1)
 def show(self, time, driver_name, timer=FC.FASTEST_LAP_DISPLAY_TIME):
     ac.setText(self.nameLabel, driver_name.split()[0])
     ac.setText(self.lastNameLabel, driver_name.split()[-1].upper())
     ac.setText(self.timeLabel, time_to_string(time))
     ac.setVisible(self.fastestLapBackground, 1)
     ac.setVisible(self.fastestLapBanner, 1)
     ac.setVisible(self.nameLabel, 1)
     ac.setVisible(self.lastNameLabel, 1)
     ac.setVisible(self.timeLabel, 1)
     self.timer = timer
Esempio n. 15
0
 def mark_in(self):
     if not self.out: return
     self.out = False
     if LeaderboardRow.update_type == INFO_TYPE.POSITIONS:
         ac.setVisible(self.positionChangeLabel, 1)
     ac.setVisible(self.positionLabel, 1)
     ac.setPosition(self.teamLabel, self.px + 47, self.py + 2)
     ac.setPosition(self.nameLabel, self.px + 65, self.py + 4)
     ac.setFontColor(self.nameLabel, 0.86, 0.86, 0.86, 1)
     ac.setFontColor(self.infoLabel, 0.86, 0.86, 0.86, 1)
Esempio n. 16
0
def acMain(ac_version):
	global appWindow, CamberIndicators, CheckBoxes, Buttons, Options, Labels, UIData
	loadOptions()
	appWindow = ac.newApp("CamberExtravaganza")
	ac.setSize(appWindow, 200, 200)
	ac.drawBorder(appWindow, 0)
	ac.setBackgroundOpacity(appWindow, 0)
	ac.setIconPosition(appWindow, 0, -10000)

	# Only enable rendering if app is activated
	ac.addOnAppActivatedListener(appWindow, onAppActivated)
	ac.addOnAppDismissedListener(appWindow, onAppDismissed)

	# Target Camber Labels
	Labels["target"] = ac.addLabel(appWindow, "Target:")
	ac.setPosition(Labels["target"], 85, 100)
	ac.setFontSize(Labels["target"], 10)
	Labels["targetCamberF"] = ac.addLabel(appWindow, "")
	ac.setPosition(Labels["targetCamberF"], 75, 76)
	ac.setFontSize(Labels["targetCamberF"], 24)
	Labels["targetCamberR"] = ac.addLabel(appWindow, "")
	ac.setPosition(Labels["targetCamberR"], 75, 105)
	ac.setFontSize(Labels["targetCamberR"], 24)

	# Options Checkbox
	CheckBoxes["options"] = ac.addCheckBox(appWindow, "Options")
	ac.setPosition(CheckBoxes["options"], 50, 225)
	ac.addOnCheckBoxChanged(CheckBoxes["options"], checkboxHandler)

	# Option Buttons
	uidata = [
		["drawGraphs", "Draw Graphs", drawGraphsHandler],
		["normalize", "Normalize", normalizeHandler],
		["useSpectrum", "Use Spectrum", useSpectrumHandler]
	]
	x = 50
	y = 255
	dy = 30
	for d in uidata:
		Buttons[d[0]] = ac.addButton(appWindow, d[1])
		ac.setPosition(Buttons[d[0]], x, y)
		ac.setSize(Buttons[d[0]], 100, 25)
		ac.addOnClickedListener(Buttons[d[0]], d[2])
		ac.setVisible(Buttons[d[0]], 0)
		y += dy

	# Get optimal camber from files
	loadTireData()

	CamberIndicators["FL"] = CamberIndicator(appWindow, 25, 75)
	CamberIndicators["FR"] = CamberIndicator(appWindow,125, 75)
	CamberIndicators["RL"] = CamberIndicator(appWindow, 25,175)
	CamberIndicators["RR"] = CamberIndicator(appWindow,125,175)
	ac.addRenderCallback(appWindow, onFormRender)
	return "CamberExtravaganza"
Esempio n. 17
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()
Esempio n. 18
0
    def set_visible(self, visible):
        """Set label visibility on or off.

        Args:
            visible (bool): True to set visible, false to hide.

        When hidden, the label doesn't get rendered and costs no performance.
        """
        if visible:
            ac.setVisible(self.id, 1)
        else:
            ac.setVisible(self.id, 0)
Esempio n. 19
0
 def update_positions(self, pos_diff):
     if self.out or self.pit: return  # no need to update
     if self.update_type == INFO_TYPE.POSITIONS:
         ac.setVisible(self.positionChangeLabel, 1)
         if pos_diff > 0:
             ac.setBackgroundTexture(self.positionChangeLabel,
                                     FC.POSITION_GAINED)
         elif pos_diff < 0:
             ac.setBackgroundTexture(self.positionChangeLabel,
                                     FC.POSITION_LOST)
         else:
             ac.setBackgroundTexture(self.positionChangeLabel,
                                     FC.POSITION_MAINTAINED)
         ac.setText(self.infoLabel, str(abs(pos_diff)))
Esempio n. 20
0
 def update_name(self, id):
     if id == ac.getFocusedCar():
         ac.setVisible(self.highlightLabel, 1)
     else:
         ac.setVisible(self.highlightLabel, 0)
     if self.driverId == id: return  # no need to update
     self.driverId = id
     self.driverName = ac.getDriverName(id)
     displayName = self.driverName.split()[-1][:3].upper()
     ac.setText(self.nameLabel, displayName)
     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))
Esempio n. 21
0
def set_drs_penalty(totalPenalty):
    global drsPenaltyLabel, drsPenaltyBackgroundLabel
    if totalPenalty > 1:
        ac.setText(drsPenaltyLabel, "Penalty: +%ds" % totalPenalty)
        ac.setVisible(drsPenaltyLabel, 1)
        ac.setVisible(drsPenaltyBackgroundLabel, 1)
    else:
        ac.setVisible(drsPenaltyLabel, 0)
        ac.setVisible(drsPenaltyBackgroundLabel, 0)
  def onRender(self, delta_t):
    if self.first_update:
      return # bail out, nothing is ready

    # AC resets background opacity if the user moves the window.
    # Set it on every frame to force it.
    ac.setBackgroundOpacity(self.data.app_id, 0.0)

    # Our demo of frame count.
    self.local_frame_count += 1
    self.data.frame_count += 1

    # Example of hiding your label when in replay mode.
    if (sim_info.info.graphics.status not in (sim_info.AC_LIVE,
                                              sim_info.AC_PAUSE)):
      ac.setVisible(self.data.banner, 0)
    else:
      ac.setVisible(self.data.banner, 1)
Esempio n. 23
0
File: nChat.py Progetto: nuggs/nChat
def acUpdate(deltaT):
    global appWindow, inputWindow, currentTrans, updateTrans, currentText, updateText, lines, maxLines

    if currentTrans != 0:
        if currentTrans < updateTrans:
            currentTrans += 1
        else:
            ac.setBackgroundOpacity(appWindow, 0)
            ac.setBackgroundOpacity(inputWindow, 0)
            currentTrans = 0

    if currentText != 0:
        if currentText < updateText:
            currentText += 1
        else:
            for i in range(0, maxLines):
                for x in range(0, 2):
                    ac.setVisible(lines[i][x], 0)
    def onRender(self, delta_t):
        if self.first_update:
            return  # bail out, nothing is ready

        # AC resets background opacity if the user moves the window.
        # Set it on every frame to force it.
        ac.setBackgroundOpacity(self.data.app_id, 0.0)

        # Our demo of frame count.
        self.local_frame_count += 1
        self.data.frame_count += 1

        # Example of hiding your label when in replay mode.
        if (sim_info.info.graphics.status
                not in (sim_info.AC_LIVE, sim_info.AC_PAUSE)):
            ac.setVisible(self.data.banner, 0)
        else:
            ac.setVisible(self.data.banner, 1)
Esempio n. 25
0
    def initGui(self):
        width = 400
        height = (self.historySize * self.CHAT_LINE_HEIGHT)
        height += 40  # Title area
        height += 40  # Text input
        height += 10  # Padding between text input and messages

        ac.setSize(self.appWindow, width, height)
        ac.setPosition(self.textInput, 15, height - 40)
        ac.setSize(self.textInput, 360, 30)

        if self.firstLayout:
            ac.setPosition(self.shrinkButton, width - 50, 40)
            ac.setSize(self.shrinkButton, 20, 20)
            ac.setPosition(self.expandButton, width - 25, 40)
            ac.setSize(self.expandButton, 20, 20)
            self.firstLayout = False

        for row in self.labels:
            ac.setVisible(row['author'], 0)
            ac.setVisible(row['message'], 0)

        self.unusedLabels = self.labels

        self.labels = []
        nameX = 10
        nameWidth = 70

        messageX = nameX + nameWidth + 5

        labelY = 40

        for i in range(0, self.historySize):
            row = self.getUnusedRow()
            ac.setPosition(row['author'], nameX, labelY)
            ac.setSize(row['author'], nameWidth, 20)
            ac.setFontColor(row['author'], 1, 1, 0, 1)
            ac.setFontSize(row['author'], 12)
            ac.setFontAlignment(row['author'], "right")

            ac.setPosition(row['message'], messageX, labelY)
            ac.setSize(row['message'], width - messageX, 20)
            ac.setFontSize(row['message'], 12)

            ac.setVisible(row['author'], 1)
            ac.setVisible(row['message'], 1)

            self.labels.append(row)
            labelY += self.CHAT_LINE_HEIGHT

        self.update_messages()
Esempio n. 26
0
def uiHandler(*args, name, type):
	global Options, Buttons, Labels, TextInputs, redrawText
	if type == "Button":
		Options[name] = not Options[name]
		updateButtons()
		saveOptions()
	elif type == "TextInput":
		Options[name] = args[0]
		redrawText = True
		saveOptions()
	elif type == "CheckBox":
		v = 1 if args[0] == 1 else 0
		if name == "options":
			for key, button in Buttons.items():
				ac.setVisible(button, v)
			for key, input in TextInputs.items():
				ac.setVisible(input, v)

			updateButtons()
	else:
		pass
Esempio n. 27
0
 def manageWindow(self):
     pt = POINT()
     result = ctypes.windll.user32.GetCursorPos(ctypes.byref(pt))
     win_x = self.window.getPos().x
     win_y = self.window.getPos().y
     if win_x > 0:
         self.window.last_x = win_x
         self.window.last_y = win_y
     else:
         self.window.setLastPos()
         win_x = self.window.getPos().x
         win_y = self.window.getPos().y
     if (
         result
         and pt.x > win_x
         and pt.x < win_x + self.window.width
         and pt.y > win_y
         and pt.y < win_y + self.window.height
     ):
         self.cursor.setValue(True)
     else:
         self.cursor.setValue(False)
     sessionChanged = self.session.hasChanged()
     if sessionChanged:
         self.resetData()
     if self.cursor.hasChanged() or sessionChanged:
         if self.cursor.value:
             self.window.setBgOpacity(0.4).border(0)
             self.window.showTitle(True)
             self.btn_reset.setVisible(1)
             ac.setVisible(self.spin_row_height, 1)
         else:
             self.window.setBgOpacity(0).border(0)
             self.window.showTitle(False)
             self.btn_reset.setVisible(0)
             ac.setVisible(self.spin_row_height, 0)
Esempio n. 28
0
class Display:
    def __init__(self, options):
        self.appWindow = ac.appWindow
        self.scale = scale | 1
        self.x = x * self.scale | 0
        self.y = y * self.scale | 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 updateLabel(self, label, options):
        if (options.value):
            ac.setText(label, options.value)

        if (options.color):
            ac.setFontColor(label, options.color[0], options.color[1], options.color[2], options.color[3])

    def addImage(self, texture, options):
        options.x = options.x | 0
        options.y = options.y | 0
        options.width = options.width | 100
        options.height = options.height | 100

        item = ac.addLabel(self.appWindow, "")
        ac.setPosition(item, self.x + options.x * self.scale, self.y + options.y * self.scale)
	    ac.setSize(item, options.width * self.scale, options.height * self.scale)
        ac.setVisible()
        ac.setBackgroundTexture(item, IMAGE_FOLDER + texture)

        return item
Esempio n. 29
0
def acMain(ac_version):
    global appWindow, appName, logPrefix, flag1Label, flag2Label, flag3Label
    global cfg_flag1Image
    global cfg_flag2Image
    global cfg_flag3Image
    global cfg_flagWidth, cfg_flagHeight

    ac.console(logPrefix + "acMain")
    try:
        appWindow = ac.newApp(appName)
        ac.setTitle(appWindow, "")
        ac.setIconPosition(appWindow, -7000, -3000)
        ac.setSize(appWindow, cfg_flagWidth, cfg_flagHeight + 30)
        ac.drawBorder(appWindow, 0)
        ac.setBackgroundOpacity(appWindow, 0)

        flag1Label = ac.addLabel(appWindow, "")
        ac.setPosition(flag1Label, 0, 30)
        ac.setSize(flag1Label, cfg_flagWidth, cfg_flagHeight)
        ac.setBackgroundTexture(flag1Label, cfg_flag1Image)
        ac.setVisible(flag1Label, 0)

        flag2Label = ac.addLabel(appWindow, "")
        ac.setPosition(flag2Label, 0, 30)
        ac.setSize(flag2Label, cfg_flagWidth, cfg_flagHeight)
        ac.setBackgroundTexture(flag2Label, cfg_flag2Image)
        ac.setVisible(flag2Label, 0)

        flag3Label = ac.addLabel(appWindow, "")
        ac.setPosition(flag3Label, 0, 30)
        ac.setSize(flag3Label, cfg_flagWidth, cfg_flagHeight)
        ac.setBackgroundTexture(flag3Label, cfg_flag3Image)
        ac.setVisible(flag3Label, 0)

        ac.addRenderCallback(appWindow, onRender)
        ac.console(logPrefix + "Initialized")
    except:
        ac.console(logPrefix + "Initialize failed:", sys.exc_info()[0])

    return appName
Esempio n. 30
0
def set_drs_possible():
    global drsLabel
    ac.setBackgroundTexture(drsLabel, DRS_POSSIBLE_TEXTURE)
    ac.setVisible(drsLabel, 1)
Esempio n. 31
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
Esempio n. 32
0
def acUpdate(deltaT):
    global timer0, timer1
    global tyreLabels, tyrePressureLabels
    global drsLabel, ersLabel, ersModeLabel, ersRecoveryLabel, fuelLabel, drsPenaltyLabel, drsPenaltyBackgroundLabel
    global carValue, trackConfigValue, trackValue

    global currentLapValue, lapValue, previousLapValue, carWasInPit

    global totalDrivers, trackLength, driversList, totalPenalty, soundPlaying, drsAvailableZones, currentDrsZone, drsPenaltyAwardedInZone, lastTime

    global tyreCompoundShort, tyreCompoundCleaned, previousTyreCompoundValue, minimumOptimalTemperature, maximumOptimalTemperature, idealPressureFront, idealPressureRear
    global tyreTemperatureValue, tyreTemperatureValueI, tyreTemperatureValueM, tyreTemperatureValueO, tyrePressureValue, tyreCompoundValue
    global temperatureTransitionRange, tyrePracticalTemperatureValue
    global fuelAmountValue, fuelStartValue, relevantLapsNumber, fuelSpentValue, fuelPerLapValue

    global compounds, modCompounds

    timer0 += deltaT
    timer1 += deltaT

    # Once per second
    if timer0 > 1:
        timer0 = 0

        # =================================================================================================================
        #                                    GET A BUNCH OF INFO
        # =================================================================================================================
        tyreCompoundValue = info.graphics.tyreCompound
        tyreTemperatureValue = info.physics.tyreCoreTemperature
        tyreTemperatureValueI = info.physics.tyreTempI
        tyreTemperatureValueM = info.physics.tyreTempM
        tyreTemperatureValueO = info.physics.tyreTempO
        tyrePressureValue = info.physics.wheelsPressure

        fuelAmountValue = info.physics.fuel

        if ac.isCarInPitline(0):
            carWasInPit = 1

        # =================================================================================================================
        #                                   SET IDEAL TYRE PRESSURES AND TEMPERATURES
        # =================================================================================================================
        if previousTyreCompoundValue != tyreCompoundValue:
            previousTyreCompoundValue = tyreCompoundValue
            tyreCompoundShort = tyreCompoundValue[tyreCompoundValue.find("(") +
                                                  1:tyreCompoundValue.find(")"
                                                                           )]
            tyreCompoundCleaned = re.sub(
                '\_+$', '', re.sub(r'[^\w]+', '_', tyreCompoundValue)).lower()

            if compounds.has_section(carValue + "_" + tyreCompoundCleaned):
                try:
                    idealPressureFront = int(
                        compounds.get(carValue + "_" + tyreCompoundCleaned,
                                      "IDEAL_PRESSURE_F"))
                    idealPressureRear = int(
                        compounds.get(carValue + "_" + tyreCompoundCleaned,
                                      "IDEAL_PRESSURE_R"))
                    minimumOptimalTemperature = int(
                        compounds.get(carValue + "_" + tyreCompoundCleaned,
                                      "MIN_OPTIMAL_TEMP"))
                    maximumOptimalTemperature = int(
                        compounds.get(carValue + "_" + tyreCompoundCleaned,
                                      "MAX_OPTIMAL_TEMP"))
                except:
                    ac.console("Error loading tyre data.")
            elif modCompounds.has_section(carValue + "_" +
                                          tyreCompoundCleaned):
                try:
                    idealPressureFront = int(
                        modCompounds.get(carValue + "_" + tyreCompoundCleaned,
                                         "IDEAL_PRESSURE_F"))
                    idealPressureRear = int(
                        modCompounds.get(carValue + "_" + tyreCompoundCleaned,
                                         "IDEAL_PRESSURE_R"))
                    minimumOptimalTemperature = int(
                        float(
                            modCompounds.get(
                                carValue + "_" + tyreCompoundCleaned,
                                "MIN_OPTIMAL_TEMP")))
                    maximumOptimalTemperature = int(
                        float(
                            modCompounds.get(
                                carValue + "_" + tyreCompoundCleaned,
                                "MAX_OPTIMAL_TEMP")))
                    # ac.console("Tyres: {}, {}psi/{}psi, {}°C-{}°C".format(tyreCompoundValue, idealPressureFront, idealPressureRear, minimumOptimalTemperature, maximumOptimalTemperature))
                except:
                    ac.console("Error loading mod tyre data.")
            else:
                ac.console(
                    "Tyres: {}, no data found".format(tyreCompoundValue))

    # 10 times per second
    if timer1 > 0.1:
        timer1 = 0

        currentLapValue = info.graphics.iCurrentTime
        lapValue = ac.getCarState(0, acsys.CS.LapCount)
        lapProgressValue = ac.getCarState(0, acsys.CS.NormalizedSplinePosition)

        # =================================================================================================================
        #                                                  DRS
        # =================================================================================================================
        drsAvailableValue = ac.getCarState(0, acsys.CS.DrsAvailable)
        drsEnabledValue = ac.getCarState(0, acsys.CS.DrsEnabled)

        # =================================================================================================================
        #                                        DRS SIMPLE (not races)
        # =================================================================================================================

        if info.graphics.session != 2 and ac.getCarName(0) in DRS_ALLOWED_CARS:
            if drsEnabledValue:
                set_drs_good()
            elif drsAvailableValue:
                set_drs_available()

                if not soundPlaying and SOUND_ON:  # use this variable to control drs beep at begining of drs
                    sound_player.play(audio)
                    sound_player.stop()
                    soundPlaying = True
            else:
                soundPlaying = False
                ac.setVisible(drsLabel, 0)

        # =================================================================================================================
        #                                          DRS DATA COLLECTION
        # =================================================================================================================

        if info.graphics.session == 2 and ac.getCarName(0) in DRS_ALLOWED_CARS:

            crossedDetectionZone = -1
            crossedEndZone = -1
            crossedStartZone = -1
            curTime = time.time()
            for i in range(totalDrivers):
                spline = ac.getCarState(i, acsys.CS.NormalizedSplinePosition)
                for zid, zone in enumerate(drsZones):
                    if driver_crossed_zone(driversList[i].last_pos,
                                           zone['detection'], spline):
                        driversList[i].drs_detection_times[zid] = curTime
                        if i == 0:  # current driver
                            crossedDetectionZone = zid  # mark zone crossed by driver (not possible to cross multiple zone)
                    if i == 0 and driver_crossed_zone(driversList[i].last_pos,
                                                      zone['end'], spline):
                        crossedEndZone = zid
                    if i == 0 and driver_crossed_zone(driversList[i].last_pos,
                                                      zone['start'], spline):
                        crossedStartZone = zid
                driversList[i].last_pos = spline

        # =================================================================================================================
        #                                          DRS ALLOWANCE MANAGEMENT
        # =================================================================================================================

        # Race Restart
            if info.graphics.completedLaps == 0 and info.graphics.iCurrentTime == 0:
                totalPenalty = 0  # reset penalty
                set_drs_penalty(0)

            # DRS DETECTION Zone crossed
            if crossedDetectionZone != -1:
                if info.graphics.completedLaps + 1 >= DRS_STARTS_ON_LAP:  # if this is a valid lap
                    ac.log("Checking Detection Zone: " +
                           str(crossedDetectionZone) + " on lap: " +
                           str(info.graphics.completedLaps))
                    # check if there is any driver within DRS_GAP
                    if any(driversList[0].
                           drs_detection_times[crossedDetectionZone] -
                           driver.drs_detection_times[crossedDetectionZone] <=
                           DRS_GAP and driversList[0].
                           drs_detection_times[crossedDetectionZone] - driver.
                           drs_detection_times[crossedDetectionZone] >= 0
                           for driver in driversList[1:]):
                        set_drs_possible()
                        drsAvailableZones[crossedDetectionZone] = True

            # DRS END Zone crossed
            if crossedEndZone != -1:
                drsAvailableZones[crossedEndZone] = False
                currentDrsZone = -1
                drsPenaltyAwardedInZone = False
                # if next zone allows for drs already -- for cases where 1 DRS detection is used in 2 zones
                if drsAvailableZones[(crossedEndZone + 1) %
                                     len(drsAvailableZones)]:
                    set_drs_possible()
                set_drs_hidden()

            # DRS START Zone crossed
            if crossedStartZone != -1:
                currentDrsZone = crossedStartZone

            # IN DRS ZONE
            if drsAvailableValue:
                if drsAvailableZones[currentDrsZone]:
                    if drsEnabledValue:
                        set_drs_good()
                    else:
                        set_drs_available()
                        if totalPenalty > 0: totalPenalty -= curTime - lastTime
                        set_drs_penalty(totalPenalty)
                else:
                    if drsEnabledValue:
                        set_drs_bad()
                        if not drsPenaltyAwardedInZone:
                            drsPenaltyAwardedInZone = True
                            announcePenalty(
                                ac.getDriverName(0),
                                info.graphics.completedLaps + 1,
                                "Illegal DRS use, Zone %d" % (currentDrsZone))
                        # Add penalty amount
                        if abs(curTime - lastTime) < 1:
                            totalPenalty += curTime - lastTime
                        set_drs_penalty(totalPenalty)
                    else:
                        set_drs_hidden()

            # end of drs update save current values into lasts
            lastTime = curTime

        # =================================================================================================================
        #                                              ERS LABEL
        # =================================================================================================================

        ersRecoveryLevel = info.physics.ersRecoveryLevel
        ersMode = info.physics.ersPowerLevel
        ac.setText(ersModeLabel, "🗲{}".format(ersMode))
        ac.setText(ersRecoveryLabel, "↺{}".format(ersRecoveryLevel))
        ac.setFontColor(ersModeLabel, *ERS_COLORS[ersMode])
        ac.setFontColor(ersLabel, *ERS_COLORS[ersMode])
        ac.setFontColor(ersRecoveryLabel, *ERS_COLORS[ersMode])

        # =================================================================================================================
        #                                              FUEL LABEL
        # =================================================================================================================

        if fuelPerLapValue:
            ac.setText(
                fuelLabel,
                "💧 {:.1f} Laps".format(fuelAmountValue / fuelPerLapValue))

        # =================================================================================================================
        #                                          TYRE TEMPERATURES
        # =================================================================================================================

        for i in range(4):
            tyrePracticalTemperatureValue[i] = 0.25 * (
                (tyreTemperatureValueI[i] + tyreTemperatureValueM[i] +
                 tyreTemperatureValueO[i]) /
                3) + 0.75 * tyreTemperatureValue[i]

        for i, label in enumerate(tyreLabels):
            # ac.setText(label, "{:.0f}".format(tyrePracticalTemperatureValue[i]))
            if minimumOptimalTemperature and maximumOptimalTemperature:
                if int(round(tyrePracticalTemperatureValue[i])
                       ) >= minimumOptimalTemperature and int(
                           round(tyrePracticalTemperatureValue[i])
                       ) <= maximumOptimalTemperature:
                    ac.setBackgroundColor(label, 0.17, 1, 0)
                elif int(round(tyrePracticalTemperatureValue[i])
                         ) < minimumOptimalTemperature:
                    idealTemperatureDifference = min(
                        temperatureTransitionRange, minimumOptimalTemperature -
                        tyrePracticalTemperatureValue[i]
                    ) / temperatureTransitionRange
                    ac.setBackgroundColor(
                        label, max(0,
                                   0.17 - idealTemperatureDifference / 5.88),
                        max(0.51, 1 - idealTemperatureDifference / 1.96),
                        min(1, 0 + idealTemperatureDifference))
                elif int(round(tyrePracticalTemperatureValue[i])
                         ) > maximumOptimalTemperature:
                    idealTemperatureDifference = min(
                        temperatureTransitionRange,
                        tyrePracticalTemperatureValue[i] -
                        maximumOptimalTemperature) / temperatureTransitionRange
                    ac.setBackgroundColor(
                        label, min(1,
                                   0.17 + idealTemperatureDifference / 0.83),
                        max(0.17, 1 - idealTemperatureDifference / 0.83), 0)
            else:
                ac.setBackgroundOpacity(label, 0)
            ac.setBackgroundOpacity(
                label, 1
            )  # background colors start to hyde for some reason so this is needed

        for i, label in enumerate(tyrePressureLabels):
            if idealPressureFront and idealPressureRear:
                if i < 2:  # front
                    ac.setText(
                        label, "{:+.1f}".format(tyrePressureValue[i] -
                                                idealPressureFront))
                else:  # rear
                    ac.setText(
                        label, "{:+.1f}".format(tyrePressureValue[i] -
                                                idealPressureRear))
            else:
                ac.setText(label, "{:.0f}".format(tyrePressureValue[i]))

    # =================================================================================================================
    #                                     CALCULATE AT LAP ENDING OR LAP START
    # =================================================================================================================

    #Display/calculate on lap start
    if currentLapValue > 500 and currentLapValue < 1000:
        carWasInPit = 0
        fuelStartValue = fuelAmountValue

    #Display/calculate on lap finish
    if previousLapValue < lapValue:
        # announce any penalty at the end of a lap
        if totalPenalty > 0:
            announceTotalPenalty(ac.getDriverName(0),
                                 info.graphics.completedLaps + 1)
        previousLapValue = lapValue

        #Fuel per lap
        if fuelAmountValue < fuelStartValue and not carWasInPit:
            relevantLapsNumber += 1
            fuelSpentValue += fuelStartValue - fuelAmountValue
            fuelPerLapValue = fuelSpentValue / relevantLapsNumber
 def setVisible(self, visible):
     ac.setVisible(self.app, visible)
     return self
 def setVisible(self, value):
     ac.setVisible(self.label, value)
     return self
 def _set_bar_area_visible(self, visible):
   ac.setVisible(self.data.bar_area, visible)
Esempio n. 36
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"
 def _set_delta_label_visible(self, visible):
   ac.setVisible(self.data.delta_label_area, visible)
   ac.setVisible(self.data.delta_label, visible)
 def show(self):
     ac.setVisible(self.id, 1)
Esempio n. 39
0
def set_drs_hidden():
    global drsLabel
    ac.setVisible(drsLabel, 0)
Esempio n. 40
0
def set_drs_available():
    global drsLabel
    ac.setBackgroundTexture(drsLabel, DRS_AVAILABLE_TEXTURE)
    ac.setVisible(drsLabel, 1)
Esempio n. 41
0
    def __init__(self, name, headerName, fontSize, showHeader):
        self.headerName = headerName
        self.window = ac.newApp(name)
        if showHeader == 1:
            ac.setTitle(self.window, "")
            ac.setIconPosition(self.window, -10000, -10000)
            self.firstSpacing = 0
        else:
            ac.setTitle(self.window, headerName)
            self.firstSpacing = firstSpacing

        self.fontSize = fontSize

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

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

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

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

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

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

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

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

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

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

        rowIndex += 1

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

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Lock best:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleLockBest)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.lockBestId = rowIndex
Esempio n. 42
0
    def refreshParameters(self):
        if showHeader:
            ac.setTitle(self.window, self.headerName)
            ac.setIconPosition(self.window, 0, 0)
            self.firstSpacing = firstSpacing
        else:
            ac.setTitle(self.window, "")
            ac.setIconPosition(self.window, -10000, -10000)
            self.firstSpacing = 0

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

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

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

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

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

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

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

        rowIndex = lapDisplayedCount

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

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

        rowIndex += showCurrent

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

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

        rowIndex += showReference

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

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

        # Force full refresh
        self.updateDataFast()
        self.updateDataRef()
        self.updateViewFast()
        self.updateViewNewLap()
 def hide(self):
     ac.setVisible(self.id, 0)
Esempio n. 44
0
def set_drs_good():
    global drsLabel
    ac.setBackgroundTexture(drsLabel, DRS_GOOD_TEXTURE)
    ac.setVisible(drsLabel, 1)
Esempio n. 45
0
	def setVisible(self, value):
		ac.setVisible(self.button, value)
		return self	
 def visible(self, value):
     self._visible = value
     ac.setVisible(self.id, self._visible)
def toggle_settings_visiblity(name, state):
    if state == 1:
        ac.setVisible(min_rpm_spinner, 1)
        ac.setVisible(max_rpm_spinner, 1)
        ac.setVisible(units_spinner, 1)
    if state == 0:
        ac.setVisible(min_rpm_spinner, 0)
        ac.setVisible(max_rpm_spinner, 0)
        ac.setVisible(units_spinner, 0)