Пример #1
0
 def __init__(self, app, x, y):
   
   self.AverageFuelPerLap = 0.0
   self.FuelLastLap = 0.0
   self.completedLaps = 0.0
   self.fuelAtLapStart = 0.0
   self.distanceTraveledAtStart = 0.0
   self.fuelAtStart = 0.0
   self.lastFuelMeasurement = 0.0
   self.lastDistanceTraveled = 0.0
   self.counter = 0
   self.updatecounter = 0
   
   self.inifilepath = inidir + self.getValidFileName(ac.getCarName(0)) +"_" + self.getValidFileName(ac.getTrackName(0)) + self.getValidFileName(ac.getTrackConfiguration(0)) + ".ini"
   
   ##initialize labels
   
   self.remainingLabel = ac.addLabel(app, "remainingLabel")
   self.averageFuelPerLapLabel = ac.addLabel(app, "averageFuelPerLapLabel")
   self.lapsLeftLabel = ac.addLabel(app, "lapsLeftLabel")
   self.averageFuelPer100kmLabel = ac.addLabel(app, "averageFuelPer100km")
   self.instFuelLabel = ac.addLabel(app, "instFuel")
   
   ##set label positions
   
   ac.setPosition(self.remainingLabel, x, y)
   ac.setPosition(self.averageFuelPerLapLabel, x + 208, y)
   ac.setPosition(self.lapsLeftLabel, 150 - x, y)
   ac.setPosition(self.averageFuelPer100kmLabel, x + 208, y + 19)
   ac.setPosition(self.instFuelLabel, 150 - x, y + 19)
   
   ##set label alignments
   
   ac.setFontAlignment(self.remainingLabel, "left")
   ac.setFontAlignment(self.averageFuelPerLapLabel, "left")
   ac.setFontAlignment(self.lapsLeftLabel, "right")
   ac.setFontAlignment(self.averageFuelPer100kmLabel, "left")
   ac.setFontAlignment(self.instFuelLabel, "right")
   
   ##set font size
   
   ac.setFontSize(self.remainingLabel, 32)
   ac.setFontSize(self.averageFuelPerLapLabel, 16)
   ac.setFontSize(self.lapsLeftLabel, 16)
   ac.setFontSize(self.averageFuelPer100kmLabel, 16)
   ac.setFontSize(self.instFuelLabel, 16)
   
   if os.path.exists(self.inifilepath):
     f = open(self.inifilepath, "r")
     self.AverageFuelPerLap = float(f.readline()[6:])
     f.close()
   
   ac.setText(self.remainingLabel, "--- l")
   ac.setText(self.averageFuelPerLapLabel, "--- l/lap")
   ac.setText(self.lapsLeftLabel, "--- laps")
   if milesPerGallon:
     ac.setText(self.averageFuelPer100kmLabel, "--- mpg")
   else:
     ac.setText(self.averageFuelPer100kmLabel, "--- l/100km")
   ac.setText(self.instFuelLabel, "--- inst.")
Пример #2
0
 def pack(self):
     """
     Iterate over all labels and place them all *vertical_spacing* pixels
     :return:
     """
     for i, label in enumerate(self.labels.values(), start=1):
         ac.setPosition(label.label_id, 0, self.vertical_spacing * i)
Пример #3
0
def spinner_config(spinner, x, y, xl, yl, min, step, max, value, evt):
    ac.setPosition(spinner, x, y)
    ac.setSize(spinner, xl, yl)
    ac.setRange(spinner, min, max)
    ac.setStep(spinner, step)
    ac.setValue(spinner, value)
    ac.addOnValueChangeListener(spinner, evt)
Пример #4
0
    def pos(self, pos):
        _x, _y = pos
        if isinstance(_x, int) and isinstance(_y, int):
            self._pos = (_x, _y)

            if self.ac_obj != 0:
                ac.setPosition(self.ac_obj, _x, _y)
Пример #5
0
    def __init__(self, parent):
        self.ac_obj = 0
        self._parent = parent
        self._child = None
        self._callback = None
        self._pos = (0, 0)
        self._size = (0, 0)
        self._visible = True
        self._text = ""
        self._font_size = 10
        self._font_ratio = 0.5
        self._font_color = Color(1, 1, 1, 1)
        self._background_texture = 0
        self._background = False
        self._background_color = Color(0, 0, 0, 0)
        self._border = False
        self._border_color = Color(1, 1, 1, 1)

        if self._parent is not None:
            self._parent._child = self
            self.pos = self._parent.pos
            self.size = self._parent.size

        if self.ac_obj is not None:
            ac.setPosition(self.ac_obj, self._pos[0], self._pos[1])
Пример #6
0
    def __init__(self, acd, configs):
        """ Default constructor. """
        self.__active = False
        self.__data = Data()
        self.__data_log = []
        self.__info = info
        self.__options = {
            "Logging": configs.get_bool_option("Logging"),
            "RPMPower": configs.get_bool_option("RPMPower")
        }
        self.__window_id = ac.newApp("Live Telemetry Engine")
        ac.drawBorder(self.__window_id, 0)
        ac.setBackgroundOpacity(self.__window_id, 0.0)
        ac.setIconPosition(self.__window_id, 0, -10000)
        ac.setTitle(self.__window_id, "")

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

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

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

        # Only starts to draw after the setup.
        self.set_active(configs.is_window_active("EN"))
Пример #7
0
    def position(self, position: tuple):
        self._position.set(position[0], position[1])

        if self.has_id and len(position) == 2:
            ac.setPosition(self.id, position[0], position[1])

            self.fire(ACWidget.EVENT.POSITION_CHANGED, self)
Пример #8
0
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"
Пример #9
0
def acMain(ac_version):
    global l_velocity, f
    time.strftime('%Y-%m-%d %H:%M:%S')
    app_name = "SAE Dummy Data Generator"
    app_window = ac.newApp(app_name)
    ac.setSize(app_window, 200, 200)

    l_velocity = ac.addLabel(app_window, "Velocity: --")
    ac.setPosition(l_velocity, 3, 30)
    
    f = open('apps\python\SAE\dummydata.txt', 'w')
    f.write('INSERT INTO SensorData (CanId, Data, UTCTimestamp) VALUES')
    
    # ac.console("CONNECTING TO DATABASE...")
    # connection = connector.connect(
    #    host="ts20.billydasdev.com",
    #    user="******",
    #    passwd="ts20",
    #    port="3306",
    #    db="ts20"
    # )
    # cursor = connection.cursor(prepared=True)
    # ac.console("CONNECTED!")

    return app_name
Пример #10
0
    def set_position(self, position):
        """Set label position.

        Args:
            position (obj:Point): Point object with x,y coords.
        """
        ac.setPosition(self.id, position.x, position.y)
Пример #11
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
Пример #12
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
Пример #13
0
def acMain(acVerison):
    global serPort, tick, appWindow, statusLabel

    try:
        ac.log("opening serial port {}".format(serialPortName))

        tick = ticker(
        )  # class below: keeps track of game tick rate and can be used to update over serial less frequently

        serPort = serial.Serial(port=serialPortName, baudrate=9600, timeout=0)
        time.sleep(3)
        serPort.write("0 0 \n".encode())

        appWindow = ac.newApp("vr-wind")
        ac.setSize(appWindow, 200, 200)

        statusLabel = ac.addLabel(appWindow, "Output: none yet")
        ac.setPosition(statusLabel, 5, 32)

        ac.log("vr-wind ready")

        return "vr-wind"

    except Exception as e:
        ac.log("startup error: {}".format(e))
Пример #14
0
def onChatMessage(message, author) :
    global messages, lines, maxLines, currentText

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

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

            ac.setText(lines[maxLines-1-i][1], msg[1])
            ac.setSize(lines[maxLines-1-i][0], n_width, 14*1.4)
            ac.setSize(lines[maxLines-1-i][1], m_width, 14*1.4)
            if msg[0].strip().find(driver) > -1:
                ac.setFontColor(lines[maxLines-1-i][0], 0, 1, 0, 1)
            else:
                ac.setFontColor(lines[maxLines-1-i][0], random.random(), random.random(), random.random(), 1)
            ac.setFontColor(lines[maxLines-1-i][1], 1, 1, 1, 1)
            ac.setVisible(lines[maxLines-1-i][0], 1)
            ac.setVisible(lines[maxLines-1-i][1], 1)
            ac.setPosition(lines[maxLines-1-i][0], 0, ac.getPosition(lines[maxLines-1-i][0])[1])
            ac.setFontAlignment(lines[maxLines-1-i][0], "left")
            ac.setPosition(lines[maxLines-1-i][1], n_width+5, ac.getPosition(lines[maxLines-1-i][1])[1])
            ac.setFontAlignment(lines[maxLines-1-i][1], "left")
            ac.setText(lines[maxLines-1-i][0], msg[0]+":")
Пример #15
0
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 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"
Пример #17
0
def getDriverInformation(detectionArea):
    global labelStorage, appPosX, appPosY, spinner_y_offset, fov_setting
    triangle = Triangle(detectionArea[0], detectionArea[1], detectionArea[2])
    setLabel = 0
    for x in range(ac.getCarsCount()):
        posX, posZ, posY = ac.getCarState(x, acsys.CS.WorldPosition)
        if triangle.isInside((posX, posY)) and x != 0:
            vect_x = posX - detectionArea[0][0]
            vect_y = posY - detectionArea[0][1]
            distance = math.sqrt(math.pow(vect_x, 2) + math.pow(vect_y, 2))
            newPosition = getRenderPosition(x, detectionArea, (posX, posY))
            ac.setText(labelStorage[setLabel], ac.getDriverName(x))
            fov_angle = ac.getValue(fov_setting)
            xPos = (((newPosition * windowSizeX) / fov_angle) - appPosX)
            yOffset = ac.getValue(spinner_y_offset)
            yPos = (((windowSizeY / 2) - 20) - appPosY) + int(yOffset)
            fontSize = (10 *
                        (1 /
                         (distance / 100))) * (ac.getValue(scale_factor) / 10)
            ac.setPosition(labelStorage[setLabel], xPos, yPos)
            ac.setFontSize(labelStorage[setLabel], fontSize)
            setLabel += 1

    for z in range(ac.getCarsCount() - setLabel):
        ac.setText(labelStorage[setLabel + z], "")
Пример #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
	def setX(self, x, animated=False):
		self.f_params["x"].setValue(x)
		if not animated:
			self.o_params["x"].setValue(x)
			self.params["x"].setValue(x)
			if self.params["x"].hasChanged():
				ac.setPosition(self.label, self.params["x"].value, self.params["y"].value)
		return self
def spinnerConfig(spinner, spin_pos_x, spin_pos_y, spin_size_x, spin_size_y, spin_val_min, spin_val_step, spin_val_max, spin_value, spin_event, vis_value):
    ac.setPosition(spinner, spin_pos_x, spin_pos_y)
    ac.setSize(spinner, spin_size_x, spin_size_y)
    ac.setRange(spinner, spin_val_min, spin_val_max)
    ac.setStep(spinner, spin_val_step)
    ac.setValue(spinner, spin_value)
    ac.addOnValueChangeListener(spinner, spin_event)
    ac.setVisible(spinner, vis_value)
Пример #21
0
    def addImage(self, texture, options):
        options.x = options.x | 0
        options.y = options.y | 0
        options.width = options.width | 100
        options.height = options.height | 100

        item = ac.addLabel(self.appWindow, "")
        ac.setPosition(item, self.x + options.x * self.scale, self.y + options.y * self.scale)
	    ac.setSize(item, options.width * self.scale, options.height * self.scale)
Пример #22
0
 def initGraph(widgetWidth, widgetHeight):
     posY = 250
     self.graph = ac.addGraph(self.window, "")
     ac.setPosition(self.graph, 0, posY)
     ac.setSize(self.graph, widgetWidth, widgetHeight-posY) # enlarge graph till the bottom end of the widget
     ac.addSerieToGraph(self.graph, 0,0,1) # instant framerate
     ac.addSerieToGraph(self.graph, 1,0,0) # short running avg
     ac.addSerieToGraph(self.graph, 0,1,0) # long running avg
     return 3 #amount of series
Пример #23
0
	def __init__(self, parent, text, size, posx, posy, font, align):
		self.lbl = ac.addLabel(parent, str(text))
		ac.setPosition(self.lbl, posx, posy)
		if size:
			ac.setFontSize(self.lbl, size)
		if font:
			ac.setCustomFont(self.lbl, font, 0, 0)
		if align:
			ac.setFontAlignment(self.lbl, align)
Пример #24
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)
Пример #25
0
	def animate(self):
		#adjust size +1
		self.adjustParam("w").adjustParam("h")		
		#adjust position +3
		self.adjustParam("x").adjustParam("y")	
		#adjust background
		self.adjustParam("br").adjustParam("bg").adjustParam("bb").adjustParam("o")		
		#adjust colors + 0.02
		self.adjustParam("r").adjustParam("g").adjustParam("b").adjustParam("a")
			
		#commit changes
		if self.params["x"].hasChanged() or self.params["y"].hasChanged():
			ac.setPosition(self.label, self.params["x"].value, self.params["y"].value)
		if self.params["w"].hasChanged() or self.params["h"].hasChanged():
			ac.setSize(self.label, self.params["w"].value, self.params["h"].value)
			if self.params["h"].value == 0:
				self.isVisible.setValue(False)
			else:
				self.isVisible.setValue(True)
		if self.params["br"].hasChanged() or self.params["bg"].hasChanged() or self.params["bb"].hasChanged():
			ac.setBackgroundColor(self.label, self.params["br"].value, self.params["bg"].value, self.params["bb"].value)			
			if self.f_params["o"].value > 0:			
				ac.setBackgroundOpacity(self.label, self.params["o"].value)
		if self.params["o"].hasChanged():	
			if self.params["o"].value == 0:
				self.isVisible.setValue(False)
			else:
				self.isVisible.setValue(True)
			changed=self.isVisible.hasChanged()
			if changed and self.params["o"].value > 0:
				self.setVisible(1)  
			elif changed:
				self.setVisible(0)
			#fg opacity
			ac.setBackgroundOpacity(self.label, self.params["o"].value)
			if self.params["o"].value >= 0.4 :
				self.isTextVisible.setValue(True)
			else:
				self.isTextVisible.setValue(False)
			if self.isTextVisible.hasChanged():
				if self.isTextVisible.value:
					ac.setText(self.label, self.text)
				else:
					ac.setText(self.label, "")
					
		if self.params["r"].hasChanged() or self.params["g"].hasChanged() or self.params["b"].hasChanged() or self.params["a"].hasChanged():
			ac.setFontColor(self.label, self.params["r"].value, self.params["g"].value, self.params["b"].value, self.params["a"].value)				
			if self.params["a"].value == 0:
				self.isVisible.setValue(False)
			else:
				self.isVisible.setValue(True)
			changed=self.isVisible.hasChanged()
			if changed and self.params["a"].value > 0:
				self.setVisible(1)  
			elif changed:
				self.setVisible(0)
Пример #26
0
def spinnerConfig(spinner, spin_pos_x, spin_pos_y, spin_size_x, spin_size_y,
                  spin_val_min, spin_val_step, spin_val_max, spin_value,
                  spin_event, vis_value):
    ac.setPosition(spinner, spin_pos_x, spin_pos_y)
    ac.setSize(spinner, spin_size_x, spin_size_y)
    ac.setRange(spinner, spin_val_min, spin_val_max)
    ac.setStep(spinner, spin_val_step)
    ac.setValue(spinner, spin_value)
    ac.addOnValueChangeListener(spinner, spin_event)
    ac.setVisible(spinner, vis_value)
Пример #27
0
 def mark_in(self):
     if not self.out: return
     self.out = False
     if LeaderboardRow.update_type == INFO_TYPE.POSITIONS:
         ac.setVisible(self.positionChangeLabel, 1)
     ac.setVisible(self.positionLabel, 1)
     ac.setPosition(self.teamLabel, self.px + 47, self.py + 2)
     ac.setPosition(self.nameLabel, self.px + 65, self.py + 4)
     ac.setFontColor(self.nameLabel, 0.86, 0.86, 0.86, 1)
     ac.setFontColor(self.infoLabel, 0.86, 0.86, 0.86, 1)
Пример #28
0
 def mark_out(self):
     if self.out: return
     self.out = True
     ac.setVisible(self.positionLabel, 0)
     ac.setVisible(self.positionChangeLabel, 0)
     ac.setPosition(self.teamLabel, self.px + 12, self.py + 2)
     ac.setPosition(self.nameLabel, self.px + 30, self.py + 4)
     ac.setFontColor(self.nameLabel, .58, .53, .53, 1)
     ac.setText(self.infoLabel, "OUT")
     ac.setFontColor(self.infoLabel, .58, .53, .53, 1)
Пример #29
0
def createLabel(name, text, x, y, font_size = 14, align = "center"):
    global mainApp

    label = ac.addLabel(mainApp, name)
    ac.setText(label, text)
    ac.setPosition(label, x, y)
    ac.setFontSize(label, font_size)
    ac.setFontAlignment(label, align)

    return label
Пример #30
0
def createApp(label):
    app = ac.newApp(label)
    ac.setTitle(app, "")
    ac.setIconPosition(app, 0, -10000)
    ac.setSize(app, 100, 50)
    ac.drawBorder(app, 0)

    label = ac.addLabel(app, "")
    ac.setPosition(label, 10, 5)
    return app, label
Пример #31
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"
Пример #32
0
 def setupButtons(self):
     ac.setSize(self.btn1, 165, 26)
     ac.setSize(self.btn2 , 165, 26)
     ac.setFontSize(self.btn1, 18)
     ac.setFontSize(self.btn2 , 18)
     ac.setFontAlignment(self.btn1, "center")
     ac.setFontAlignment(self.btn2, "center")
     ac.setPosition(self.btn1, 1  , 398)
     ac.setPosition(self.btn2 , 168, 398)
     ac.addOnClickedListener(self.btn1, btn1_clicked)
     ac.addOnClickedListener(self.btn2 , btn2_clicked)
Пример #33
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)
Пример #34
0
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"
Пример #35
0
    def position(self, position: tuple):
        self._position.set(position[0], position[1])

        if self.has_id and len(position) == 2:
            if hasattr(self, '_v_offset'):
                ac.setPosition(self.id, position[0],
                               position[1] + self._v_offset)
            else:
                ac.setPosition(self.id, position[0], position[1])

            self.fire(ACWidget.EVENT.POSITION_CHANGED, self)
Пример #36
0
 def __init__(self):
     self.window = Window(name="ACTV Delta", icon=False, width=240, height=184, texture="")
     self.cursor = Value(False)
     self.session = Value(-1)
     self.performance = Value(0)
     self.spline = Value(0)
     self.laptime = Value(0)
     self.TimeLeftUpdate = Value(0)
     self.referenceLap = []
     self.referenceLapTime = Value(0)
     self.lastLapTime = Value(0)
     self.lapCount = 0
     self.lastLapIsValid = True
     self.currentLap = []
     self.deltaLoaded = False
     self.thread_save = False
     self.highlight_end = 0
     self.rowHeight = Value(-1)
     self.lbl_delta = (
         Label(self.window.app, "+0.000")
         .setSize(150, 36)
         .setPos(0, 60)
         .setFontSize(26)
         .setAlign("right")
         .setVisible(1)
     )
     self.lbl_lap = (
         Label(self.window.app, "0.000")
         .setSize(150, 32)
         .setPos(0, 86)
         .setFontSize(17)
         .setAlign("right")
         .setVisible(1)
     )
     self.btn_reset = (
         Button(self.window.app, self.onResetPress)
         .setPos(90, 68)
         .setSize(60, 20)
         .setText("Reset")
         .setAlign("center")
         .setBgColor(rgb([255, 12, 12], bg=True))
         .setVisible(0)
     )
     self.spin_row_height = ac.addSpinner(self.window.app, "")
     ac.setRange(self.spin_row_height, 20, 48)
     ac.setPosition(self.spin_row_height, 20, 28)
     ac.setValue(self.spin_row_height, self.__class__.ui_row_height)
     ac.addOnValueChangeListener(self.spin_row_height, self.onSpinRowHeightChanged)
     ac.setVisible(self.spin_row_height, 0)
     fontName = "Segoe UI"
     if ac.initFont(0, fontName, 0, 0) > 0:
         self.lbl_delta.setFont(fontName, 0, 1)
     self.cfg = Config("apps/python/prunn/", "config.ini")
     self.loadCFG()
Пример #37
0
def acMain(ac_version):
    global l_lapcount, l_speed, appWindow, l_tspeed_session, l_tspeed_llap, l_tspeed_clap, tick
    
    tick=ticker() #set the global variable to be a ticker, see the class below
    ac.setSize(appWindow, 250, 200)

    ac.setPosition(l_lapcount, 3, 30)
    ac.setPosition(l_speed, 3, 60)
    ac.setPosition(l_tspeed_session, 3, 80)
    ac.setPosition(l_tspeed_llap, 3, 100)
    ac.setPosition(l_tspeed_clap, 3, 120)
    return "Mongoose"
Пример #38
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
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"
Пример #40
0
    def __init__(self, app):
        global appWindow

        appWindow = app

        self.button = ac.addButton(appWindow, 'Start Countdown')
        self.btnEvent = functools.partial(self.onClick, msg='Countdown started')

        ac.setPosition(self.button, 1, 35)
        ac.setSize(self.button, 175, 25)

        ac.addOnClickedListener(self.button, self.btnEvent)
Пример #41
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
	def __init__(self, app, name, x, y):
		global space
		self.temp = 1
		self.xPosition = x
		self.yPosition = y
		self.name = name
		
		# create a label using the tyre name and a placeholder for the associated temperature
		self.labelTemperature = ac.addLabel(app, self.name + ":")
		ac.setPosition(self.labelTemperature, self.xPosition, self.yPosition)
		self.labelTemperatureValue = ac.addLabel(app, str(self.temp))
		ac.setPosition(self.labelTemperatureValue, self.xPosition + space, self.yPosition)
Пример #43
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"
Пример #44
0
def acUpdate(deltaT):
    global appWindow, windowOpacity, appPosX, appPosY, labelStorage, show_name
    if show_name == 1:
        appPosX, appPosY = ac.getPosition(appWindow)
        ac.setBackgroundOpacity(appWindow, windowOpacity)
        detectionArea = getDetectionArea()
        #ac.console(detectionArea)
        getDriverInformation(detectionArea)
    else:
        for x in range(ac.getCarsCount()):
            ac.setPosition(labelStorage[x], 0, 0)
            ac.setText(labelStorage[x], "")
Пример #45
0
def acMain(ac_version):
    global l_lapcount, b_benzina


    appWindow = ac.newApp("benza")
    ac.setSize(appWindow, 200, 200)

    ac.log("Benza Start")
    ac.console("Benza is running")

    l_lapcount = ac.addLabel(appWindow, "Laps: 0");
    b_benzina  = ac.addLabel(appWindow, "Fuel: 0");

    ac.setPosition(l_lapcount, 3, 30)

    return "benza"
Пример #46
0
def acMain(ac_version):

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

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

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

	return "brake"
Пример #47
0
  def add(self, text, x1, x2, x3):
    single_column = not any((x2, x3))

    for column_number, col in enumerate((x1, x2, x3)):
      if col is None:
        continue
      if not hasattr(self.data, col):
        setattr(self.data, col, ac.addLabel(self.window_id, ""))
      ident = getattr(self.data, col)
      ac.setPosition(ident, column_number * 100, self._next_line)
      width = 300 if single_column else 100
      ac.setSize(ident, width, self._line_size)
      ac.setFontSize(ident, self._font_size)
      if not single_column:
        ac.setFontAlignment(ident, 'right')
      ac.setFontColor(ident, 1.0, 1.0, 1.0, 1.0)

    self._next_line += self._line_size
    self.set(x1, text)
  def reinitialize_app(self):

    # Initialize all 'data' fields we use.
    if not hasattr(self.data, 'frame_count'):
      self.data.frame_count = 0

    # Only create the text label once.
    if not hasattr(self.data, 'banner'):
      self.data.banner = ac.addLabel(self.data.app_id, '')

    # But set the size and positioning every time the app is hot reloaded.
    ac.setPosition(self.data.banner, 0, 0)  # X, Y relative to main app window
    ac.setSize(self.data.banner, config.LABEL_WIDTH, config.LABEL_HEIGHT)

    ac.setFontAlignment(self.data.banner, 'center')
    ac.setFontSize(self.data.banner, config.FONT_SIZE)
    ac.setFontColor(self.data.banner, 0.945, 0.933, 0.102, 1.0) # yellow

    ac.setText(self.data.banner, '')
Пример #49
0
def create_debug_labels():
    global flLabel, frLabel, rlLabel, rrLabel, upperDistance, distanceFromLeft, tyreWidth, tyreHeight, angle_delta_label
    flLabel = ac.addLabel(appWindow, "0.0")
    ac.setPosition(flLabel, distanceFromLeft, upperDistance + tyreHeight)
    ac.setFontAlignment(flLabel, "right")

    frLabel = ac.addLabel(appWindow, "0.0")
    ac.setPosition(frLabel, distanceFromLeft + tyreWidth + tyreWidth, upperDistance + tyreHeight)
    ac.setFontAlignment(frLabel, "left")

    rlLabel = ac.addLabel(appWindow, "0.0")
    ac.setPosition(rlLabel, distanceFromLeft, upperDistance + tyreHeight * 2 + tyreHeight)
    ac.setFontAlignment(rlLabel, "right")

    rrLabel = ac.addLabel(appWindow, "0.0")
    ac.setPosition(rrLabel, distanceFromLeft + tyreWidth + tyreWidth, upperDistance + tyreHeight * 2 + tyreHeight)
    ac.setFontAlignment(rrLabel, "left")

    angle_delta_label = ac.addLabel(appWindow, "0.0")
    ac.setPosition(angle_delta_label, 0, upperDistance + tyreHeight * 3 + 50)
Пример #50
0
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"
Пример #52
0
def acMain(ac_version):
    global appWindow, trackname, tracklength, l_lapcount, l_distance, l_fuel, conn, c

    appWindow = ac.newApp("acOdometer")
    ac.setSize(appWindow, 142, 142)

    l_lapcount = ac.addLabel(appWindow, "Laps: Outlap")
    ac.setPosition(l_lapcount, 3, 30)
    l_distance = ac.addLabel(appWindow, "Kilometers: Outlap")
    ac.setPosition(l_distance, 3, 45)
    l_fuel = ac.addLabel(appWindow, "Fuel used: 0")
    ac.setPosition(l_fuel, 3, 60)

    trackname = ac.getTrackName(0)
    carname = ac.getCarName(0)
    t = int(time.time())
    c.execute("INSERT INTO session('date', 'track', 'car') values (?, ?, ?)", (t, trackname, carname)) # Commited atomically at end of session
    ac.log("*************************** NEW SESSION\n********* " + trackname)
    ac.log("acOdometer loaded, racing {} which has {:.3f} miles per lap".format(trackname, tracklength[trackname]))
    ac.console("acOdometer loaded, racing {} which has {:.3f} kilometers per lap.".format(trackname, tracklength[trackname]))
    return "acOdometer"
 def setPos(self, x, y):
     ac.setPosition(self.button, x, y)
     return self
 def __init__(self, window, text, xPos, yPos):
     self.label = ac.addLabel(window, text)
     ac.setPosition(self.label, xPos, yPos)
 def setPos(self, x, y):
     ac.setPosition(self.app, x, y)
     return self
 def setPos(self, x, y):
     ac.setPosition(self.spinner, x, y)
     return self
Пример #57
0
    def __init__(self, name, headerName, fontSize, showHeader):
        self.headerName = headerName
        self.window = ac.newApp(name)
        if showHeader == 1:
            ac.setTitle(self.window, "")
            ac.setIconPosition(self.window, -10000, -10000)
            self.firstSpacing = 0
        else:
            ac.setTitle(self.window, headerName)
            self.firstSpacing = firstSpacing

        self.fontSize = fontSize

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

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

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

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

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

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

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

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

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

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

        rowIndex += 1

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

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

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

        rowIndex += 1

        ac.setText(self.leftLabel[rowIndex], "Lock best:")
        ac.addOnClickedListener(self.changeButton[rowIndex], toggleLockBest)
        ac.setVisible(self.plusButton[rowIndex], 0)
        ac.setVisible(self.minusButton[rowIndex], 0)
        self.lockBestId = rowIndex