def acMain(ac_version): global TYREINFO, optimal_spinner_id, optimal_spinner_shown appWindow = ac.newApp("Tyre Temperatures") ac.drawBackground(appWindow, background) ac.drawBorder(appWindow, background) ac.setBackgroundOpacity(appWindow, background) ac.setSize(appWindow, x_app_size, y_app_size) TYREINFO = Tyre_Info(appWindow, x_start, y_start) ac.addRenderCallback(appWindow, onFormRender) TYREINFO.optimal_temp = d_optimal_temp TYREINFO.carinifilepath = inidir + getValidFileName(ac.getCarName(0)) + ".ini" TYREINFO.needwriteini = 1 if os.path.exists(TYREINFO.carinifilepath): f = open(TYREINFO.carinifilepath, "r") TYREINFO.optimal_temp = int(f.readline()[8:]) f.close() TYREINFO.needwriteini = 0 optimal_spinner_id = ac.addSpinner(appWindow, "optimal") ac.setPosition(optimal_spinner_id, 0, y_app_size + 28) ac.setStep(optimal_spinner_id, 1) if inFahrenheit: ac.setRange(optimal_spinner_id, int(CelsiusToFahrenheit(50)), int(CelsiusToFahrenheit(150))) ac.setValue(optimal_spinner_id, int(CelsiusToFahrenheit(TYREINFO.optimal_temp))) else: ac.setRange(optimal_spinner_id, 50, 150) ac.setValue(optimal_spinner_id, TYREINFO.optimal_temp) ac.addOnValueChangeListener(optimal_spinner_id, onValueChanged) optimal_spinner_shown = 1 ac.log("Danny Giusa Tyre Temperatures loaded") return "Danny Giusa Tyre Temperatures"
def setup(self): ac.addRenderCallback(self.appWindow, onRender) ac.setSize(self.appWindow,333,424) ac.drawBorder(self.appWindow,0) ac.drawBackground(self.appWindow, 0) for el in self.uiElements: el.setup() self.setupButtons()
def setup(self): ac.setSize(self.appWindow,270, 30 + 30*(otherCyclistsMaxCount+1)) ac.drawBorder(self.appWindow,0) ac.drawBackground(self.appWindow, 0) for uiElements in self.uiElements: for uiElementsPerCyclist in uiElements: uiElementsPerCyclist.setup() self.draftPercentage.setup()
def setHighlight(item): global uihighlight # dehighlight the old one ac.setBackgroundColor(uihighlight, 0.5, 0.5, 0.5) ac.drawBackground(uihighlight, 0) # set the new one uihighlight = item ac.setBackgroundColor(uihighlight, 1, 0, 0) ac.drawBackground(uihighlight, 1)
def setup(self): # ac.addRenderCallback(self.appWindow, onRender) ac.setSize(self.appWindow,800,100) ac.drawBorder(self.appWindow,0) ac.drawBackground(self.appWindow, 0) for el in self.uiElements: el.setup() ac.setPosition(self.graph, 0, 100) ac.setSize(self.graph,800,100) ac.setRange(self.graph, 0.0, 600, 2000)
def acMain(ac_version): global fuelUsage appWindow = ac.newApp("Fuel Usage") ac.drawBackground(appWindow, background) ac.drawBorder(appWindow, background) ac.setBackgroundOpacity(appWindow, background) ac.setSize(appWindow, x_app_size, y_app_size) fuelUsage = Fuel_Usage(appWindow, x_start, y_start) ac.addRenderCallback(appWindow, onFormRender) ac.log("Fuel Usage App loaded") return "Fuel Usage App"
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()
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
def acMain(ac_version): global TYREINFO, optimal_spinner_id, optimal_spinner_shown appWindow = ac.newApp("Tyre Temperatures") ac.drawBackground(appWindow, background) ac.drawBorder(appWindow, background) ac.setBackgroundOpacity(appWindow, background) ac.setSize(appWindow, x_app_size, y_app_size) TYREINFO = Tyre_Info(appWindow, x_start, y_start) ac.addRenderCallback(appWindow, onFormRender) TYREINFO.optimal_temp = d_optimal_temp TYREINFO.carinifilepath = inidir + getValidFileName( ac.getCarName(0)) + ".ini" TYREINFO.needwriteini = 1 if os.path.exists(TYREINFO.carinifilepath): f = open(TYREINFO.carinifilepath, "r") TYREINFO.optimal_temp = int(f.readline()[8:]) f.close() TYREINFO.needwriteini = 0 optimal_spinner_id = ac.addSpinner(appWindow, "optimal") ac.setPosition(optimal_spinner_id, 0, y_app_size + 28) ac.setStep(optimal_spinner_id, 1) if inFahrenheit: ac.setRange(optimal_spinner_id, int(CelsiusToFahrenheit(50)), int(CelsiusToFahrenheit(150))) ac.setValue(optimal_spinner_id, int(CelsiusToFahrenheit(TYREINFO.optimal_temp))) else: ac.setRange(optimal_spinner_id, 50, 150) ac.setValue(optimal_spinner_id, TYREINFO.optimal_temp) ac.addOnValueChangeListener(optimal_spinner_id, onValueChanged) optimal_spinner_shown = 1 ac.log("Danny Giusa Tyre Temperatures loaded") return "Danny Giusa Tyre Temperatures"
def background(self, background: bool): self._background = background if self.has_id: ac.drawBackground(self.id, 1 if background else 0)
def background(self, background): self._background = background if self._ac_obj is not None: ac.drawBackground(self._ac_obj, self._background)
def acMain(ac_version): global app, label, stepBackButton, resetButton, sVer global vaoToggleButton, vaoDebugButton, lightsDebugButton, copyCameraCoordsButton global doorToggleButton, driverToggleButton try: app = ac.newApp("Shaders Patch Debug") ac.setTitle(app, " Shaders Patch Debug") ac.setSize(app, 180, 358) ac.drawBackground(app, 0) driverToggleButton = ac.addButton(app, "Driver") ac.setPosition(driverToggleButton, 20, 25) ac.setSize(driverToggleButton, 40, 20) ac.setFontSize(driverToggleButton, 12) ac.addOnClickedListener(driverToggleButton, driverToggle) doorToggleButton = ac.addButton(app, "🚪") ac.setPosition(doorToggleButton, 70, 25) ac.setCustomFont(doorToggleButton, "Segoe UI Symbol; Weight=UltraLight", 0, 0) ac.setSize(doorToggleButton, 40, 20) ac.setFontSize(doorToggleButton, 14) ac.addOnClickedListener(doorToggleButton, doorToggle) copyCameraCoordsButton = ac.addButton(app, "Copy") ac.setPosition(copyCameraCoordsButton, 120, 25) ac.setSize(copyCameraCoordsButton, 40, 20) ac.setFontSize(copyCameraCoordsButton, 12) ac.addOnClickedListener(copyCameraCoordsButton, copyCameraCoords) vaoToggleButton = ac.addButton(app, "V +/−") ac.setPosition(vaoToggleButton, 20, 45) ac.setSize(vaoToggleButton, 40, 20) ac.setFontSize(vaoToggleButton, 12) ac.addOnClickedListener(vaoToggleButton, vaoToggle) vaoDebugButton = ac.addButton(app, "V o/N") ac.setPosition(vaoDebugButton, 70, 45) ac.setSize(vaoDebugButton, 40, 20) ac.setFontSize(vaoDebugButton, 12) ac.addOnClickedListener(vaoDebugButton, vaoDebug) lightsDebugButton = ac.addButton(app, "🔦") ac.setPosition(lightsDebugButton, 120, 45) ac.setSize(lightsDebugButton, 40, 20) ac.setFontSize(lightsDebugButton, 14) ac.addOnClickedListener(lightsDebugButton, lightsDebug) stepBackButton = ac.addButton(app, "Step back") ac.setPosition(stepBackButton, 20, 65) ac.setSize(stepBackButton, 140, 20) ac.setFontSize(stepBackButton, 12) ac.addOnClickedListener(stepBackButton, takeAStepBack) ac.setCustomFont(stepBackButton, "Segoe UI; Weight=UltraBlack", 0, 0) resetButton = ac.addButton(app, "Reset") ac.setPosition(resetButton, 20, 85) ac.setSize(resetButton, 140, 20) ac.setFontSize(resetButton, 12) ac.addOnClickedListener(resetButton, resetCar) ac.setCustomFont(resetButton, "Segoe UI; Weight=UltraBlack", 0, 0) label = ac.addLabel(app, "") ac.setFontSize(label, 12) ac.setPosition(label, 5, 103) sVer = "CSP v" + str(ac.ext_patchVersion()) + "-code" + str( ac.ext_patchVersionCode()) # i = 0 # while i < 1200: # labelTemp = ac.setPosition(ac.addLabel(app, "Label #" + str(i)), 5, 30 + i) # ac.setFontSize(labelTemp, 14 + (i % 10)) # i += 1 except: ac.log("Unexpected error:" + traceback.format_exc()) return "AccExtHelper"
def acMain(ac_version): global 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"
def draw_bg(self, value): self._draw_bg = value ac.drawBackground(self.id, value)
def changeElementBgColor(element, Bgr, Bgb, Bgg): ac.setBackgroundColor(element, Bgr, Bgb, Bgg) ac.setBackgroundOpacity(element, 1) ac.drawBackground(element, 1)