Exemplo n.º 1
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
Exemplo n.º 2
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())
Exemplo n.º 3
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
Exemplo n.º 4
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
Exemplo n.º 5
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))
Exemplo n.º 6
0
def acMain(ac_version):
    global DRIVER, TRACK, CAR, WINDOW, LAP_LABELS, LAP_VALID_INDICATOR

    DRIVER = ac.getDriverName(DRIVER_ID_SELF)
    TRACK = '%s-%s' % (ac.getTrackName(DRIVER_ID_SELF),
                       ac.getTrackConfiguration(DRIVER_ID_SELF))
    CAR = ac.getCarName(DRIVER_ID_SELF)

    ac.console('Initialize %s: driver %s on %s in %s' %
               (NAME, DRIVER, TRACK, CAR))

    WINDOW = ac.newApp(NAME)
    ac.setSize(WINDOW, *SIZE)
    ac.setTitle(NAME)

    if ac.addOnAppActivatedListener(WINDOW, onActivate) == -1:
        ac.console('Failed to add listener activate')
    if ac.addOnAppDismissedListener(WINDOW, onDeactivate) == -1:
        ac.console('Failed to add listener deactivate')

    i = 0
    while i < LAP_COUNT:
        label = ac.addLabel(WINDOW, 'Waiting for lap time...')
        LAP_LABELS.append(label)
        i += 1
    LAP_VALID_INDICATOR = ac.addLabel(WINDOW, 'Clean')
    refreshLapDisplay()

    return NAME
Exemplo n.º 7
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"
  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)
Exemplo n.º 9
0
def acMain(ac_version):

    global appwindow, speed_meters_s, angular_vel, gas_brake_clutch_handbrake, steer_pos, lap_invalidated, current_lap, last_lap, performance_meter

    appWindow = ac.newApp("TensorTrainer")
    ac.setSize(appWindow, 200, 200)
    speed_meters_s = ac.addLabel(appWindow, "Speed(M/s): 0")
    angular_vel = ac.addLabel(appWindow, "Ang.Vel.: 0")
    gas_brake_clutch_handbrake = ac.addLabel(appWindow, "GBCH: 0000")
    steer_pos = ac.addLabel(appWindow, "Steer: 0")
    lap_invalidated = ac.addLabel(appWindow, "LapValid: Yes")
    current_lap = ac.addLabel(appWindow, "Current: 0")
    last_lap = ac.addLabel(appWindow, "Last: 0")
    performance_meter = ac.addLabel(appWindow, "Perf: 0")

    ac.setPosition(speed_meters_s, 3, 30)
    ac.setPosition(angular_vel, 3, 45)
    ac.setPosition(gas_brake_clutch_handbrake, 3, 60)
    ac.setPosition(steer_pos, 3, 75)
    ac.setPosition(lap_invalidated, 3, 90)
    ac.setPosition(current_lap, 3, 105)
    ac.setPosition(last_lap, 3, 120)
    ac.setPosition(performance_meter, 3, 135)

    return "TensorTrainer"
Exemplo n.º 10
0
	def __init__(self, name="defaultAppWindow", title="", icon=True, width=100, height=100, scale=1, texture=""):
		# local variables
		self.name        = name
		self.title       = title
		self.width       = width
		self.height      = height
		self.x           = 0
		self.y           = 0
		self.is_attached = False
		self.attached_l  = -1
		self.attached_r  = -1
		
		# creating the app window
		self.app = ac.newApp(self.name)
		
		# default settings
		ac.drawBorder(self.app, 0)
		ac.setBackgroundOpacity(self.app, 0)
		if icon is False:
			ac.setIconPosition(self.app, 0, -10000)
		
		# applying settings
		ac.setTitle(self.app, self.title)
		ac.setBackgroundTexture(self.app, texture)
		ac.setSize(self.app, math.floor(self.width*scale), math.floor(self.height*scale))
Exemplo n.º 11
0
Arquivo: nChat.py Projeto: nuggs/nChat
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]+":")
Exemplo n.º 12
0
    def size(self, size: tuple):
        self._size.set(size[0], size[1])

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

            self.fire(ACWidget.EVENT.SIZE_CHANGED, self)
Exemplo n.º 13
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)
Exemplo n.º 14
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"))
Exemplo n.º 15
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)
Exemplo n.º 16
0
def acMain(ac_version):
    """Main function that is invoked by Assetto Corsa."""
    global NOTIFICATION, LAPTIME_LABELS
    app = ac.newApp("AC-Ranking")
    ac.setSize(app, 400, 300)
    NOTIFICATION = ac.addLabel(app, '')
    ac.setPosition(NOTIFICATION, 15, 20)
    ac.setSize(NOTIFICATION, 190, 20)

    auth = read_auth()
    validate_token(auth['user'], auth['token'])

    validate_token_button = ac.addButton(app, 'Validate token')
    ac.setPosition(validate_token_button, 20, 40)
    ac.setSize(validate_token_button, 120, 20)
    ac.addOnClickedListener(validate_token_button, validate_token_button_func)

    refresh_button = ac.addButton(app, '\u21BB')
    ac.setPosition(refresh_button, 300, 5)
    ac.setSize(refresh_button, 15, 18)
    ac.addOnClickedListener(refresh_button, refresh_button_func)

    LAPTIME_LABELS = tuple(ac.addLabel(app, '#' + str(i)) for i in range(10))
    for index, label in enumerate(LAPTIME_LABELS):
        ac.setSize(label, 120, 20)
        ac.setPosition(label, 200, (index * 20) + 50)
    get_laptimes(ac.getCarName(0), ac.getTrackName(0),
                 ac.getTrackConfiguration(0) or None)
    return "ACR"
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"
Exemplo n.º 18
0
    def __init__(self, cfg):
        # Config data
        self.cfg = cfg

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

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

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

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

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

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

        # Initialize empty list of drawable objects.
        self.drawables = []
Exemplo n.º 19
0
def acMain(ac_version):
    global appWindow

    appWindow = ac.newApp("nCountdown")
    ac.setSize(appWindow, 177, 60)
    nButton = nCountdown(appWindow)

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

        return 'hot_app'
def 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)
  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'
Exemplo n.º 23
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()
Exemplo n.º 24
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
Exemplo n.º 25
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)
Exemplo n.º 26
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()
Exemplo n.º 27
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)
Exemplo n.º 28
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
Exemplo n.º 29
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)
Exemplo n.º 30
0
def acMain(ac_version):
    global appWindow
    
    appWindow = ac.newApp("Analog Speedometer")
    ac.setTitle(appWindow, "")
    ac.setIconPosition(appWindow, 0, -10000)
    ac.setSize(appWindow, width, height)
    ac.drawBorder(appWindow, 0)

    ac.addRenderCallback(appWindow, drawNeedle)
Exemplo n.º 31
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"
Exemplo n.º 32
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"
Exemplo n.º 33
0
	def setSize(self, w, h, animated=False):
		self.f_params["w"].setValue(w)
		self.f_params["h"].setValue(h)
		if not animated:
			self.o_params["w"].setValue(w)
			self.o_params["h"].setValue(h)
			self.params["w"].setValue(w)
			self.params["h"].setValue(h)
			if self.params["w"].hasChanged() or self.params["h"].hasChanged():
				ac.setSize(self.label, self.params["w"].value, self.params["h"].value)
		return self
Exemplo n.º 34
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)
Exemplo n.º 35
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)
Exemplo n.º 36
0
Arquivo: Time.py Projeto: Djudjou/Time
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"
Exemplo n.º 37
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"
Exemplo n.º 38
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)
Exemplo n.º 39
0
def acMain(ac_version):
    global server
    try:
        appWindow = ac.newApp(APP_NAME)
        ac.setSize(appWindow, 200, 200)
        server = socketserver.UDPServer(('localhost', 18149), UDPServer)
        threading.Thread(target=server.serve_forever).start()
        setupUI(appWindow)
        log("Startup Complete")
    except Exception as e:
        log("ERROR:  {}".format(e))
    return APP_NAME
Exemplo n.º 40
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"
Exemplo n.º 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 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"
Exemplo n.º 43
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
Exemplo n.º 44
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"
Exemplo n.º 45
0
def acMain(ac_version):
    global appWindow, ser, compData
    appWindow=ac.newApp("joeStuff")
    ac.setSize(appWindow,400,400)
    ac.console("addonLoad----OK")    
    ac.console("serialConn---"+str(ser.connect()))
    
    for x in range(0, 4):
        ac.console(names[x]+ " "+ str(values[names[x]]))
        nData = wrData(appWindow,names[x], 0, (x *100) + 40, values[names[x]])
        compData.append(nData)
    ser.sendData([32767, 32767, 32767, 32767, 32767, 32767])
    return "bsComm"
Exemplo n.º 46
0
 def __init__(self, name, tyre=None, render_function=None):
     self.window = ac.newApp(name)
     self.tyre = tyre
     ac.setIconPosition(self.window, 9999999, 99999999)  # hide the icon
     ac.setSize(self.window, TyreWindow.width, TyreWindow.height)
     self.opt_label = ac.addLabel(self.window, "Opt:")
     ac.setPosition(self.opt_label, 5, 50)
     self.slip_label = ac.addLabel(self.window, "Slip:\nSkid:")
     ac.setPosition(self.slip_label, 5, 70)
     self.starting_label_no = ac.addLabel(self.window, "")
     ac.addRenderCallback(self.window, render_function)
     ac.setFontSize(self.starting_label_no, 25)
     ac.setPosition(self.starting_label_no, 35, 20)
Exemplo n.º 47
0
def acMain(ac_version):
    # При запуске приложения создаётся небольшое окно и выполняется инициализация.
    global label, leaderboard  #, httpThread
    name = "ACTimingDataSender"
    appWindow = ac.newApp(name)
    ac.setSize(appWindow, 200, 70)
    label = ac.addLabel(appWindow, "Label here")
    ac.setPosition(label, 3, 30)
    postLogMessage("ACTiming HTTP plugin OK")
    leaderboard = Leaderboard()
    postLogMessage("Leaderboard created")
    postLogMessage("Running directory: " + __file__)
    return name  # Возвращается имя приложения - требование AC
def init():
    """Add the info window/app."""
    global info_telemetry
    window_info = ac.newApp("Info")
    ac.setSize(window_info, 160, 205)
    ac.addRenderCallback(window_info, render_app)

    info_telemetry = TelemetryProvider()
    compound_label = CompoundLabel(info_telemetry)
    optimum_temps_label = OptimumTempsLabel(info_telemetry)
    abs_label = ABSLabel(info_telemetry)
    tc_label = TractionControlLabel(info_telemetry)

    lateral_force_label = LateralForceLabel(info_telemetry)
    transverse_force_label = TransverseForceLabel(info_telemetry)

    drs_image_label = DRSImageLabel(info_telemetry)
    abs_image_label = ABSImageLabel(info_telemetry)
    tc_image_label = TCImageLabel(info_telemetry)

    background_label = BackgroundLabel()

    for label in (compound_label, optimum_temps_label, abs_label, tc_label,
                  lateral_force_label, transverse_force_label, drs_image_label,
                  abs_image_label, tc_image_label, background_label):
        label.window = window_info

    # Prepei na mpei teleytaio gia na fortwnei meta to prasino eikonidio gia na
    # kratietai to diafano...
    car_name = ac.getCarName(0)
    car_upgrade = ''
    if car_name.endswith(('_s1', '_s2', '_s3', '_drift', '_dtm')):
        car_upgrade = car_name.split('_')[-1]
    car_upgrade_img_path = os.path.join(
        APP_DIR, "Images/Info{}.png".format(car_upgrade or 'STD'))
    background_label.bg_texture = car_upgrade_img_path

    image_arrow_left = LeftLateralForceImage(
        info_telemetry, pos_x=131, pos_y=147, width=20, height=20,
        color=(1, 1, 0, 1), filename='arrowLeft.png')
    image_arrow_right = RightLateralForceImage(
        info_telemetry, pos_x=132, pos_y=147, width=20, height=20,
        color=(1, 1, 0, 1), filename='arrowRight.png')
    image_arrow_up = PositiveTransverseForceImage(
        info_telemetry, pos_x=104, pos_y=119, width=20, height=20,
        color=(1, 1, 0, 1), filename='arrowUp.png')
    image_arrow_down = NegativeTransverseForceImage(
        info_telemetry, pos_x=104, pos_y=120, width=20, height=20,
        color=(1, 1, 0, 1), filename='arrowDown.png')
Exemplo n.º 49
0
def acMain(ac_version):
  global appWindow,sharedMem

  appWindow = ac.newApp("CrewChiefEx")

  ac.setTitle(appWindow, "CrewChiefEx")
  ac.setSize(appWindow, 300, 40)

  ac.log("CrewChief Was Here! damage report ?")
  ac.console("CrewChief Was Here! damage report ?")

  sharedmem = sharedMem.getsharedmem()
  sharedmem.serverName = ac.getServerName().encode('utf-8')

  return "CrewChiefEx"
Exemplo n.º 50
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"
Exemplo n.º 51
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, '')
Exemplo n.º 53
0
def acMain(ac_version):
    try:
        global appHeight, appWidth, appWindow, flLabel, frLabel, rlLabel, rrLabel, upperDistance, distanceFromLeft, tyreWidth, tyreHeight
        distanceFromLeft = tyreWidth * 3
        upperDistance = distanceFromLeft
        appWindow = ac.newApp("Traction Loss")
        appWidth = distanceFromLeft * 2 + tyreWidth * 3
        appHeight = upperDistance * 2 + tyreHeight * 3
        ac.setSize(appWindow, appWidth, appHeight)
        define_tachometer()
        if debug:
            create_debug_labels()

        #ac.drawBorder(appWindow, 0)
        ac.addRenderCallback(appWindow, on_update)

        return "Traction Loss"
    except Exception as e:
        ac.console("TractionLoss: Error in function acMain(): %s" % e)
        ac.log("TractionLoss: Error in function acMain(): %s" % e)
Exemplo n.º 54
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"
Exemplo n.º 55
0
def acMain(ac_version):
    global tracking

    app = ac.newApp("MhwkRacingAssettoApp")
    ac.setTitle(app, 'MHWK racing')
    ac.setSize(app, 300, 200)
    ac.addOnAppActivatedListener(app, on_app_activated)
    ac.addOnAppDismissedListener(app, on_app_dismissed)

    tracking = track.TrackerManager()
    tracking.track('OnNewSession', track.OnNewSession())
    tracking.track('OnNewLap', track.OnNewLap())
    tracking.track('OnNewSector', track.OnNewSector())

    gateway = LoggingGateway(HttpGateway('racing.mhwk.nl'))

    tracking.listen('OnNewSession', dispatch.StartLapDispatcher(gateway))
    tracking.listen('OnNewLap', dispatch.CompleteLapDispatcher(gateway))
    tracking.listen('OnNewSector', dispatch.CompleteSectorDispatcher(gateway))

    return "MhwkRacingAssettoApp"
def 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"
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"
Exemplo n.º 58
0
Arquivo: nChat.py Projeto: 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"