def acMain(ac_version): global appWindow, label1, logPrefix, appName, splitsRenderer ac.console(logPrefix + "acMain") try: appWindow = ac.newApp(appName) ac.setTitle(appWindow, "") ac.setSize(appWindow, 300, 300) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0.3) resetBtn = ac.addButton(appWindow, "R") ac.setPosition(resetBtn, 5, 30) ac.setSize(resetBtn, 30, 30) ac.addOnClickedListener(resetBtn, onResetClicked) newSplitBtn = ac.addButton(appWindow, "N") ac.setPosition(newSplitBtn, 40, 30) ac.setSize(newSplitBtn, 30, 30) ac.addOnClickedListener(newSplitBtn, onNewSplitClicked) #label1 = ac.addLabel(appWindow, "____") #ac.setPosition(label1, 0, 70) splitsRenderer = SplitsRenderer(2, 62, 10, 10) ac.addRenderCallback(appWindow, onRender) ac.addOnAppActivatedListener(appWindow, onActivate) ac.addOnAppDismissedListener(appWindow, onDismiss) ac.console(logPrefix + "Initialized") except: printExceptionInfo("acMain") return appName
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 = []
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 __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"))
def acMain(ac_version): global appWindow, label1, logPrefix, appName, cfg, ui_enableButton ac.console(logPrefix + "acMain") try: appWindow = ac.newApp(appName) cfg = Configuration() cfg.load() ac.setTitle(appWindow, "") ac.setSize(appWindow, 400, 200) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0) ac.addRenderCallback(appWindow, onRender) ui_enableButton = ac.addButton(appWindow, "Enable") ac.setPosition(ui_enableButton, 0, 30) ac.setSize(ui_enableButton, 70, 30) ac.addOnClickedListener(ui_enableButton, onEnableButtonClicked) label1 = ac.addLabel(appWindow, "____") ac.setPosition(label1, 0, 65) if cfg.enable > 0: ac.setText(ui_enableButton, "Disable") startTelemetry() ac.console(logPrefix + "Initialized") except: printExceptionInfo("acMain") return appName
def acMain(ac_version): #app window init; global variables for later updating go here global appWindow appWindow = ac.newApp(appName) ac.setTitle(appWindow, appName) ac.setSize(appWindow, width, height) ac.log("z3D Gauge loaded") ac.console("z3D Gauge console test") ####################################################declaring gauge elements # gonna need new textures like # rpm_bar = ac.newTexture(app_path + theme_path + "rpm_bar.png") global l_kmph, l_rpm, l_gear, acceleration global ascii_RPM l_kmph = ac.addLabel(appWindow, "KMPH") l_rpm = ac.addLabel(appWindow, "RPM") l_gear = ac.addLabel(appWindow, "Current gear") ascii_RPM = ac.addLabel(appWindow, "") acceleration = ac.addLabel(appWindow, "") #l_TC = ac.addLabel(appWindow, "TC on/off") #non-functional #l_ABS = ac.addLabel(appWindow, "ABS on/off") #non-functional ac.setPosition(l_kmph, 3, 30) ac.setPosition(l_rpm, 3, 60) ac.setPosition(l_gear, 3, 80) ac.setPosition(ascii_RPM, 3, 160) ac.setPosition(acceleration, 3, 580) ac.addRenderCallback(appWindow, appGL) # -> links this app's window to an OpenGL render function return appName
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))
def acMain(ac_version): global DRIVER, TRACK, CAR, WINDOW, LAP_LABELS, LAP_VALID_INDICATOR DRIVER = ac.getDriverName(DRIVER_ID_SELF) TRACK = '%s-%s' % (ac.getTrackName(DRIVER_ID_SELF), ac.getTrackConfiguration(DRIVER_ID_SELF)) CAR = ac.getCarName(DRIVER_ID_SELF) ac.console('Initialize %s: driver %s on %s in %s' % (NAME, DRIVER, TRACK, CAR)) WINDOW = ac.newApp(NAME) ac.setSize(WINDOW, *SIZE) ac.setTitle(NAME) if ac.addOnAppActivatedListener(WINDOW, onActivate) == -1: ac.console('Failed to add listener activate') if ac.addOnAppDismissedListener(WINDOW, onDeactivate) == -1: ac.console('Failed to add listener deactivate') i = 0 while i < LAP_COUNT: label = ac.addLabel(WINDOW, 'Waiting for lap time...') LAP_LABELS.append(label) i += 1 LAP_VALID_INDICATOR = ac.addLabel(WINDOW, 'Clean') refreshLapDisplay() return NAME
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 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(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)
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 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 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
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)
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
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"
def acMain(ac_version): global label1 appWindow = ac.newApp("Time") ac.setTitle(appWindow, '') ac.setSize(appWindow, 180, 30) ac.setPosition(appWindow, 1500, 50) label1 = ac.addLabel(appWindow, "") ac.setPosition(label1, 60, 5) return "Time"
def acMain(ac_version): global rpm_display, boost_display, gear_display, speed_display, fuel_display global min_rpm_spinner_Label, min_rpm_spinner, max_rpm_spinner_Label, max_rpm_spinner, settings_box_Label global units_spinner_Label, units_spinner global rpm_tag, speed_tag, boost_tag, fuel_tag appWindow = ac.newApp("RevHunterSkunkworks") ac.setTitle(appWindow, " ") ac.setSize(appWindow, windowx, windowy) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0) ac.addRenderCallback(appWindow, onFormRender) rpm_display = Label(appWindow, "").setSize(0, 0).setPosition( (2.05 * windowx / 3), (1.05 * windowy / 3)).setFontSize(50).setFontAlign("right") gear_display = Label(appWindow).setSize(0, 0).setPosition( (windowx / 2), -50).setFontSize(140).setFontAlign("center") speed_display = Label(appWindow, "").setSize(0, 0).setPosition( (1.25 * windowx / 3), (1.05 * windowy / 3)).setFontSize(50).setFontAlign("right") fuel_display = Label(appWindow, "").setSize(0, 0).setPosition( (0.8 * windowx / 3), (1.25 * windowy / 3)).setFontSize(35).setFontAlign("right") settings_box_Label = Label(appWindow, "").setSize(0, 0).setPosition( 940, 83).setFontSize(15).setFontAlign("left") rpm_tag = Label(appWindow, "").setText("RPM").setSize(0, 0).setPosition( (2.06 * windowx / 3), (2.1 * windowy / 3)).setFontSize(15).setFontAlign("left") speed_tag = Label(appWindow, "").setText("MPH").setSize(0, 0).setPosition( (1.26 * windowx / 3), (2.1 * windowy / 3)).setFontSize(15).setFontAlign("left") fuel_tag = Label(appWindow, "").setText("%FUEL").setSize(0, 0).setPosition( (0.81 * windowx / 3), (1.9 * windowy / 3)).setFontSize(15).setFontAlign("left") min_rpm_spinner = ac.addSpinner(appWindow, "Min %RPM") spinnerConfig(min_rpm_spinner, 0, 125, 80, 20, 0, 1, 100, 80, setMinRPM, 0) max_rpm_spinner = ac.addSpinner(appWindow, "Max %RPM") spinnerConfig(max_rpm_spinner, 100, 125, 80, 20, 90, 1, 100, 97, setMaxRPM, 0) units_spinner = ac.addSpinner(appWindow, "Units") spinnerConfig(units_spinner, 200, 125, 80, 20, 1, 1, 2, 1, setUnits, 0) settings_box = ac.addCheckBox(appWindow, "") ac.setPosition(settings_box, 950, 95) ac.setSize(settings_box, 10, 10) ac.addOnCheckBoxChanged(settings_box, toggle_settings_visiblity) return "RevHunterSkunkworks"
def acMain(ac_version): global appWindow, timeLabel appWindow=ac.newApp("Time") ac.setTitle(appWindow,"Time") ac.setSize(appWindow,160,60) ac.drawBorder(appWindow,0) ac.setBackgroundOpacity(appWindow,0) theTime=datetime.now() timeLabel=ac.addLabel(appWindow, "{}".format(theTime.strftime("%H:%M"))) ac.setPosition(timeLabel,70,30) ac.addRenderCallback(appWindow , onFormRender) return "Time"
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()))
def acMain(ac_version): #----------------------------- App window Init # Don't forget to put anything you'll need to update later as a global variables global appWindow # <- you'll need to update your window in other functions. appWindow = ac.newApp(appName) ac.setTitle(appWindow, appName) ac.setSize(appWindow, width, height) ac.addRenderCallback( appWindow, appGL) # -> links this app's window to an OpenGL render function return appName
def acMain(ac_version): global appWindow, sAppError appWindow = ac.newApp("InvalidateLap") ac.setTitle(appWindow, "InvalidateLap") ac.setSize(appWindow, 200, 25) sAppError = '' try: sVerCode = ac.ext_patchVersionCode() if int(sVerCode) <= 893: # version code for v0.1.36 sAppError = str( ac.ext_patchVersion()) + ' CustomShadersPatch too old ' except: sAppError = 'CustomShadersPatch not enabled or installed.' return "InvalidateLap"
def acMain(ac_version): global appWindow, sharedMem appWindow = ac.newApp("SimulatorController") ac.setTitle(appWindow, "SimulatorController") ac.setSize(appWindow, 300, 40) sharedmem = sharedMem.getsharedmem() sharedmem.serverName = ac.getServerName().encode('utf-8') sharedmem.acInstallPath = os.path.abspath(os.curdir).encode('utf-8') sharedmem.isInternalMemoryModuleLoaded = libInit sharedmem.pluginVersion = pluginVersion.encode('utf-8') return "SimulatorController"
def acMain(ac_version): global appWindow,sharedMem appWindow = ac.newApp("CrewChiefEx") ac.setTitle(appWindow, "CrewChiefEx") ac.setSize(appWindow, 300, 40) ac.log("CrewChief Was Here! damage report ?") ac.console("CrewChief Was Here! damage report ?") sharedmem = sharedMem.getsharedmem() sharedmem.serverName = ac.getServerName().encode('utf-8') return "CrewChiefEx"
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 acMain(ac_version): global appWindow, sharedMem appWindow = ac.newApp("SecondMonitorEx") ac.setTitle(appWindow, "SecondMonitorEx") ac.setSize(appWindow, 300, 40) ac.log("SecondMonitor Shared memory Initialized") ac.console("SecondMonitor Shared memory Initialized") sharedmem = sharedMem.getsharedmem() sharedmem.serverName = ac.getServerName().encode('utf-8') sharedmem.acInstallPath = os.path.abspath(os.curdir).encode('utf-8') sharedmem.pluginVersion = pluginVersion.encode('utf-8') return "SecondMonitorEx"
def acMain(ac_version): global appWindow, last_calculated, last_posted, turn_gen appWindow = ac.newApp(appName) ac.setTitle(appWindow, appName) ac.setSize(appWindow, WIDTH, HEIGHT) last_calculated = time.clock() last_posted = time.clock() create_ui_components() ac.sendChatMessage("/admin {}".format(ADMIN_PW)) turn_gen = msg_turn_generator(NCARS) return appName
def acMain(ac_version): global appWindow, sharedMem appWindow = ac.newApp("CrewChiefEx") ac.setTitle(appWindow, "CrewChiefEx") ac.setSize(appWindow, 300, 40) ac.log("CrewChief Was Here! damage report ?") ac.console("CrewChief Was Here! damage report ?") sharedmem = sharedMem.getsharedmem() sharedmem.serverName = ac.getServerName().encode('utf-8') sharedmem.acInstallPath = os.path.abspath(os.curdir).encode('utf-8') sharedmem.isInternalMemoryModuleLoaded = libInit sharedmem.pluginVersion = pluginVersion.encode('utf-8') return "CrewChiefEx"
def acUpdate(deltaT): global messageList,messageLabel,s,appWindow,elsaped_time,viewers,CHAN,logged,hidingMessages,backupMessageList,messageList,lastMessageTime elsaped_time += deltaT if elsaped_time > 5 and logged == 1: if fetching == False: Thread(target=getActualFollow).start() ac.setTitle(appWindow,'') elsaped_time = 0 ac.setBackgroundOpacity(appWindow,0) try: response = s.recv(512).decode("utf-8") if logged == 0: res = re.search(LOGGUED_MSG, response) if res != None: logged = 1 #messageList.append('logged in success') displayRefresh() res = re.search(LOGGUEDFAIL_MSG, response) if res != None: logged = 1 messageList.append('login fail please check you\'re credential information') displayRefresh() else: if response == "PING :tmi.twitch.tv\r\n": s.send("PONG :tmi.twitch.tv\r\n".encode("utf-8")) elif response != None: result = re.search(CHAT_MSG, response) if result != None: if hidingMessages == True: tmpArray = backupMessageList backupMessageList = messageList messageList = tmpArray hidingMessages = False result = result.group(0) username = re.search(r"\w+", response).group(0) # return the entire match colorIndex = getUsernameColor(username) message = CHAT_MSG.sub("", response) message_ready = splitMessage(message,username) lastMessageTime = time.time() for i in message_ready: messageList.append((i,colorIndex)) displayRefresh() except: pass
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"
def acMain(ac_version): global appWindow, labelStorage, spinner_y_offset, scale_factor, fov_setting appWindow = ac.newApp("VR-Names") ac.setTitle(appWindow, "VR-names") ac.setSize(appWindow, 200, 200) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0) # ac.setIconPosition(appWindow, -9000, 0) spinner_y_offset = ac.addSpinner(appWindow, "Name Height Offset") ac.setRange(spinner_y_offset, -100, 100) ac.setValue(spinner_y_offset, 0) ac.setStep(spinner_y_offset, 1) ac.setPosition(spinner_y_offset, 10, 90) ac.setSize(spinner_y_offset, 180, 20) scale_factor = ac.addSpinner(appWindow, "scale text factor") ac.setRange(scale_factor, 1, 30) ac.setValue(scale_factor, 10) ac.setStep(scale_factor, 1) ac.setPosition(scale_factor, 10, 135) ac.setSize(scale_factor, 180, 20) fov_setting = ac.addSpinner(appWindow, "scale text factor") ac.setRange(fov_setting, 0, 360) ac.setValue(fov_setting, 110) ac.setStep(fov_setting, 1) ac.setPosition(fov_setting, 10, 180) ac.setSize(fov_setting, 180, 20) button_toggle_name = ac.addButton(appWindow, "Toggle name") ac.addOnClickedListener(button_toggle_name, toggle_name) ac.setSize(button_toggle_name, 180, 20) ac.setPosition(button_toggle_name, 10, 40) for x in range(ac.getCarsCount()): label = ac.addLabel(appWindow, "") ac.setPosition(label, 10, 0 + (20 * x)) labelStorage.append(label) setInitialLabel() return "vrnames"
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")
def acMain(ac_version): global tracking app = ac.newApp("MhwkRacingAssettoApp") ac.setTitle(app, 'MHWK racing') ac.setSize(app, 300, 200) ac.addOnAppActivatedListener(app, on_app_activated) ac.addOnAppDismissedListener(app, on_app_dismissed) tracking = track.TrackerManager() tracking.track('OnNewSession', track.OnNewSession()) tracking.track('OnNewLap', track.OnNewLap()) tracking.track('OnNewSector', track.OnNewSector()) gateway = LoggingGateway(HttpGateway('racing.mhwk.nl')) tracking.listen('OnNewSession', dispatch.StartLapDispatcher(gateway)) tracking.listen('OnNewLap', dispatch.CompleteLapDispatcher(gateway)) tracking.listen('OnNewSector', dispatch.CompleteSectorDispatcher(gateway)) return "MhwkRacingAssettoApp"
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 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
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"
def acMain(ac_version): global rpm_display, boost_display, gear_display, speed_display, fuel_display global min_rpm_spinner_Label, min_rpm_spinner, max_rpm_spinner_Label, max_rpm_spinner, settings_box_Label global units_spinner_Label, units_spinner global rpm_tag, speed_tag, boost_tag, fuel_tag appWindow=ac.newApp("RevHunterSkunkworks") ac.setTitle(appWindow, " ") ac.setSize(appWindow,windowx,windowy) ac.drawBorder(appWindow,0) ac.setBackgroundOpacity(appWindow,0) ac.addRenderCallback(appWindow, onFormRender) rpm_display = Label(appWindow, "").setSize(0,0).setPosition((2.05*windowx/3),(1.05*windowy/3)).setFontSize(50).setFontAlign("right") gear_display = Label(appWindow).setSize(0,0).setPosition((windowx / 2),-50).setFontSize(140).setFontAlign("center") speed_display= Label(appWindow, "").setSize(0,0).setPosition((1.25*windowx/3),(1.05*windowy/3)).setFontSize(50).setFontAlign("right") fuel_display = Label(appWindow, "").setSize(0,0).setPosition((0.8*windowx/3),(1.25*windowy/3)).setFontSize(35).setFontAlign("right") settings_box_Label = Label(appWindow, "").setSize(0,0).setPosition(940,83).setFontSize(15).setFontAlign("left") rpm_tag = Label(appWindow, "").setText("RPM").setSize(0,0).setPosition((2.06*windowx/3),(2.1*windowy/3)).setFontSize(15).setFontAlign("left") speed_tag=Label(appWindow, "").setText("MPH").setSize(0,0).setPosition((1.26*windowx/3),(2.1*windowy/3)).setFontSize(15).setFontAlign("left") fuel_tag = Label(appWindow, "").setText("%FUEL").setSize(0,0).setPosition((0.81*windowx/3),(1.9*windowy/3)).setFontSize(15).setFontAlign("left") min_rpm_spinner = ac.addSpinner(appWindow, "Min %RPM") spinnerConfig(min_rpm_spinner,0,125,80,20,0,1,100,80,setMinRPM,0) max_rpm_spinner = ac.addSpinner(appWindow, "Max %RPM") spinnerConfig(max_rpm_spinner,100,125,80,20,90,1,100,97,setMaxRPM,0) units_spinner = ac.addSpinner(appWindow, "Units") spinnerConfig(units_spinner,200,125,80,20,1,1,2,1,setUnits,0) settings_box = ac.addCheckBox(appWindow, "") ac.setPosition(settings_box,950,95) ac.setSize(settings_box,10,10) ac.addOnCheckBoxChanged(settings_box,toggle_settings_visiblity) return "RevHunterSkunkworks"
def acMain(ac_version): global appWindow global sound_player, SoundPackSpinner, VolumeSpinner global Beforerace, Overtake, Suspense, Win, Lose, labeldesc, Hotlap global StatusLabel, NotificationLabel, audio, audiolist, BeforeraceLabel, OvertakeLabel, SuspenseLabel global WinLabel, LoseLabel, audiolabel, position, debuglabel # DEBUG INFO global enable_overtake, enable_lose, enable_win, enable_hotlap global enable_before_race, enable_suspense, suspense_laps, log global audio, overtake, position, newposition, start_time, finish_time, count_overtake global session, sessionTime, numberOfLaps, completedLaps appWindow = ac.newApp("Epic Race") ac.setSize(appWindow, 430, 350) ac.setTitle(appWindow, "Epic Race") ac.setBackgroundOpacity(appWindow, 0.5) ac.drawBorder(appWindow, 0) # SoundPackSpinner = ac.addSpinner(appWindow, "") ac.setFontColor(SoundPackSpinner, 1, 1, 1, 1) ac.setFontSize(SoundPackSpinner, 12) spinner_config(SoundPackSpinner, 10, 55, 80, 18, 0, 1, 10, 0, onSoundPackChanged) # VolumeSpinner = ac.addSpinner(appWindow, "") ac.setFontColor(VolumeSpinner, 1, 1, 1, 1) ac.setFontSize(VolumeSpinner, 12) spinner_config(VolumeSpinner, 10, 105, 80, 18, 0, 1, 100, audio_volume, onVolumeChanged) # audiolabel = ac.addLabel(appWindow, "") ac.setPosition(audiolabel, 10, 30) ac.setFontColor(audiolabel, 1, 1, 1, 1) ac.setFontSize(audiolabel, 15) # volumelabel = ac.addLabel(appWindow, "Volume") ac.setPosition(volumelabel, 10, 80) ac.setFontColor(volumelabel, 1, 1, 1, 1) ac.setFontSize(volumelabel, 15) Beforerace = ac.addCheckBox(appWindow, "") ac.setValue(Beforerace, enable_before_race) ac.setPosition(Beforerace, 10, 130) ac.setSize(Beforerace, 20, 20) ac.drawBorder(Beforerace, 1) ac.addOnCheckBoxChanged(Beforerace, onEnableBeforeRace) # Overtake = ac.addCheckBox(appWindow, "") ac.setValue(Overtake, enable_overtake) ac.setPosition(Overtake, 10, 160) ac.setSize(Overtake, 20, 20) ac.drawBorder(Overtake, 1) ac.addOnCheckBoxChanged(Overtake, onEnableOverTake) # Suspense = ac.addCheckBox(appWindow, "") ac.setValue(Suspense, enable_suspense) ac.setPosition(Suspense, 10, 190) ac.setSize(Suspense, 20, 20) ac.drawBorder(Suspense, 1) ac.addOnCheckBoxChanged(Suspense, onEnableSuspense) # Win = ac.addCheckBox(appWindow, "") ac.setValue(Win, enable_win) ac.setPosition(Win, 10, 220) ac.setSize(Win, 20, 20) ac.drawBorder(Win, 1) ac.addOnCheckBoxChanged(Win, onEnableWin) # Lose = ac.addCheckBox(appWindow, "") ac.setValue(Lose, enable_lose) ac.setPosition(Lose, 10, 250) ac.setSize(Lose, 20, 20) ac.drawBorder(Lose, 1) ac.addOnCheckBoxChanged(Lose, onEnableLose) # Hotlap = ac.addCheckBox(appWindow, "") ac.setValue(Hotlap, enable_hotlap) ac.setPosition(Hotlap, 10, 280) ac.setSize(Hotlap, 20, 20) ac.drawBorder(Hotlap, 1) ac.addOnCheckBoxChanged(Hotlap, onEnableHotlap) # BeforeraceLabel = ac.addLabel(appWindow, "Enable before race") ac.setPosition(BeforeraceLabel, 40, 130) ac.setFontColor(BeforeraceLabel, 1, 1, 1, 1) ac.setFontSize(BeforeraceLabel, 15) # OvertakeLabel = ac.addLabel(appWindow, "Enable overtake") ac.setPosition(OvertakeLabel, 40, 160) ac.setFontColor(OvertakeLabel, 1, 1, 1, 1) ac.setFontSize(OvertakeLabel, 15) # SuspenseLabel = ac.addLabel(appWindow, "Enable suspense") ac.setPosition(SuspenseLabel, 40, 190) ac.setFontColor(SuspenseLabel, 1, 1, 1, 1) ac.setFontSize(SuspenseLabel, 15) # WinLabel = ac.addLabel(appWindow, "Enable win") ac.setPosition(WinLabel, 40, 220) ac.setFontColor(WinLabel, 1, 1, 1, 1) ac.setFontSize(WinLabel, 15) # LoseLabel = ac.addLabel(appWindow, "Enable lose") ac.setPosition(LoseLabel, 40, 250) ac.setFontColor(LoseLabel, 1, 1, 1, 1) ac.setFontSize(LoseLabel, 15) # HotlapLabel = ac.addLabel(appWindow, "Enable hotlap") ac.setPosition(HotlapLabel, 40, 280) ac.setFontColor(HotlapLabel, 1, 1, 1, 1) ac.setFontSize(HotlapLabel, 15) # labeldesc = ac.addLabel(appWindow, "Something is broken") ac.setPosition(labeldesc, 180, 40) ac.setSize(labeldesc, 200, 200) # StatusLabel = ac.addLabel(appWindow, Status) ac.setPosition(StatusLabel, 10, 305) ac.setFontColor(StatusLabel, 1, 1, 1, 1) ac.setFontSize(StatusLabel, 15) # NotificationLabel = ac.addLabel(appWindow, Notify) ac.setPosition(NotificationLabel, 10, 325) ac.setFontColor(NotificationLabel, 1, 1, 1, 1) ac.setFontSize(NotificationLabel, 12) ac.setSize(NotificationLabel, 24, 310) # # DEBUG INFO # debuglabel = ac.addLabel(appWindow, "") ac.setPosition(debuglabel, 215, 30) ac.setSize(debuglabel, 200, 200) # # # box.FModSystem.init() sound_player = box.SoundPlayer(box.FModSystem) sound_player.set_volume(audio_volume / 100) sound_player.set_gain(2.0) audiolist = os.listdir(os.path.join(os.path.dirname(__file__), "SoundPacks")) ac.setRange(SoundPackSpinner, 0, len(audiolist) - 1) ac.setStep(SoundPackSpinner, 1) ac.setValue(SoundPackSpinner, audiolist.index(audio)) getNotification() if AutoUpdate: CheckNewUpdate() position = ac.getCarRealTimeLeaderboardPosition(0) return "EpicRace"
def acMain(ac_version): global appWindow,FuelSelection,label1,label2,label3,NoChange,SuperSoft global SoftSlick,MediumSlick,HardSlick,SuperHard,Body,Engine,Suspension global DoOnce,ahk,response if DoOnce == 0: ahk = subprocess.Popen(["apps\python\PitVoice\Pitvoice.exe"]) DoOnce = 1 # appWindow = ac.newApp("PitVoice") ac.setSize(appWindow,350,250) ac.setTitle(appWindow,"") ac.setBackgroundOpacity(appWindow,0.5) ac.setBackgroundTexture(appWindow,"apps/python/PitVoice/PitMenu.png") # FuelSelection = ac.addSpinner(appWindow,"")#Fuel ac.setPosition(FuelSelection,87,110) ac.setSize(FuelSelection,175,25) ac.setFontColor(FuelSelection,1,1,0,1) ac.setFontSize(FuelSelection, 15) ac.setRange(FuelSelection,0,190) ac.setStep(FuelSelection,1) ac.addOnValueChangeListener(FuelSelection,FuelEvent) # NoChange = ac.addCheckBox(appWindow,"") ac.setPosition(NoChange,22,86) ac.setSize(NoChange,15,15) ac.addOnCheckBoxChanged(NoChange,NoChangeEvent) # SuperSoft = ac.addCheckBox(appWindow,"") ac.setPosition(SuperSoft,82,86) ac.setSize(SuperSoft,15,15) ac.addOnCheckBoxChanged(SuperSoft,SuperSoftEvent) # SoftSlick = ac.addCheckBox(appWindow,"") ac.setPosition(SoftSlick,138,86) ac.setSize(SoftSlick,15,15) ac.addOnCheckBoxChanged(SoftSlick,SoftSlickEvent) # MediumSlick = ac.addCheckBox(appWindow,"") ac.setPosition(MediumSlick,197,86) ac.setSize(MediumSlick,15,15) ac.addOnCheckBoxChanged(MediumSlick,MediumSlickEvent) # HardSlick = ac.addCheckBox(appWindow,"") ac.setPosition(HardSlick,255,86) ac.setSize(HardSlick,15,15) ac.addOnCheckBoxChanged(HardSlick,HardSlickEvent) # SuperHard = ac.addCheckBox(appWindow,"") ac.setPosition(SuperHard,313,86) ac.setSize(SuperHard,15,15) ac.addOnCheckBoxChanged(SuperHard,SuperHardEvent) # Body = ac.addCheckBox(appWindow,"") ac.setPosition(Body,59,229) ac.setSize(Body,15,15) ac.addOnCheckBoxChanged(Body,BodyEvent) # Engine = ac.addCheckBox(appWindow,"") ac.setPosition(Engine,169,229) ac.setSize(Engine,15,15) ac.addOnCheckBoxChanged(Engine,EngineEvent) # Suspension = ac.addCheckBox(appWindow,"") ac.setPosition(Suspension,276,229) ac.setSize(Suspension,15,15) ac.addOnCheckBoxChanged(Suspension,SuspensionEvent) # label1=ac.addLabel(appWindow,"Fuel +") ac.setPosition(label1,275,113) ac.setFontColor(label1,1,1,0,1) ac.setFontSize(label1, 15) # label2=ac.addLabel(appWindow,"Fuel -") ac.setPosition(label2,30,113) ac.setFontColor(label2,1,1,0,1) ac.setFontSize(label2, 15) # label3=ac.addLabel(appWindow,"0") ac.setPosition(label3,166,110) ac.setFontColor(label3,1,1,0,0) ac.setFontSize(label3, 15) # ResponseWit() return "PitVoice"
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 showTitle(self, show): if show: ac.setTitle(self.app, self.name) else: ac.setTitle(self.app, "") return self
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
def refreshParameters(self): if showHeader: ac.setTitle(self.window, self.headerName) ac.setIconPosition(self.window, 0, 0) self.firstSpacing = firstSpacing else: ac.setTitle(self.window, "") ac.setIconPosition(self.window, -10000, -10000) self.firstSpacing = 0 widthNumber = fontSize*2 widthTime = fontSize*5 widthDelta = fontSize*5 self.width = widthNumber + widthTime + widthDelta*showDelta + 2*spacing self.height = self.firstSpacing + (fontSize + spacing)*(lapDisplayedCount + showCurrent + showTotal + showReference) ac.setSize(self.window, self.width, self.height) for index in range(lapLabelCount+3): ac.setFontSize(self.lapNumberLabel[index], fontSize) ac.setPosition(self.lapNumberLabel[index], spacing, self.firstSpacing + index*(fontSize+spacing)) ac.setSize(self.lapNumberLabel[index], widthNumber, fontSize+spacing) ac.setFontSize(self.timeLabel[index], fontSize) ac.setPosition(self.timeLabel[index], spacing + widthNumber, self.firstSpacing + index*(fontSize+spacing)) ac.setSize(self.timeLabel[index], widthTime, fontSize+spacing) ac.setFontSize(self.deltaLabel[index], fontSize) ac.setPosition(self.deltaLabel[index], spacing + widthNumber + widthTime, self.firstSpacing + index*(fontSize+spacing)) ac.setSize(self.deltaLabel[index], widthTime, fontSize+spacing) for index in range(lapLabelCount): if index < lapDisplayedCount: ac.setVisible(self.lapNumberLabel[index], 1) ac.setVisible(self.timeLabel[index], 1) ac.setVisible(self.deltaLabel[index], showDelta) else: ac.setVisible(self.lapNumberLabel[index], 0) ac.setVisible(self.timeLabel[index], 0) ac.setVisible(self.deltaLabel[index], 0) rowIndex = lapDisplayedCount # Current time position ac.setPosition(self.lapNumberLabel[self.currLabelId], spacing, self.firstSpacing + rowIndex*(fontSize+spacing)) ac.setPosition(self.timeLabel[self.currLabelId], spacing + widthNumber, self.firstSpacing + rowIndex*(fontSize+spacing)) ac.setPosition(self.deltaLabel[self.currLabelId], spacing + widthNumber + widthTime, self.firstSpacing + rowIndex*(fontSize+spacing)) ac.setVisible(self.lapNumberLabel[self.currLabelId], showCurrent) ac.setVisible(self.timeLabel[self.currLabelId], showCurrent) ac.setVisible(self.deltaLabel[self.currLabelId], showCurrent and showDelta) rowIndex += showCurrent # Reference time name and position if reference == "best": ac.setText(self.lapNumberLabel[self.refLabelId], "Best") elif reference == "median": ac.setText(self.lapNumberLabel[self.refLabelId], "Med.") elif reference == "top25": ac.setText(self.lapNumberLabel[self.refLabelId], "25%") elif reference == "top50": ac.setText(self.lapNumberLabel[self.refLabelId], "50%") elif reference == "top75": ac.setText(self.lapNumberLabel[self.refLabelId], "75%") ac.setVisible(self.lapNumberLabel[self.refLabelId], showReference) ac.setVisible(self.timeLabel[self.refLabelId], showReference) ac.setVisible(self.deltaLabel[self.refLabelId], 0) ac.setPosition(self.lapNumberLabel[self.refLabelId], spacing, self.firstSpacing + rowIndex*(fontSize+spacing)) ac.setPosition(self.timeLabel[self.refLabelId], spacing + widthNumber, self.firstSpacing + rowIndex*(fontSize+spacing)) ac.setPosition(self.deltaLabel[self.refLabelId], spacing + widthNumber + widthTime, self.firstSpacing + rowIndex*(fontSize+spacing)) rowIndex += showReference # Total time position ac.setVisible(self.lapNumberLabel[self.totalLabelId], showTotal) ac.setVisible(self.timeLabel[self.totalLabelId], showTotal) ac.setVisible(self.deltaLabel[self.totalLabelId], 0) ac.setPosition(self.lapNumberLabel[self.totalLabelId], spacing, self.firstSpacing + rowIndex*(fontSize+spacing)) ac.setPosition(self.timeLabel[self.totalLabelId], spacing + widthNumber, self.firstSpacing + rowIndex*(fontSize+spacing)) ac.setPosition(self.deltaLabel[self.totalLabelId], spacing + widthNumber + widthTime, self.firstSpacing + rowIndex*(fontSize+spacing)) # Force full refresh self.updateDataFast() self.updateDataRef() self.updateViewFast() self.updateViewNewLap()
def acMain(ac_version): global Status global appWindow, FuelSelection, FuelLabel, NoChange, Option1 global Option2, Option3, Option4, Option5, Body, Engine, Suspension, Fill, FuelOption, NotificationLabel, StatusLabel, Status global Preset1, Preset2, Preset3, Preset4 # appWindow = ac.newApp("BoxRadio") ac.setSize(appWindow, 180 * UiSize, 220 * UiSize) ac.setTitle(appWindow, "BoxRadio") ac.setBackgroundOpacity(appWindow, 0.5) ac.drawBorder(appWindow, 0) # FuelSelection = ac.addSpinner(appWindow, "") ac.setPosition(FuelSelection, 10 * UiSize, 99 * UiSize) ac.setSize(FuelSelection, 80 * UiSize, 18 * UiSize) ac.setFontColor(FuelSelection, 1, 1, 1, 1) ac.setFontSize(FuelSelection, 12 * UiSize) ac.setRange(FuelSelection, 0, int(FuelMax)) ac.setStep(FuelSelection, 1) ac.addOnValueChangeListener(FuelSelection, FuelEvent) # if FuelOption == True: FuelLabel = ac.addLabel(appWindow, "Fuel Add") ac.setPosition(FuelLabel, 10 * UiSize, 80 * UiSize) ac.setFontColor(FuelLabel, 1, 1, 1, 1) ac.setFontSize(FuelLabel, 13 * UiSize) else: FuelLabel = ac.addLabel(appWindow, "Fuel Total") ac.setPosition(FuelLabel, 10 * UiSize, 80 * UiSize) ac.setFontColor(FuelLabel, 1, 1, 1, 1) ac.setFontSize(FuelLabel, 13 * UiSize) # Fill = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Fill, 0) ac.drawBorder(Fill, 0) ac.setSize(Fill, 20 * UiSize, 20 * UiSize) ac.setPosition(Fill, 95 * UiSize, 98 * UiSize) ac.setBackgroundTexture(Fill, "apps/python/BoxRadio/img/fuel_fill_OFF.png") ac.addOnClickedListener(Fill, FillEvent) # NoChange = ac.addButton(appWindow, "") ac.setBackgroundOpacity(NoChange, 0) ac.drawBorder(NoChange, 0) ac.setSize(NoChange, 25 * UiSize, 25 * UiSize) ac.setPosition(NoChange, 125 * UiSize, 27 * UiSize) ac.setBackgroundTexture(NoChange, "content/gui/pitstop/tyre_no_change_ON.png") ac.addOnClickedListener(NoChange, NoChangeEvent) # Nochangelabel = ac.addLabel(appWindow, "No") ac.setPosition(Nochangelabel, 153 * UiSize, 31 * UiSize) ac.setFontColor(Nochangelabel, 1, 1, 1, 1) ac.setFontSize(Nochangelabel, 12 * UiSize) # Option1 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option1, 0) ac.drawBorder(Option1, 0) ac.setSize(Option1, 25 * UiSize, 25 * UiSize) ac.setPosition(Option1, 125 * UiSize, 52 * UiSize) ac.setBackgroundTexture(Option1, "content/gui/pitstop/tyre_1_OFF.png") ac.addOnClickedListener(Option1, Option1Event) if OptionLabel[1] == '': ac.setVisible(Option1, 0) # Option1label = ac.addLabel(appWindow, OptionLabel[1].upper()) ac.setPosition(Option1label, 153 * UiSize, 56 * UiSize) ac.setFontColor(Option1label, 1, 1, 1, 1) ac.setFontSize(Option1label, 13 * UiSize) # Option2 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option2, 0) ac.drawBorder(Option2, 0) ac.setSize(Option2, 25 * UiSize, 25 * UiSize) ac.setPosition(Option2, 125 * UiSize, 77 * UiSize) ac.setBackgroundTexture(Option2, "content/gui/pitstop/tyre_2_OFF.png") ac.addOnClickedListener(Option2, Option2Event) if OptionLabel[2] == '': ac.setVisible(Option2, 0) # Option2label = ac.addLabel(appWindow, OptionLabel[2].upper()) ac.setPosition(Option2label, 153 * UiSize, 81 * UiSize) ac.setFontColor(Option2label, 1, 1, 1, 1) ac.setFontSize(Option2label, 13 * UiSize) # Option3 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option3, 0) ac.drawBorder(Option3, 0) ac.setSize(Option3, 25 * UiSize, 25 * UiSize) ac.setPosition(Option3, 125 * UiSize, 102 * UiSize) ac.setBackgroundTexture(Option3, "content/gui/pitstop/tyre_3_OFF.png") ac.addOnClickedListener(Option3, Option3Event) if OptionLabel[3] == '': ac.setVisible(Option3, 0) # Option3label = ac.addLabel(appWindow, OptionLabel[3].upper()) ac.setPosition(Option3label, 153 * UiSize, 106 * UiSize) ac.setFontColor(Option3label, 1, 1, 1, 1) ac.setFontSize(Option3label, 13 * UiSize) # Option4 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option4, 0) ac.drawBorder(Option4, 0) ac.setSize(Option4, 25 * UiSize, 25 * UiSize) ac.setPosition(Option4, 125 * UiSize, 127 * UiSize) ac.setBackgroundTexture(Option4, "content/gui/pitstop/tyre_4_OFF.png") ac.addOnClickedListener(Option4, Option4Event) if OptionLabel[4] == '': ac.setVisible(Option4, 0) # Option4label = ac.addLabel(appWindow, OptionLabel[4].upper()) ac.setPosition(Option4label, 153 * UiSize, 131 * UiSize) ac.setFontColor(Option4label, 1, 1, 1, 1) ac.setFontSize(Option4label, 13 * UiSize) # Option5 = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Option5, 0) ac.drawBorder(Option5, 0) ac.setSize(Option5, 25 * UiSize, 25 * UiSize) ac.setPosition(Option5, 125 * UiSize, 152 * UiSize) ac.setBackgroundTexture(Option5, "content/gui/pitstop/tyre_5_OFF.png") ac.addOnClickedListener(Option5, Option5Event) if OptionLabel[5] == '': ac.setVisible(Option5, 0) # Option5label = ac.addLabel(appWindow, OptionLabel[5].upper()) ac.setPosition(Option5label, 153 * UiSize, 156 * UiSize) ac.setFontColor(Option5label, 1, 1, 1, 1) ac.setFontSize(Option5label, 13 * UiSize) # Suspension = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Suspension, 0) ac.drawBorder(Suspension, 0) ac.setSize(Suspension, 30 * UiSize, 30 * UiSize) ac.setPosition(Suspension, 10 * UiSize, 136 * UiSize) ac.setBackgroundTexture(Suspension, "content/gui/pitstop/repair_sus_OFF.png") ac.addOnClickedListener(Suspension, SuspensionEvent) # Body = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Body, 0) ac.drawBorder(Body, 0) ac.setSize(Body, 30 * UiSize, 30 * UiSize) ac.setPosition(Body, 48 * UiSize, 136 * UiSize) ac.setBackgroundTexture(Body, "content/gui/pitstop/repair_body_OFF.png") ac.addOnClickedListener(Body, BodyEvent) # Engine = ac.addButton(appWindow, "") ac.setBackgroundOpacity(Engine, 0) ac.drawBorder(Engine, 0) ac.setSize(Engine, 30 * UiSize, 30 * UiSize) ac.setPosition(Engine, 85 * UiSize, 136 * UiSize) ac.setBackgroundTexture(Engine, "content/gui/pitstop/repair_engine_OFF.png") ac.addOnClickedListener(Engine, EngineEvent) # Preset1 = ac.addCheckBox(appWindow, "") ac.setPosition(Preset1, 10 * UiSize, 50 * UiSize) ac.setSize(Preset1, 20 * UiSize, 20 * UiSize) ac.drawBorder(Preset1, 1) ac.addOnCheckBoxChanged(Preset1, Preset1Event) # Preset2 = ac.addCheckBox(appWindow, "") ac.setPosition(Preset2, 37 * UiSize, 50 * UiSize) ac.setSize(Preset2, 20 * UiSize, 20 * UiSize) ac.drawBorder(Preset2, 1) ac.addOnCheckBoxChanged(Preset2, Preset2Event) # Preset3 = ac.addCheckBox(appWindow, "") ac.setPosition(Preset3, 65 * UiSize, 50 * UiSize) ac.setSize(Preset3, 20 * UiSize, 20 * UiSize) ac.drawBorder(Preset3, 1) ac.addOnCheckBoxChanged(Preset3, Preset3Event) # Preset4 = ac.addCheckBox(appWindow, "") ac.setPosition(Preset4, 93 * UiSize, 50 * UiSize) ac.setSize(Preset4, 20 * UiSize, 20 * UiSize) ac.drawBorder(Preset4, 1) ac.addOnCheckBoxChanged(Preset4, Preset4Event) # PresetLabel = ac.addLabel(appWindow, "Preset") ac.setPosition(PresetLabel, 10 * UiSize, 30 * UiSize) ac.setFontColor(PresetLabel, 1, 1, 1, 1) ac.setFontSize(PresetLabel, 13 * UiSize) # Preset1Label = ac.addLabel(appWindow, "1") ac.setPosition(Preset1Label, 16 * UiSize, 50 * UiSize) ac.setFontColor(Preset1Label, 0, 0, 0, 1) ac.setFontSize(Preset1Label, 15 * UiSize) # Preset2Label = ac.addLabel(appWindow, "2") ac.setPosition(Preset2Label, 43 * UiSize, 50 * UiSize) ac.setFontColor(Preset2Label, 0, 0, 0, 1) ac.setFontSize(Preset2Label, 15 * UiSize) # Preset3Label = ac.addLabel(appWindow, "3") ac.setPosition(Preset3Label, 71 * UiSize, 50 * UiSize) ac.setFontColor(Preset3Label, 0, 0, 0, 1) ac.setFontSize(Preset3Label, 15 * UiSize) # Preset4Label = ac.addLabel(appWindow, "4") ac.setPosition(Preset4Label, 99 * UiSize, 50 * UiSize) ac.setFontColor(Preset4Label, 0, 0, 0, 1) ac.setFontSize(Preset4Label, 15 * UiSize) # StatusLabel = ac.addLabel(appWindow, Status) ac.setPosition(StatusLabel, 10 * UiSize, 175 * UiSize) ac.setFontColor(StatusLabel, 1, 1, 1, 1) ac.setFontSize(StatusLabel, 10 * UiSize) # NotificationLabel = ac.addLabel(appWindow, Notify) ac.setPosition(NotificationLabel, 10 * UiSize, 195 * UiSize) ac.setFontColor(NotificationLabel, 1, 1, 1, 1) ac.setFontSize(NotificationLabel, 9 * UiSize) # return "BoxRadio"