コード例 #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())
コード例 #2
0
ファイル: tyre_temp.py プロジェクト: LaurentResende/AC_APPS
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"
コード例 #3
0
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
コード例 #4
0
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
コード例 #5
0
  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)
コード例 #6
0
ファイル: app_window.py プロジェクト: fzalm/ac-blueprint
    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 = []
コード例 #7
0
def acUpdate(delta_t):
    global error, timer, day_offset, gWrapDebugText, gAppsize, gHideBG, gHideWeather
    timer += delta_t
    day_offset += speed * delta_t
    if timer > 0.075:
        timer = 0.0
        if abs(day_offset) > 1:
            try:
                ac.ext_weatherTimeOffset(24 * 60 * 60 * day_offset / abs(day_offset))
            except:
                ac.log("AccExtWeatherFX: Unexpected error:" + traceback.format_exc())
            day_offset = 0
        if error < 1:
            try:
                if not gHideWeather:
                    s = ac.ext_weatherDebugText()
                    s = s.replace('current day:', ' > current day:              ')
                    if gWrapDebugText==True:
                        s = '\n'.join(s.strip() for s in re.findall(r'.{1,80}(?:\s+|$)', s))
                        s = s.replace('>>> Sol weather: v', '\n>>> Sol weather: v')
                    ac.setText(label, s)
                if gHideBG==True:
                    ac.setBackgroundOpacity(app,0)
                    ac.drawBorder(app,0)
            except:
                error = error + 1
                ac.log("AccExtWeatherFX: Unexpected error:" + traceback.format_exc())
                ac.setText(label, "Shaders patch not installed? Error: \n" + traceback.format_exc())
コード例 #8
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"))
コード例 #9
0
ファイル: classes.py プロジェクト: acclub/apps
	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))
コード例 #10
0
    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)
コード例 #11
0
def acUpdate(deltaT):
    global appWindow
    global current_gear, current_rpm, max_rpm, shift_light, alpha, images_light, images_digits, gear_display, current_speed, max_fuel, current_fuel
    global rpm_display, boost_display, percentage_boost, current_boost, max_boost, percentage_rpm, truncated_rpm, fuel_display, percentage_fuel
    global min_rpm_spinner_Label, max_rpm_spinner_Label, units_spinner_Label

    #Keep app window transparent
    ac.setBackgroundOpacity(appWindow, 0)
    ac.drawBorder(appWindow, 0)

    max_rpm = sim_info.static.maxRpm if max_rpm == 0 else max_rpm      #This is pulled from shared memory, read only once
    max_fuel     = sim_info.static.maxFuel if max_fuel == 0 else max_fuel   #This is read from shared memory, read only once
    current_fuel = sim_info.physics.fuel                                    #This is read from shared memory, read every deltaT
    percentage_fuel = current_fuel/max_fuel*100

    current_gear = ac.getCarState(0, acsys.CS.Gear)                    #This is read from the API every update
    current_gear = current_gear - 1

    current_rpm  = ac.getCarState(0, acsys.CS.RPM)                     #This is read from the API every update
    truncated_rpm = 100*round(current_rpm/100)

    current_boost = ac.getCarState(0,acsys.CS.TurboBoost)                   #This is read from the API every update
    if units == 1:
        current_speed = ac.getCarState(0,acsys.CS.SpeedMPH)
    if units == 2:
        current_speed = ac.getCarState(0,acsys.CS.SpeedKMH)

    if (current_boost > max_boost):                                         #Calcualate maximum turbo boost pressure - Due to limitations in the api/shared memory currently the only way
        max_boost = current_boost

    percentage_boost = current_boost/max_boost*100                              #Calculate the percent of turbo boost being generated
    percentage_rpm = current_rpm/max_rpm*100

    speed_display.setText("%d" % current_speed)


    if (current_gear >0):
        if (percentage_rpm < max_user_rpm):
            gear_display.setText("%d" % current_gear).setFontColor(1,1,1,1)
        else:
            gear_display.setText("%d" % current_gear).setFontColor(1,0,0,1)
    if (current_gear == 0):
        if (percentage_rpm < max_user_rpm):
            gear_display.setText("N").setFontColor(1,1,1,1)
        else:
            gear_display.setText("N").setFontColor(1,0,0,1)
    if (current_gear < 0):
        if (percentage_rpm < max_user_rpm):
            gear_display.setText("R").setFontColor(1,1,1,1)
        else:
            gear_display.setText("R").setFontColor(1,0,0,1)
    rpm_display.setText("%d" % abs(truncated_rpm))

    #fuel_display.setText("%0.1f" % percentage_fuel).setFontColor(1,0,1,1)
    if (percentage_fuel > 10):
        fuel_display.setText("%0.1f" % percentage_fuel).setFontColor(1,1,1,1)
    if (percentage_fuel < 10):
        fuel_display.setText("%0.1f" % percentage_fuel).setFontColor(1,1,0,1)
    if (percentage_fuel < 5):
        fuel_display.setText("%0.1f" % percentage_fuel).setFontColor(1,0,0,1)
コード例 #12
0
def acMain(ac_version):
    global updater, appHeight, appWidth, appWindow, numSecondsSpinner
    appWindow = ac.newApp("Traction Circle")
    ac.setSize(appWindow, appWidth, appHeight)
    ac.drawBorder(appWindow, 0)

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

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

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

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

    return "Traction Circle"
コード例 #13
0
    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)
コード例 #14
0
 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()
コード例 #15
0
    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'
コード例 #16
0
  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'
コード例 #17
0
    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()
コード例 #18
0
  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)
コード例 #19
0
ファイル: AccAnalogSpeedometer.py プロジェクト: acclub/apps
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)
コード例 #20
0
ファイル: AccHelper.py プロジェクト: acclub/apps
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
コード例 #21
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"
コード例 #22
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"
コード例 #23
0
    def setup(self):
        # ac.addRenderCallback(self.appWindow, onRender)
        ac.setSize(self.appWindow,800,100)
        ac.drawBorder(self.appWindow,0)
        ac.drawBackground(self.appWindow, 0)
        for el in self.uiElements:
            el.setup()

        ac.setPosition(self.graph, 0, 100)
        ac.setSize(self.graph,800,100)
        ac.setRange(self.graph, 0.0, 600, 2000)
コード例 #24
0
def acUpdate(deltaT):
    global timer, gOpacity
    timer += deltaT
    if timer > 0.05:
        timer = 0.0
        CheckOffTrack()
        ac.setBackgroundOpacity(appWindow, gOpacity)
        if gOpacity == 0:
            ac.drawBorder(appWindow, 0)
        else:
            ac.drawBorder(appWindow, 1)
コード例 #25
0
 def _create_button(self, name, x, y, size_x, size_y, callback,
                    border=0, opacity=0, texture=None):
     button = ac.addButton(self.widget, '')
     ac.setPosition(button, x, y)
     ac.setSize(button, size_x, size_y)
     ac.addOnClickedListener(button, callback)
     ac.drawBorder(button, border)
     ac.setBackgroundOpacity(button, opacity)
     if texture:
         texture = os.path.join(session.app_path, 'img', texture)
         ac.setBackgroundTexture(button, texture)
     self.buttons[name] = button
コード例 #26
0
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"
コード例 #27
0
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"
コード例 #28
0
ファイル: actracker.py プロジェクト: mathiasuk/actracker
 def _create_button(self, name, x, y, size_x, size_y, callback,
                    border=0, opacity=0, texture=None):
     button = ac.addButton(self.widget, '')
     ac.setPosition(button, x, y)
     ac.setSize(button, size_x, size_y)
     ac.addOnClickedListener(button, callback)
     ac.drawBorder(button, border)
     ac.setBackgroundOpacity(button, opacity)
     if texture:
         texture = os.path.join(session.app_path, 'img', texture)
         ac.setBackgroundTexture(button, texture)
     self.buttons[name] = button
コード例 #29
0
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"
コード例 #30
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()))
コード例 #31
0
ファイル: ac_gui.py プロジェクト: styinx/ACRM
    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()
コード例 #32
0
ファイル: z3dgauge.py プロジェクト: iocube/z3dGauge
def acUpdate(deltaT):

    ac.setBackgroundOpacity(appWindow, 0)
    ac.drawBorder(appWindow, 0)
    global l_kmph, l_rpm, l_gear, speed, RPM, gear, acceleration

    speed = str(ac.getCarState(0, acsys.CS.SpeedKMH))
    RPM = str(ac.getCarState(0, acsys.CS.RPM))
    gear = str(ac.getCarState(0, acsys.CS.Gear))

    ac.setText(l_kmph, speed)
    ac.setText(l_rpm, RPM)
    ac.setText(l_gear, gear)
    

    global ascii_RPM, ARPM

    iRPM = float(RPM)
    maxRPM = float(info.static.maxRpm)

    ARPM = tacho(iRPM)

    if iRPM >= (maxRPM - 200):
        ARPM = ARPM + "[!]"
    
    ac.setText(ascii_RPM, ARPM)
    accelerationS = str(ac.getCarState(0, acsys.CS.AccG)) # returns a tuple with x y z; so X is sideways, Y is up and down and Z forward reverse
    accelerationTest = ac.getCarState(0, acsys.CS.AccG) # this is the non-printing one I'm gonna work with

    global gX, gY, gZ, gZback, gXleft

    gX = round(accelerationTest[0], 3)  # then the car's turning left basically, gforces pulling the car to the right
    if gX > 0:  
        gXleft = 0
    else:
        gXleft = gX
        gX = 0.0
    gY = round(accelerationTest[1], 3)
    gZ = round(accelerationTest[2], 3)
    gZback = gZ # forking gZ into two, this one will be used for reverse gforces
    if gZ < 0:
        gZback = gZ
        gZ = 0.0
    else:
        gZback = 0.0
        
    ac.setText(acceleration, accelerationS)
    print(acceleration)
コード例 #33
0
ファイル: Display.py プロジェクト: wsracing-esports/RaceDash
    def addButton(self, event, options):
        options.x = options.x | 0
        options.y = options.y | 0
        options.fontSize = options.fontSize | 10
        options.border = options.border | 0
        options.opacity = options.opacity | 1

        item = ac.addButton(self.appWindow, "")
        ac.setPosition(item, self.x + options.x * self.scale, self.y + options.y * self.scale)
        ac.setFontSize(item, options.fontSize)
        ac.drawBorder(item, options.border)
        ac.setBackgroundOpacity(item, options.opacity)
        ac.addonClickListener(item, event)
        ac.setText(item, options.content)

        return item
コード例 #34
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
コード例 #35
0
ファイル: vrnames.py プロジェクト: thuelsmeier/vrnames
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"
コード例 #36
0
ファイル: classes.py プロジェクト: acclub/apps
	def __init__(self, window, clickFunc, width=60, height=20, x=0, y=0, text="", texture=""):
		self.width = width
		self.height = height
		self.x = x
		self.y = y
		self.button = ac.addButton(window, text)
		
		# adding default settings
		self.setSize(width, height)
		self.setPos(x, y)
		if texture != "":
			self.setBgTexture(texture)
		
		# default settings
		ac.drawBorder(self.button, 0)
		ac.setBackgroundOpacity(self.button, 0)
		
		# adding a click event
		ac.addOnClickedListener(self.button, clickFunc)
コード例 #37
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
コード例 #38
0
def acMain(ac_version):
    """Main function that is invoked by Assetto Corsa."""
    global app_window
    app_window = ac.newApp("")
    ac.setSize(app_window, 343, 78)
    ac.drawBorder(app_window, 0)
    app_dir = os.path.dirname(os.path.realpath(__file__))
    ac.setBackgroundTexture(app_window, app_dir + "/Images/Dashboard.png")
    ac.addRenderCallback(app_window, render_app)

    CAR.name = ac.getCarName(0)
    dashboard_elements.init(MAIN_APP_TELEMETRY, app_window, CAR.name)

    tyre_apps.init(MAIN_APP_TELEMETRY)
    info_app.init()

    threading.Thread(target=read_static_shared_memory).start()

    return "AC Dashboard"
コード例 #39
0
    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")
コード例 #40
0
def acMain(ac_version):
	# use global variables
	global appWindow, FL, FR, RL, RR, space
	
	# create the app
	appWindow = ac.newApp("Tyre Temps")
	
	# setup the app window
	ac.setSize(appWindow,160,209)
	ac.drawBorder(appWindow,0)
	ac.setBackgroundOpacity(appWindow,0)
	# make the background a set of tyre outlines
	ac.setBackgroundTexture(appWindow,"apps/python/tyreTemps/tyretempsBackground.png")
	
	# create an object for each tyre
	FL = TyreTempText(appWindow, "FL", 25, 85)
	FR = TyreTempText(appWindow, "FR", 95, 85)
	RL = TyreTempText(appWindow, "RL", 25, 105)
	RR = TyreTempText(appWindow, "RR", 95, 105)
	
	return "Tyre Temps"
コード例 #41
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
コード例 #42
0
def updateCalcTypeUI():
    global shownCalcData, currentSessionCalcData, multipleSessionsCalcData, persistedCalcData
    global calcTypeCurrentButton, calcTypeMultipleButton, calcTypeStoredButton

    ac.drawBorder(calcTypeCurrentButton, shownCalcData == currentSessionCalcData)
    ac.drawBorder(calcTypeMultipleButton, shownCalcData == multipleSessionsCalcData)
    ac.drawBorder(calcTypeStoredButton, shownCalcData == persistedCalcData)
コード例 #43
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
コード例 #44
0
ファイル: nChat.py プロジェクト: 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"
コード例 #45
0
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"
コード例 #46
0
ファイル: MultiLaps.py プロジェクト: robhaswell/MultiLaps
 def onRenderCallback(self, deltaT):
     # Update background and border in case the app has been moved
     ac.setBackgroundOpacity(self.window, float(opacity)/100)
     ac.drawBorder(self.window, showBorder)
コード例 #47
0
ファイル: classes.py プロジェクト: acclub/apps
	def border(self, value):
		ac.drawBorder(self.app, value)
		return self
コード例 #48
0
 def draw_border(self, value):
     self._draw_border = value
     ac.drawBorder(self.id, value)
コード例 #49
0
 def __init__(self, name="defaultAppWindow", width=100, height=100):
     self.app = ac.newApp(name)
     ac.drawBorder(self.app, 0)
     ac.setBackgroundOpacity(self.app, 0)
     self.setSize(width, height)
コード例 #50
0
ファイル: EpicRace.py プロジェクト: Marocco2/EpicRace
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"
コード例 #51
0
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"
コード例 #52
0
 def hasCustomBackground(self):
     ac.drawBorder(self.button, 0)
     ac.setBackgroundOpacity(self.button, 0)
     return self
コード例 #53
0
ファイル: BoxRadio.py プロジェクト: Marocco2/BoxRadio
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"