Esempio n. 1
0
def acMain(ac_version):
    global version, appName, mainApp, x_app_size, y_app_size, backgroundOpacity, customFontName

    try:
        debug("starting version " + version)

        mainApp = ac.newApp(appName)
        ac.setTitle(mainApp, "")
        ac.drawBorder(mainApp, 0)
        ac.setIconPosition(mainApp, 0, -10000)
        ac.setBackgroundOpacity(mainApp, backgroundOpacity)
#        ac.initFont(0, customFontName, 0, 0)
        ac.setSize(mainApp, x_app_size, y_app_size)
        ac.addOnAppActivatedListener(mainApp, onMainAppActivatedListener)
        ac.addOnAppDismissedListener(mainApp, onMainAppDismissedListener)
        ac.addRenderCallback(mainApp, onMainAppFormRender)

        getSettings()
        createUI()

        return appName

    except exception:
        debug(repr(traceback.format_exception(exc_type, exc_value, exc_traceback)))
        showMessage("Error: " + traceback.format_exc())
  def reinitialize_statusbox(self):
    field = 'enable_timing_window'
    if field not in self.data.config:
      self.data.config[field] = False

    if not self.data.config[field]:
      # Window is explicitly disabled, bail out.
      return

    if not hasattr(self.data, 'app_id2'):
      app_id2 = ac.newApp('deltabar timer')
      if app_id2 < 0:
        return  # bail out, new window did not work
      else:
        self.data.app_id2 = app_id2

    ac.setTitle(self.data.app_id2, "")
    ac.setBackgroundOpacity(self.data.app_id2, 0.5)
    ac.drawBorder(self.data.app_id2, 0)
    ac.setIconPosition(self.data.app_id2, 0, -10000)
    ac.setSize(self.data.app_id2, 300, 200)

    self.statusbox = statusbox.StatusBox(self.data, self.track.sector_count,
                                         bar_mode=self.bar_mode)
    self.statusbox.update_all(self.bar_mode)
    def reinitialize_statusbox(self):
        field = 'enable_timing_window'
        if field not in self.data.config:
            self.data.config[field] = False

        if not self.data.config[field]:
            # Window is explicitly disabled, bail out.
            return

        if not hasattr(self.data, 'app_id2'):
            app_id2 = ac.newApp('deltabar timer')
            if app_id2 < 0:
                return  # bail out, new window did not work
            else:
                self.data.app_id2 = app_id2

        ac.setTitle(self.data.app_id2, "")
        ac.setBackgroundOpacity(self.data.app_id2, 0.5)
        ac.drawBorder(self.data.app_id2, 0)
        ac.setIconPosition(self.data.app_id2, 0, -10000)
        ac.setSize(self.data.app_id2, 300, 200)

        self.statusbox = statusbox.StatusBox(self.data,
                                             self.track.sector_count,
                                             bar_mode=self.bar_mode)
        self.statusbox.update_all(self.bar_mode)
Esempio n. 4
0
	def __init__(self, name="defaultAppWindow", title="", icon=True, width=100, height=100, scale=1, texture=""):
		# local variables
		self.name        = name
		self.title       = title
		self.width       = width
		self.height      = height
		self.x           = 0
		self.y           = 0
		self.is_attached = False
		self.attached_l  = -1
		self.attached_r  = -1
		
		# creating the app window
		self.app = ac.newApp(self.name)
		
		# default settings
		ac.drawBorder(self.app, 0)
		ac.setBackgroundOpacity(self.app, 0)
		if icon is False:
			ac.setIconPosition(self.app, 0, -10000)
		
		# applying settings
		ac.setTitle(self.app, self.title)
		ac.setBackgroundTexture(self.app, texture)
		ac.setSize(self.app, math.floor(self.width*scale), math.floor(self.height*scale))
Esempio n. 5
0
    def __init__(self, cfg):
        # Config data
        self.cfg = cfg

        # Set up app window
        self.id = ac.newApp(self.cfg.app_name)

        # Set app dimensions
        ac.setSize(self.id, self.cfg.app_width, self.cfg.app_height)

        # TODO Check if this works.
        self.bg_texture_path = cfg.app_dir + "/img/bg.png"
        # self.bg_texture_path = "apps/python/traces/img/bg.png"
        ac.setBackgroundTexture(self.id, self.bg_texture_path)

        # Hide default background and border
        ac.setBackgroundOpacity(self.id, 0)
        ac.drawBorder(self.id, 0)

        # Empty app title in order to hide it
        ac.setTitle(self.id, "")

        # Move app icon off-screen
        ac.setIconPosition(self.id, 0, -10000)

        # Initialize empty list of drawable objects.
        self.drawables = []
Esempio n. 6
0
    def __init__(self, acd, configs):
        """ Default constructor. """
        self.__active = False
        self.__data = Data()
        self.__data_log = []
        self.__info = info
        self.__options = {
            "Logging": configs.get_bool_option("Logging"),
            "RPMPower": configs.get_bool_option("RPMPower")
        }
        self.__window_id = ac.newApp("Live Telemetry Engine")
        ac.drawBorder(self.__window_id, 0)
        ac.setBackgroundOpacity(self.__window_id, 0.0)
        ac.setIconPosition(self.__window_id, 0, -10000)
        ac.setTitle(self.__window_id, "")

        position = configs.get_window_position("EN")
        ac.setPosition(self.__window_id, *position)

        size = configs.get_option("Size")
        mult = BoxComponent.resolution_map[size]
        ac.setSize(self.__window_id, 512 * mult, 85 * mult)

        self.__components = []
        self.__components.append(RPMPower(acd, size, self.__window_id))

        # Only starts to draw after the setup.
        self.set_active(configs.is_window_active("EN"))
Esempio n. 7
0
def onFormRender(deltaT):
    global showWindowTitle, appWindowActivated, appWindow, dbgLabel, running
    if not running:
        return

    #Important: Other apps can alter the global ac.gl Color and Alpha; let's reset this to White
    ac.glColor4f(1, 1, 1, 1)

    #Show/Hide the title shortly after the app became visible
    if showWindowTitle:
        if (time.clock() - appWindowActivated > showTitle):
            showWindowTitle = False
            ac.setBackgroundOpacity(appWindow, 0)
            ac.setIconPosition(appWindow, -7000, -3000)
            ac.setTitle(appWindow, "")

    try:
        #we won't do all the calculations every time, so we have to sort out some frames.
        #But: We'll need the graphics stuff every single time, or we'll have flickering. But no worry, opengl is fast

        if timeForCalculationCame():
            doCalculationStuff()

        #Now we draw the current cars on the minimap
        drawCars()

    except Exception as e:
        ac.log("helipicapew::onFormRender() %s" % e)

    #Important: We'll clean the color again, so we might not affect other apps
    ac.glColor4f(1, 1, 1, 1)
    def reinitialize(self):
        ac.setTitle(self.data.app_id, "")
        self.hide_app_background()
        ac.drawBorder(self.data.app_id, 0)
        ac.setIconPosition(self.data.app_id, 0, -10000)
        ac.setSize(self.data.app_id, config.APP_WIDTH, config.APP_HEIGHT)

        # Click on app area handling - used for toggling modes
        if not hasattr(self.data, 'click_label'):
            self.data.click_label = ac.addLabel(self.data.app_id, '')
            ac.addOnClickedListener(self.data.click_label,
                                    sys.modules['deltabar'].onClick)
        ac.setPosition(self.data.click_label, 0, 0)
        ac.setSize(self.data.click_label, config.APP_WIDTH, config.APP_HEIGHT)

        # Delta bar main area
        if not hasattr(self.data, 'bar_area'):
            self.data.bar_area = ac.addLabel(self.data.app_id, '')
        ac.setPosition(self.data.bar_area, config.BAR_CORNER_RADIUS, 0)
        ac.setSize(self.data.bar_area,
                   config.BAR_WIDTH - 2 * config.BAR_CORNER_RADIUS,
                   config.BAR_HEIGHT)
        ac.setBackgroundColor(self.data.bar_area, *config.BACKGROUND_COLOR.rgb)
        ac.setBackgroundOpacity(self.data.bar_area,
                                config.BACKGROUND_COLOR.alpha)

        # Delta label background area
        if not hasattr(self.data, 'delta_label_area'):
            self.data.delta_label_area = ac.addLabel(self.data.app_id, '')
        ac.setPosition(self.data.delta_label_area,
                       config.BAR_WIDTH_HALF - config.DELTA_LABEL_WIDTH_HALF,
                       config.DELTA_LABEL_Y)
        ac.setSize(self.data.delta_label_area, config.DELTA_LABEL_WIDTH,
                   config.DELTA_LABEL_HEIGHT)
        ac.setBackgroundTexture(self.data.delta_label_area,
                                'apps/python/deltabar/background_delta.png')

        # Delta label text
        if not hasattr(self.data, 'delta_label'):
            self.data.delta_label = ac.addLabel(self.data.app_id, '')
        ac.setPosition(self.data.delta_label,
                       config.BAR_WIDTH_HALF - config.DELTA_LABEL_WIDTH_HALF,
                       config.DELTA_LABEL_TEXT_Y)
        ac.setSize(self.data.delta_label, config.DELTA_LABEL_WIDTH,
                   config.DELTA_LABEL_FONT_SIZE)
        ac.setFontAlignment(self.data.delta_label, 'center')
        ac.setFontSize(self.data.delta_label, config.DELTA_LABEL_FONT_SIZE)

        # Banner label (displays current selected mode)
        if not hasattr(self.data, 'banner_label'):
            self.data.banner_label = ac.addLabel(self.data.app_id, '')
        ac.setPosition(self.data.banner_label,
                       config.BAR_WIDTH_HALF - config.BANNER_TEXT_WIDTH / 2,
                       config.BANNER_Y)
        ac.setSize(self.data.banner_label, config.BANNER_TEXT_WIDTH,
                   config.BANNER_FONT_SIZE)
        ac.setFontAlignment(self.data.banner_label, 'center')
        ac.setFontSize(self.data.banner_label, config.BANNER_FONT_SIZE)
        ac.setFontColor(self.data.banner_label, *config.SLOW_COLOR.rgba)
Esempio n. 9
0
def onAppActivated(*args):
    global appWindowActivated, showWindowTitle
    ac.log("helipicapew::onAppActivated({0})".format(args))
    appWindowActivated = time.clock()
    showWindowTitle = True
    ac.setBackgroundOpacity(appWindow, 0.5)
    ac.setIconPosition(appWindow, 0, 0)
    ac.setTitle(appWindow, "helipicapew v{}".format(version))
  def acMain(self, version):
    ac.setTitle(self.data.app_id, "")
    ac.setBackgroundOpacity(self.data.app_id, 0.0)
    ac.drawBorder(self.data.app_id, 0)
    ac.setIconPosition(self.data.app_id, 0, -10000)
    ac.setSize(self.data.app_id, config.APP_WIDTH, config.APP_HEIGHT)

    return 'hot_app'
    def acMain(self, version):
        ac.setTitle(self.data.app_id, "")
        ac.setBackgroundOpacity(self.data.app_id, 0.0)
        ac.drawBorder(self.data.app_id, 0)
        ac.setIconPosition(self.data.app_id, 0, -10000)
        ac.setSize(self.data.app_id, config.APP_WIDTH, config.APP_HEIGHT)

        return 'hot_app'
  def reinitialize(self):
    ac.setTitle(self.data.app_id, "")
    self.hide_app_background()
    ac.drawBorder(self.data.app_id, 0)
    ac.setIconPosition(self.data.app_id, 0, -10000)
    ac.setSize(self.data.app_id, config.APP_WIDTH, config.APP_HEIGHT)

    # Click on app area handling - used for toggling modes
    if not hasattr(self.data, 'click_label'):
      self.data.click_label = ac.addLabel(self.data.app_id, '')
      ac.addOnClickedListener(self.data.click_label, sys.modules['deltabar'].onClick)
    ac.setPosition(self.data.click_label, 0, 0)
    ac.setSize(self.data.click_label, config.APP_WIDTH, config.APP_HEIGHT)

    # Delta bar main area
    if not hasattr(self.data, 'bar_area'):
      self.data.bar_area = ac.addLabel(self.data.app_id, '')
    ac.setPosition(self.data.bar_area, config.BAR_CORNER_RADIUS, 0)
    ac.setSize(self.data.bar_area,
               config.BAR_WIDTH - 2 * config.BAR_CORNER_RADIUS,
               config.BAR_HEIGHT)
    ac.setBackgroundColor(self.data.bar_area, *config.BACKGROUND_COLOR.rgb)
    ac.setBackgroundOpacity(self.data.bar_area, config.BACKGROUND_COLOR.alpha)

    # Delta label background area
    if not hasattr(self.data, 'delta_label_area'):
      self.data.delta_label_area = ac.addLabel(self.data.app_id, '')
    ac.setPosition(self.data.delta_label_area,
                   config.BAR_WIDTH_HALF - config.DELTA_LABEL_WIDTH_HALF,
                   config.DELTA_LABEL_Y)
    ac.setSize(self.data.delta_label_area, config.DELTA_LABEL_WIDTH, config.DELTA_LABEL_HEIGHT)
    ac.setBackgroundTexture(self.data.delta_label_area,
                            'apps/python/deltabar/background_delta.png')

    # Delta label text
    if not hasattr(self.data, 'delta_label'):
      self.data.delta_label = ac.addLabel(self.data.app_id, '')
    ac.setPosition(self.data.delta_label,
                   config.BAR_WIDTH_HALF - config.DELTA_LABEL_WIDTH_HALF,
                   config.DELTA_LABEL_TEXT_Y)
    ac.setSize(self.data.delta_label,
               config.DELTA_LABEL_WIDTH, config.DELTA_LABEL_FONT_SIZE)
    ac.setFontAlignment(self.data.delta_label, 'center')
    ac.setFontSize(self.data.delta_label, config.DELTA_LABEL_FONT_SIZE)

    # Banner label (displays current selected mode)
    if not hasattr(self.data, 'banner_label'):
      self.data.banner_label = ac.addLabel(self.data.app_id, '')
    ac.setPosition(self.data.banner_label,
                   config.BAR_WIDTH_HALF - config.BANNER_TEXT_WIDTH / 2,
                   config.BANNER_Y)
    ac.setSize(self.data.banner_label,
               config.BANNER_TEXT_WIDTH, config.BANNER_FONT_SIZE)
    ac.setFontAlignment(self.data.banner_label, 'center')
    ac.setFontSize(self.data.banner_label, config.BANNER_FONT_SIZE)
    ac.setFontColor(self.data.banner_label, *config.SLOW_COLOR.rgba)
Esempio n. 13
0
def acMain(ac_version):
    global appWindow
    
    appWindow = ac.newApp("Analog Speedometer")
    ac.setTitle(appWindow, "")
    ac.setIconPosition(appWindow, 0, -10000)
    ac.setSize(appWindow, width, height)
    ac.drawBorder(appWindow, 0)

    ac.addRenderCallback(appWindow, drawNeedle)
Esempio n. 14
0
def onAppActivated(*args):
    global appWindowActivated, showWindowTitle

    ac.log("3secondz_xyro::onAppActivated({0})".format(args))
    appWindowActivated = time.clock()
    showWindowTitle = True
    ac.setBackgroundOpacity(appWindow, 0.5)
    ac.setIconPosition(appWindow, 0, 0)
    ac.setTitle(appWindow, '3secondz_xyro')
    running = True
Esempio n. 15
0
def createApp(label):
    app = ac.newApp(label)
    ac.setTitle(app, "")
    ac.setIconPosition(app, 0, -10000)
    ac.setSize(app, 100, 50)
    ac.drawBorder(app, 0)

    label = ac.addLabel(app, "")
    ac.setPosition(label, 10, 5)
    return app, label
Esempio n. 16
0
def acMain(ac_version):
    global appWindow, Labels, gearSpacing, fontSize, gears, PxPer1000RPM, RPMdivs
    appWindow = ac.newApp("Reventach")
    ac.setSize(appWindow, appWidth, appHeight)
    ac.drawBorder(appWindow, 0)
    ac.setBackgroundOpacity(appWindow, 0)
    ac.setIconPosition(appWindow, 0, -10000)
    ac.setTitle(appWindow, "")

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

    loadCarData()
    PxPer1000RPM = 1000 * appHeight / CarData["maxRPM"]
    RPMdivs = CarData["maxRPM"] // 10000 + 1
    #~ fontSize = PxPer1000RPM * 0.5 * RPMdivs
    fontSize = appHeight / 15

    y = appHeight - PxPer1000RPM * RPMdivs
    count = RPMdivs
    while y > -1:
        dx = (appHeight - y) / lineSlope
        Labels["rpmL" + str(count)] = ac.addLabel(appWindow, str(count))
        ac.setPosition(Labels["rpmL" + str(count)], dx - fontSize,
                       y - fontSize / 2)
        ac.setFontSize(Labels["rpmL" + str(count)], fontSize)
        ac.setFontAlignment(Labels["rpmL" + str(count)], "center")
        Labels["rpmR" + str(count)] = ac.addLabel(appWindow, str(count))
        ac.setPosition(Labels["rpmR" + str(count)], appWidth - dx + fontSize,
                       y - fontSize / 2)
        ac.setFontSize(Labels["rpmR" + str(count)], fontSize)
        ac.setFontAlignment(Labels["rpmR" + str(count)], "center")

        if y < PxPer1000RPM * RPMdivs - 1:
            ac.setFontColor(Labels["rpmL" + str(count)], 0.7, 0.0, 0.0, 0.9)
            ac.setFontColor(Labels["rpmR" + str(count)], 0.7, 0.0, 0.0, 0.9)

        y -= (PxPer1000RPM * RPMdivs)
        count += RPMdivs

    for n in range(CarData["totalGears"]):
        gears.insert(0, str(n + 1))

    gearSpacing = appHeight / (CarData["totalGears"] + 2)
    fontSize = gearSpacing * 0.8

    for n, c in enumerate(gears):
        Labels["gear" + c] = ac.addLabel(appWindow, c)
        ac.setPosition(Labels["gear" + c], appWidth / 2, (n * gearSpacing))
        ac.setFontSize(Labels["gear" + c], fontSize)
        ac.setFontAlignment(Labels["gear" + c], "center")

    ac.addRenderCallback(appWindow, onFormRender)
    return "Reventach"
Esempio n. 17
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. 18
0
 def __init__(self, name, tyre=None, render_function=None):
     self.window = ac.newApp(name)
     self.tyre = tyre
     ac.setIconPosition(self.window, 9999999, 99999999)  # hide the icon
     ac.setSize(self.window, TyreWindow.width, TyreWindow.height)
     self.opt_label = ac.addLabel(self.window, "Opt:")
     ac.setPosition(self.opt_label, 5, 50)
     self.slip_label = ac.addLabel(self.window, "Slip:\nSkid:")
     ac.setPosition(self.slip_label, 5, 70)
     self.starting_label_no = ac.addLabel(self.window, "")
     ac.addRenderCallback(self.window, render_function)
     ac.setFontSize(self.starting_label_no, 25)
     ac.setPosition(self.starting_label_no, 35, 20)
Esempio n. 19
0
    def __init__(self, acd: ACD, configs: Config, wheel_index: int) -> None:
        """ Default constructor receive the index of the wheel it will draw info. """
        self.__wheel = WheelPos(wheel_index)
        self.__active = False
        self.__data = Data()
        self.__data_log = []
        self.__info = info
        self.__options = {
            "Camber": configs.get_bool_option("Camber"),
            "Dirt": configs.get_bool_option("Dirt"),
            "Height": configs.get_bool_option("Height"),
            "Load": configs.get_bool_option("Load"),
            "Lock": configs.get_bool_option("Lock"),
            "Logging": configs.get_bool_option("Logging"),
            "Pressure": configs.get_bool_option("Pressure"),
            "Suspension": configs.get_bool_option("Suspension"),
            "Temps": configs.get_bool_option("Temps"),
            "Tire": configs.get_bool_option("Tire"),
            "Wear": configs.get_bool_option("Wear")
        }
        self.__window_id = ac.newApp("Live Telemetry {}".format(
            self.__wheel.name()))
        ac.drawBorder(self.__window_id, 0)
        ac.setBackgroundOpacity(self.__window_id, 0.0)
        ac.setIconPosition(self.__window_id, 0, -10000)
        ac.setTitle(self.__window_id, "")

        position = configs.get_window_position(self.__wheel.name())
        ac.setPosition(self.__window_id, *position)

        size = configs.get_option("Size")
        mult = BoxComponent.resolution_map[size]
        ac.setSize(self.__window_id, 512 * mult, 271 * mult)

        self.__components = []
        self.__components.append(Temps(acd, size, self.__wheel))
        self.__components.append(Dirt(size))
        self.__components.append(Lock(acd, size, self.__wheel))
        self.__components.append(Tire(acd, size, self.__wheel))

        self.__components.append(Camber(size))
        self.__components.append(Suspension(size, self.__wheel))
        self.__components.append(Height(size, self.__wheel, self.__window_id))
        self.__components.append(
            Pressure(acd, size, self.__wheel, self.__window_id))
        self.__components.append(Wear(size, self.__wheel))
        # Needs to be the last to render above all components
        self.__components.append(Load(size, self.__wheel))

        # Only draw after the setup
        self.set_active(configs.is_window_active(self.__wheel.name()))
Esempio n. 20
0
    def __init__(self, app_name, x, y, w, h):
        self.children = []
        self.x = x
        self.y = y
        self.w = w
        self.h = h
        self.app = ac.newApp(app_name)
        ac.setTitle(self.app, app_name)
        ac.setSize(self.app, self.w, self.h)
        ac.setIconPosition(self.app, 0, -10000)
        ac.setTitlePosition(self.app, 0, -10000)
        ac.drawBorder(self.app, 0)
        ac.drawBackground(self.app, 0)

        self.update()
Esempio n. 21
0
def acMain(ac_version):
    global ui_driver_list, track_name, session_type

    appName = "Joker Check"
    appWindow = ac.newApp(appName)
    ac.setSize(appWindow, 150, 150)
    ac.drawBorder(appWindow, 0)
    ac.setIconPosition(appWindow, 0, -10000)

    ui_driver_list = ac.addLabel(appWindow, "Track not supported")
    ac.setPosition(ui_driver_list, 3, 30)

    load_track_name()
    load_polygon()
    load_session_type()

    return appName
Esempio n. 22
0
def acMain(ac_version):

	appWindow = ac.newApp("Pedal Circles")
	ac.setSize(appWindow, 412, 250)
	ac.setTitle(appWindow, "")
	# ac.setBackgroundOpacity(appWindow, 0) ~ doesn't change anything
	ac.setIconPosition(appWindow, 0, -10000)
	ac.console("Hello Assetto, this is Pedal Circles")

	brake_display = ac.addLabel(appWindow, "")
	ac.setPosition(brake_display, 3, 25)
	ac.setSize(brake_display, 200, 200)

	gas_display = ac.addLabel(appWindow, "")
	ac.setPosition(gas_display, 207, 25)
	ac.setSize(gas_display, 200, 200) 

	return "brake"
Esempio n. 23
0
def acMain(ac_version):
    global appWindow, flag_textures

    # Initialise app
    appWindow = ac.newApp(APP_NAME)
    ac.setSize(appWindow, WINDOW_WIDTH, WINDOW_HEIGHT)
    ac.setIconPosition(appWindow, 0, -999999)
    ac.setTitle(appWindow, " ")
    ac.drawBorder(appWindow, 0)
    ac.setBackgroundOpacity(appWindow, NO_FLAG_BACKGROUND_OPACITY)
    ac.addRenderCallback(appWindow, onWindowRender)

    # Load flag textures
    flag_textures = {
        flag_value: ac.newTexture(TEXTURE_DIR + flag.texture)
        for flag_value, flag in FLAGS.items()
    }

    return APP_NAME
    def __init__(self, appName):
        self.timer = 0

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

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

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

        self.nameLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.nameLabel, w + 10, 11)
        ac.setFontSize(self.nameLabel, 22)
        ac.setCustomFont(self.nameLabel, FC.FONT_NAME, 0, 0)
        ac.setFontColor(self.nameLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.nameLabel, "left")

        self.lastNameLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.lastNameLabel, w + 10, 37)
        ac.setFontSize(self.lastNameLabel, 28)
        ac.setCustomFont(self.lastNameLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.lastNameLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.lastNameLabel, "left")

        self.timeLabel = ac.addLabel(self.window, "")
        ac.setPosition(self.timeLabel, w + 385, 22)
        ac.setFontSize(self.timeLabel, 35)
        ac.setCustomFont(self.timeLabel, FC.FONT_NAME, 0, 1)
        ac.setFontColor(self.timeLabel, 0.86, 0.86, 0.86, 1)
        ac.setFontAlignment(self.timeLabel, "right")
Esempio n. 25
0
    def __init__(self, app_name, app_title, w, h, bg=Color(0, 0, 0, 0.8)):
        super().__init__(None)
        self._app_name = app_name
        self._app_title = app_title
        self._w = w
        self._h = h
        self._bg = bg
        self._size = (w, h)

        self.app = ac.newApp(app_name)
        self.ac_obj = self.app
        ac.setTitle(self.app, app_title)
        ac.setSize(self.app, w, h)
        ac.setIconPosition(self.app, 100000, 0)
        ac.setTitlePosition(self.app, 100000, 0)
        ac.drawBorder(self.app, 0)
        ac.drawBackground(self.app, (bg.a > 0))
        ac.setBackgroundColor(self.app, bg.r, bg.g, bg.b)
        ac.setBackgroundOpacity(self.app, bg.a)

        self.background_color = bg
Esempio n. 26
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. 27
0
File: nChat.py Progetto: nuggs/nChat
def acMain(ac_version):
    global textInput, appWindow, inputWindow, messages, lines, maxLines
    appWindow = ac.newApp('nChat')
    inputWindow = ac.newApp('nInput')

    ac.setSize(appWindow, 500, 100)
    ac.drawBorder(appWindow, 0)
    ac.setTitle(appWindow, '')
    ac.setIconPosition(appWindow, -9000, 0)
    ac.setBackgroundOpacity(appWindow, 0)

    ac.setSize(inputWindow, 435, 62)
    ac.drawBorder(inputWindow, 0)
    ac.setTitle(inputWindow, '')
    ac.setIconPosition(inputWindow, -9000, 0)
    ac.setBackgroundOpacity(inputWindow, 0)

    textInput = ac.addTextInput(inputWindow, 'TEXT_INPUT')
    ac.setPosition(textInput, 1, 32)
    ac.setSize(textInput, 435, 30)

    ac.addOnChatMessageListener(appWindow, onChatMessage)
    ac.addOnClickedListener(appWindow, onWindowClick)

    ac.addOnValidateListener(textInput, onValidateListener)
    ac.addOnClickedListener(inputWindow, onWindowClick)

    for i in range(0, maxLines):
        lines.append([ac.addLabel(appWindow, ''), ac.addLabel(appWindow, '')])
        for x in range(0, 2):
            ac.setSize(lines[i][x], 14*60, 14)
            ac.setPosition(lines[i][x], 0, i*14+5)
            ac.setFontSize(lines[i][x], 14)

    # Maybe add back in later
    #lines.reverse()

    onChatMessage('Loaded...', 'nChat')
    return "nChat"
Esempio n. 28
0
def acMain(ac_version):
    global appWindow,messageLabel,messageList,s,next,prev,end
    appWindow=ac.newApp(APP_NAME)
    ac.setSize(appWindow,600,160)
    ac.drawBorder(appWindow,0)
    ac.setIconPosition(appWindow, 0, -10000)
    ac.setBackgroundOpacity(appWindow,0)
    s = socket.socket()
    s.connect((HOST.format(PASS).encode("utf-8"), PORT))
    s.send("PASS {}\r\n".format(PASS).encode("utf-8"))
    s.send("NICK {}\r\n".format(NICK).encode("utf-8"))
    s.send("JOIN {}\r\n".format(CHAN).encode("utf-8"))
    s.setblocking(False)
    for i in range(0,7):
        messageLabel.append(ac.addLabel(appWindow,messageList[i]))
        ac.setPosition(messageLabel[i],15,(i*20)+30)
    # input_text = ac.addTextInput(appWindow,"")
    # ac.setPosition(input_text,15,(11*20)+30)
    # ac.setSize(input_text,555,20)
    # ac.addOnValidateListener(input_text,onSendMessage)
    #prevButton = ac.addButton(appWindow,'ᐃ')
    # ac.setSize(prevButton,20,20)
    # ac.setFontSize(prevButton,12)
    # ac.setPosition(prevButton,570,30)
    # ac.addOnClickedListener(prevButton,onClickPrev)
    # nextButton = ac.addButton(appWindow,'ᐁ')
    # ac.setSize(nextButton,20,20)
    # ac.setFontSize(nextButton,12)
    # ac.setPosition(nextButton,570,210)
    # ac.addOnClickedListener(nextButton,onClickNext)
    # endButton = ac.addButton(appWindow,'ꓪ')
    # ac.setSize(endButton,20,20)
    # ac.setFontSize(endButton,12)
    # ac.setPosition(endButton,570,230)
    # ac.addOnClickedListener(endButton,onClickEnd)
    checkTimer()
    displayRefresh()
    ac.console('Twitch app init done')
    return APP_NAME
Esempio n. 29
0
def acMain(ac_version):
    global shadow, label, appWindow
    appWindow = ac.newApp("SimpleSpeedo")
    ac.setSize(appWindow, 120, 60)
    ac.setBackgroundOpacity(appWindow, 0)
    ac.drawBorder(appWindow, 0)
    ac.setIconPosition(appWindow, 0, -9000)
    -ac.setTitlePosition(appWindow, 0, -9000)

    shadow = ac.addLabel(appWindow, "?")
    ac.setFontSize(shadow, 44)
    ac.setPosition(shadow, 61, 1)
    ac.setFontColor(shadow, 0.2, 0.2, 0.2, 0.2)
    ac.setFontAlignment(shadow, "center")

    label = ac.addLabel(appWindow, "?")
    ac.setFontSize(label, 44)
    ac.setPosition(label, 60, 0)
    ac.setFontColor(label, 1, 1, 1, 0.4)
    ac.setFontAlignment(label, "center")

    return "SimpleSpeedo"
Esempio n. 30
0
    def __init__(self, configs: Config):
        """ Default constructor. """
        self.__buttons = {}
        self.__options = {
            "Camber": configs.get_bool_option("Camber"),
            "Dirt": configs.get_bool_option("Dirt"),
            "Height": configs.get_bool_option("Height"),
            "Load": configs.get_bool_option("Load"),
            "Lock": configs.get_bool_option("Lock"),
            "Logging": configs.get_bool_option("Logging"),
            "Pressure": configs.get_bool_option("Pressure"),
            "RPMPower": configs.get_bool_option("RPMPower"),
            "Size": configs.get_option("Size"),
            "Suspension": configs.get_bool_option("Suspension"),
            "Temps": configs.get_bool_option("Temps"),
            "Tire": configs.get_bool_option("Tire"),
            "Wear": configs.get_bool_option("Wear")
        }

        self.__window_id = ac.newApp("Live Telemetry")
        ac.setIconPosition(self.__window_id, 0, -10000)
        title = "Live Telemetry {}".format(configs.get_version())
        ac.setTitle(self.__window_id, title)

        position = configs.get_window_position("OP")
        ac.setPosition(self.__window_id, *position)

        ac.setSize(self.__window_id, 395, 195)

        for index, name in enumerate(sorted(self.__options.keys())):
            text = str(name) if name != "Size" else self.__options[name]
            self.__buttons[name] = ac.addButton(self.__window_id, text)
            x = 30 + (floor(index / 4) * 85)
            y = 30 + (floor(index % 4) * 35)
            ac.setPosition(self.__buttons[name], x, y)
            ac.setSize(self.__buttons[name], 80, 30)
            ac.setFontAlignment(self.__buttons[name], "center")
            self.set_option(name, self.__options[name])
def acMain(ac_version):
    global ui_flag, flag, appWindow, font_size

    width = 8 * font_size
    height = 2 * font_size

    appName = "Better Flags"
    appWindow = ac.newApp(appName)
    ac.setTitle(appWindow, "")
    ac.setSize(appWindow, int(width), int(height))
    ac.drawBorder(appWindow, 0)
    ac.setBackgroundOpacity(appWindow, 0)
    ac.setIconPosition(appWindow, 0, -10000)

    ui_flag = ac.addLabel(appWindow, "")
    ac.setCustomFont(ui_flag, "Roboto", 0, 1)
    ac.setFontAlignment(ui_flag, "center")
    ac.setPosition(ui_flag, int(width / 2),
                   (int(height / 2) - int(font_size / 2)))
    ac.setFontSize(ui_flag, int(font_size))
    ac.setText(ui_flag, "")

    return appName
def acMain(ac_version):
    # VARIABLES
    global totalDrivers
    global drivers

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

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

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

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

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

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

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

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

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

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

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

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

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

    return FC.APP_NAME
def acMain(ac_version):
	global imperial, debug_mode, window_x_pos, window_y_pos, tyre_mon_xpos, tyre_mon_ypos
	global gear_color, gear_background, speed_color, speed_background, throttle_gauge_color, brake_gauge_color, clutch_gauge_color, boost_bar_color, fuel_bar_color
	global draw_digital_speedo, draw_shift_light, draw_gear_indicator, draw_speedometer, draw_tachometer, draw_odometer, draw_g_meter, draw_boost_gauge
	global draw_fuel_gauge, draw_throttle_gauge, draw_brake_gauge, draw_clutch_gauge, draw_tyre_monitor, draw_background
	global tach_needle_end, speedo_needle_end, tach_radius, speedo_radius, rpm_pivot_y, speed_pivot_y, rpm_pivot_x, speed_pivot_x, speedo_tl_x, speedo_tl_y
	global speedo_total_width, speedo_total_height
	global tach_redline_color, tach_bigline_color, tach_smallline_color, tach_needle_color1
	global speedo_bigline_color, speedo_smallline_color, speedo_needle_color1
	global throttle_gauge_inner_radius, throttle_gauge_outer_radius, throttle_gauge_min_y, throttle_gauge_max_y
	global brake_gauge_inner_radius, brake_gauge_outer_radius, brake_gauge_min_y, brake_gauge_max_y
	global clutch_gauge_inner_radius, clutch_gauge_outer_radius, clutch_gauge_min_y, clutch_gauge_max_y
	global throttle_gauge_root_x, throttle_gauge_root_y
	global brake_gauge_root_x, brake_gauge_root_y
	global clutch_gauge_root_x, clutch_gauge_root_y
	global throttle_gauge_right, brake_gauge_right, clutch_gauge_right
	global boost_radius, fuel_radius, boost_pivot_y, fuel_pivot_y, boost_pivot_x, fuel_pivot_x, boost_needle_end, fuel_needle_end, boost_needle_color, fuel_needle_color
	global odometer_fg, odometer_bg, g_meter_range, g_meter_x_anchor, g_meter_y_anchor, g_meter_opacity, window_width, window_height, background_image_path, background_image_path_noboost
	global tyre_monitor_opacity, g_meter_opacity
	global window, debug_label, indicated_max_rpm
	global flt_label1, frt_label1, rlt_label1, rrt_label1
	global flt_label2, frt_label2, rlt_label2, rrt_label2
	global fuel_warning_label
	global config
	global telemetry_client
	global draw_abs_status, draw_tcs_status, abs_label, abs_off_label, tcs_label, tcs_off_label
	global gear_x, gear_y, shift_light_x, shift_light_y, shift_light_radius, gear_width, gear_height
	global tach_min_angle, tach_max_angle, speedo_min_angle, speedo_max_angle
	global shift_light_on_color, shift_light_off_color
	global rpms_file
	config_file = configparser.ConfigParser()
	config_file.read('apps/python/AnalogInstruments/settings.ini')
	config = config_file[config_file['settings']['theme']]
	rpms_file = configparser.ConfigParser()
	rpms_file.read('apps/python/AnalogInstruments/rpms.ini')

	# SETTINGS #

	# Change this to 'True' to have speed measured in MPH
	imperial = config.getboolean('imperial')
	# Debug mode (basically just some numbers)
	debug_mode = config.getboolean('debug_mode')
	# Main window positions, change those if you're not using a single monitor 1080p setup
	window_x_pos  = int(config['window_x_pos'])# (Your horz. res-1320)/2
	window_y_pos  = int(config['window_y_pos']) # Your vert. res - 250
	# These are relative to the window's position
	tyre_mon_xpos = int(config['tyre_mon_x_pos'])# 20 px from the left on single mon 1080p
	tyre_mon_ypos = int(config['tyre_mon_y_pos'])# 920 px from the top
	# Color settings
	gear_color           = parse_color(config['gear_color'])
	gear_background      = parse_color(config['gear_background'])
	speed_color          = parse_color(config['digi_speedo_color'])
	speed_background     = parse_color(config['digi_speedo_background'])
	throttle_gauge_color = parse_color(config['throttle_gauge_color'])
	brake_gauge_color    = parse_color(config['brake_gauge_color'])
	clutch_gauge_color   = parse_color(config['clutch_gauge_color'])
	boost_bar_color      = parse_color(config['boost_bar_color']) 
	fuel_bar_color       = parse_color(config['fuel_bar_color'])
	shift_light_on_color = parse_color(config['shift_light_on_color'])
	shift_light_off_color = parse_color(config['shift_light_off_color'])
	# Some more settings, hopefully pretty self-explanatory
	draw_digital_speedo = config.getboolean('draw_digital_speedo')
	draw_shift_light    = config.getboolean('draw_shift_light')
	draw_gear_indicator = config.getboolean('draw_gear_indicator')
	draw_speedometer    = config.getboolean('draw_speedometer')
	draw_tachometer     = config.getboolean('draw_tachometer')
	draw_odometer       = config.getboolean('draw_odometer')
	draw_g_meter        = config.getboolean('draw_g_meter')
	draw_boost_gauge    = config.getboolean('draw_boost_gauge')
	draw_fuel_gauge     = config.getboolean('draw_fuel_gauge')
	draw_throttle_gauge = config.getboolean('draw_throttle_gauge')
	draw_brake_gauge    = config.getboolean('draw_brake_gauge')
	draw_clutch_gauge   = config.getboolean('draw_clutch_gauge')
	draw_tyre_monitor   = config.getboolean('draw_tyre_monitor')
	draw_background     = config.getboolean('draw_background')
	draw_abs_status     = config.getboolean('draw_abs_status')
	draw_tcs_status     = config.getboolean('draw_tcs_status')

	# Dimensions of things, mess with those at your own risk
	tach_needle_end     = int(config['tach_needle_end'])
	speedo_needle_end   = int(config['speedo_needle_end'])
	tach_radius         = int(config['tach_radius'])
	speedo_radius       = int(config['speedo_radius'])
	rpm_pivot_y         = int(config['tach_y_anchor'])
	speed_pivot_y       = int(config['speedo_y_anchor'])
	rpm_pivot_x         = int(config['tach_x_anchor'])
	speed_pivot_x       = int(config['speedo_x_anchor'])
	speedo_tl_x         = int(config['digi_speedo_x'])
	speedo_tl_y         = int(config['digi_speedo_y'])
	speedo_total_width  = int(config['digi_speedo_width'])
	speedo_total_height = int(config['digi_speedo_height'])
	tach_min_angle      = int(config['tach_min_angle'])
	tach_max_angle      = int(config['tach_max_angle'])
	speedo_min_angle    = int(config['speedo_min_angle'])
	speedo_max_angle    = int(config['speedo_max_angle'])

	tach_redline_color = parse_color(config['tach_redline_color'])
	tach_bigline_color = parse_color(config['tach_bigline_color'])
	tach_smallline_color = parse_color(config['tach_smallline_color'])
	tach_needle_color1 = parse_color(config['tach_needle_color1'])

	speedo_bigline_color = parse_color(config['speedo_bigline_color'])
	speedo_smallline_color = parse_color(config['speedo_smallline_color'])
	speedo_needle_color1 = parse_color(config['speedo_needle_color1'])

	# G-Meter: 500-820
	# Brake/Throttle Max Y: 70 Min: 160
	throttle_gauge_inner_radius = int(config['throttle_gauge_inner_radius'])
	throttle_gauge_outer_radius = int(config['throttle_gauge_outer_radius'])
	throttle_gauge_min_y        = int(config['throttle_gauge_min_y'])
	throttle_gauge_max_y        = int(config['throttle_gauge_max_y'])
	throttle_gauge_root_x       = int(config['throttle_gauge_root_x'])
	throttle_gauge_root_y       = int(config['throttle_gauge_root_y'])
	throttle_gauge_right        = config.getboolean('throttle_gauge_right')
	
	brake_gauge_inner_radius = int(config['brake_gauge_inner_radius'])
	brake_gauge_outer_radius = int(config['brake_gauge_outer_radius'])
	brake_gauge_min_y        = int(config['brake_gauge_min_y'])
	brake_gauge_max_y        = int(config['brake_gauge_max_y'])
	brake_gauge_root_x       = int(config['brake_gauge_root_x'])
	brake_gauge_root_y       = int(config['brake_gauge_root_y'])
	brake_gauge_right        = config.getboolean('brake_gauge_right')
	
	clutch_gauge_inner_radius = int(config['clutch_gauge_inner_radius'])
	clutch_gauge_outer_radius = int(config['clutch_gauge_outer_radius'])
	clutch_gauge_min_y        = int(config['clutch_gauge_min_y'])
	clutch_gauge_max_y        = int(config['clutch_gauge_max_y'])
	clutch_gauge_root_x       = int(config['clutch_gauge_root_x'])
	clutch_gauge_root_y       = int(config['clutch_gauge_root_y'])
	clutch_gauge_right        = config.getboolean('clutch_gauge_right')


	boost_radius     = int(config['boost_radius'])
	fuel_radius      = int(config['fuel_radius'])
	boost_pivot_y    = int(config['boost_y_anchor'])
	fuel_pivot_y     = int(config['fuel_y_anchor'])
	boost_pivot_x    = int(config['boost_x_anchor'])
	fuel_pivot_x     = int(config['fuel_x_anchor'])
	boost_needle_end = int(config['boost_needle_end'])
	fuel_needle_end  = int(config['fuel_needle_end'])
	boost_needle_color = parse_color(config['boost_needle_color'])
	fuel_needle_color = parse_color(config['fuel_needle_color'])


	odometer_fg = parse_color(config['odometer_foreground'])
	odometer_bg = parse_color(config['odometer_background'])

	tyre_monitor_opacity = float(config['tyre_monitor_opacity'])

	g_meter_range = int(config['g_meter_range'])
	g_meter_x_anchor = int(config['g_meter_x_anchor'])
	g_meter_y_anchor = int(config['g_meter_y_anchor'])
	g_meter_opacity = float(config['g_meter_opacity'])
	
	gear_x = int(config['gear_x'])
	gear_y = int(config['gear_y'])
	gear_width = int(config['gear_width'])
	gear_height = int(config['gear_height'])
	shift_light_x = int(config['shift_light_x'])
	shift_light_y = int(config['shift_light_y'])
	shift_light_radius = int(config['shift_light_radius'])

	# Kind of configurable but you'll have change most of the dimensions above so not recommended
	window_width  = int(config['window_width'])
	window_height = int(config['window_height'])
	background_image_path = config['background_path']
	background_image_path_noboost = config['background_noboost_path']
	abs_img = config['abs_img']
	abs_off_img = config['abs_off_img']
	tcs_img = config['tcs_img']
	tcs_off_img = config['tcs_off_img']
	window = ac.newApp("AnalogInstruments")
	ac.setTitle(window," ")
	ac.setBackgroundOpacity(window,0)
	ac.drawBorder(window,0)
	ac.setIconPosition(window,0,-10000)
	if draw_background:
		ac.drawBackground(window,1)
		ac.setBackgroundTexture(window,background_image_path)
	ac.setSize(window,window_width,window_height)
	ac.setPosition(window,window_x_pos,window_y_pos)
	debug_label = ac.addLabel(window,"")
	ac.setPosition(debug_label,20,window_height/10*9)
	ac.addRenderCallback(window,onWindowRender)
	# Setting up the tyre monitor labels (this can be done here because it doesn't depend on any car info)
	if draw_tyre_monitor:
		flt_label1 = ac.addLabel(window," ")
		ac.setPosition(flt_label1,tyre_mon_xpos+37,tyre_mon_ypos+5)
		flt_label2 = ac.addLabel(window," ")
		ac.setPosition(flt_label2,tyre_mon_xpos+37,tyre_mon_ypos+37)
		frt_label1 = ac.addLabel(window," ")
		ac.setPosition(frt_label1,tyre_mon_xpos+117,tyre_mon_ypos+5)
		frt_label2 = ac.addLabel(window," ")
		ac.setPosition(frt_label2,tyre_mon_xpos+117,tyre_mon_ypos+37)
		rlt_label1 = ac.addLabel(window," ")
		ac.setPosition(rlt_label1,tyre_mon_xpos+37,tyre_mon_ypos+101)
		rlt_label2 = ac.addLabel(window," ")
		ac.setPosition(rlt_label2,tyre_mon_xpos+37,tyre_mon_ypos+133)
		rrt_label1 = ac.addLabel(window," ")
		ac.setPosition(rrt_label1,tyre_mon_xpos+117,tyre_mon_ypos+101)
		rrt_label2 = ac.addLabel(window," ")
		ac.setPosition(rrt_label2,tyre_mon_xpos+117,tyre_mon_ypos+133)
	if draw_fuel_gauge:
		fuel_warning_label = ac.addLabel(window,"")
		ac.setSize(fuel_warning_label,12,14)
		ac.setPosition(fuel_warning_label,fuel_pivot_x - 6,fuel_pivot_y - 30)
		ac.setBackgroundTexture(fuel_warning_label,fuel_icon_warning_path)
	if draw_abs_status:
		abs_label = ac.addLabel(window,"")
		ac.setSize(abs_label,window_width,window_height)
		ac.setPosition(abs_label,0,0)
		ac.setBackgroundTexture(abs_label,abs_img)
		abs_off_label = ac.addLabel(window,"")
		ac.setSize(abs_off_label,window_width,window_height)
		ac.setPosition(abs_off_label,0,0)
		ac.setBackgroundTexture(abs_off_label,abs_off_img)
	if draw_tcs_status:
		tcs_label = ac.addLabel(window,"")
		ac.setSize(tcs_label,window_width,window_height)
		ac.setPosition(tcs_label,0,0)
		ac.setBackgroundTexture(tcs_label,tcs_img)
		tcs_off_label = ac.addLabel(window,"")
		ac.setSize(tcs_off_label,window_width,window_height)
		ac.setPosition(tcs_off_label,0,0)
		ac.setBackgroundTexture(tcs_off_label,tcs_off_img)
	return "Analog Instruments"
Esempio n. 34
0
    def __init__(self, appName):
        self.id = -1
        self.visible = True
        self.extended = False
        self.position = -1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        ac.setVisible(self.extendedBackgroundTexture, 0)
        ac.setVisible(self.startedLabel, 0)
        ac.setVisible(self.startedTextLabel, 0)
        ac.setVisible(self.placesLabel, 0)
        ac.setVisible(self.placesTextLabel, 0)
        ac.setVisible(self.placesIconLabel, 0)
        ac.setVisible(self.tyreTextLabel, 0)
        ac.setVisible(self.tyreLabel, 0)
        ac.setVisible(self.pitStopTextLabel, 0)
        ac.setVisible(self.pitStopLabel, 0)
Esempio n. 35
0
    def icon_pos(self, icon_pos: tuple):
        self._icon_pos = icon_pos

        if self.has_id and len(icon_pos) == 2:
            ac.setIconPosition(self.id, icon_pos[0], icon_pos[1])
Esempio n. 36
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. 37
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()
Esempio n. 38
0
    def hideDecoration(self):
        if self._ac_obj is not None:
            ac.setTitlePosition(self._ac_obj, 0, -10000)
            ac.setIconPosition(self._ac_obj, 0, -10000)

        return self
Esempio n. 39
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. 40
0
    def icon_position(self, icon_position):
        self._icon_position = icon_position

        if self._ac_obj is not None:
            ac.setIconPosition(self._ac_obj, 0, -10000)