def background_texture(self, tex): if isinstance(tex, str): self._background_texture = ac.newTexture(tex) else: self._background_texture = tex if self._ac_obj is not None: ac.setBackgroundTexture(self._ac_obj, self._background_texture)
def __init__(self, pos_x=None, pos_y=None, width=None, height=None, color=None, filename=''): self.id = ac.newTexture(os.path.join(self.images_dir, filename)) self.pos_x = pos_x self.pos_y = pos_y self.width = width self.height = height self.color = color
def __init__(self, resolution: str, wheel): super(Load, self).__init__(128.0, 0.0, 256.0, 256.0) self._back.color = Colors.white self.__mult = BoxComponent.resolution_map[resolution] if Load.texture_id == 0: Load.texture_id = ac.newTexture( "apps/python/LiveTelemetry/img/load.png") self.resize(resolution)
def __init__(self, resolution: str, wheel): # Initial size is 64x256 super(Suspension, self).__init__(346.0 if wheel.is_left() else 102.0, 0.0, 64.0, 256.0) self._back.color = Colors.white self.__mult = BoxComponent.resolution_map[resolution] if Suspension.texture_id == 0: Suspension.texture_id = ac.newTexture( "apps/python/LiveTelemetry/img/suspension.png") self.resize(resolution)
def __init__(self, acd: ACD, resolution: str, wheel): self.__calc = TireTemp( acd.get_temp_curve(ac.getCarTyreCompound(0), wheel)) # Initial size is 160x256 super(Tire, self).__init__(176.0, 0.0, 160.0, 256.0) self._back.color = Colors.white if Tire.texture_id == 0: Tire.texture_id = ac.newTexture( "apps/python/LiveTelemetry/img/tire.png") self.resize(resolution)
def acMain(ac_version): import time global appWindow, hSession, dbgLabel, texture_radar, texture_indicator_left, texture_indicator_right, z ac.log("helipicapew::acMain Start {}".format(time.localtime(time.time()))) try: import helipicapewconfig helipicapewconfig.handleIni('helipicapew') z = helipicapewcar.guiZoomFactor appWindow = ac.newApp("helipicapew") ac.setSize(appWindow, 200 * z, 200 * z) ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, 0) ac.setTitle(appWindow, "helipicapew v{}".format(version)) ac.addRenderCallback(appWindow, onFormRender) ac.addOnAppActivatedListener(appWindow, onAppActivated) appWindowActivated = time.clock() showWindowTitle = True dbgLabel = ac.addLabel(appWindow, "") ac.setPosition(dbgLabel, 15, 405) texture_radar = ac.newTexture("apps/python/helipicapew/img/radar.png") texture_indicator_left = ac.newTexture( "apps/python/helipicapew/img/indicatorL.png") texture_indicator_right = ac.newTexture( "apps/python/helipicapew/img/indicatorR.png") hSession = helipicapewsession.HeliPicaPewSession() ac.log("helipicapew::acMain finished") except Exception as e: ac.log("helipicapew::acMain() %s" % e) return "helipicapew"
def __init__(self, resolution, wheel, window_id): # Initial size is 64x48 super(Height, self).__init__( 430.0 if wheel.is_left() else 18.0, 208.0, 64.0, 48.0) self._back.color = Colors.white if Height.texture_id == 0: Height.texture_id = ac.newTexture( "apps/python/LiveTelemetry/img/height.png") self.__lb = ac.addLabel(window_id, "") ac.setFontAlignment(self.__lb, "center") self.resize(resolution)
def __init__(self, acd: ACD, resolution: str, wheel, window_id: int): self.__calc = TirePsi( acd.get_ideal_pressure(ac.getCarTyreCompound(0), wheel)) # Initial size is 85x85 super(Pressure, self).__init__(70.0 if wheel.is_left() else 382.0, 171.0, 60.0, 60.0) self._back.color = Colors.white if Pressure.texture_id == 0: Pressure.texture_id = ac.newTexture( "apps/python/LiveTelemetry/img/pressure.png") self.__lb = ac.addLabel(window_id, "") ac.setFontAlignment(self.__lb, "center") self.resize(resolution)
def __init__(self, acd: ACD, resolution: str, wheel): abs_hz = acd.get_abs_hz() self.__abs_cycle = (1.0 / abs_hz) if abs_hz > 0.0 else 3600.0 self.__abs_timeout_s = 0.0 if abs_hz > 0.0 else 3600.0 #log(self.__abs_cycle) #log(self.__abs_timeout_s) # Initial size is 85x85 super(Lock, self).__init__(70.0 if wheel.is_left() else 382.0, 0.0, 60.0, 60.0) self._back.color = Colors.white self.__lock_time = 0.0 if Lock.texture_id == 0: Lock.texture_id = ac.newTexture( "apps/python/LiveTelemetry/img/brake.png") self.resize(resolution)
def acMain(ac_version): global appWindow, flag_textures # Initialise app appWindow = ac.newApp(APP_NAME) ac.setSize(appWindow, WINDOW_WIDTH, WINDOW_HEIGHT) ac.setIconPosition(appWindow, 0, -999999) ac.setTitle(appWindow, " ") ac.drawBorder(appWindow, 0) ac.setBackgroundOpacity(appWindow, NO_FLAG_BACKGROUND_OPACITY) ac.addRenderCallback(appWindow, onWindowRender) # Load flag textures flag_textures = { flag_value: ac.newTexture(TEXTURE_DIR + flag.texture) for flag_value, flag in FLAGS.items() } return APP_NAME
def path(self, path: str): if self._path != path: self._path = path self.texture = ac.newTexture(self._path)
def background_texture(self, tex): if isinstance(tex, str): self._background_texture = ac.newTexture(tex) else: self._background_texture = tex