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]+":")
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], "")
def __init__(self, app_name, x, y, w, h, main=None): super().__init__() self._ac_obj = ac.newApp(app_name) self._main = main self.position_changed = False self.attached = False self._render_callback = None self._title = False self._title_position = (0, 0) self._icon = False self._icon_position = (0, 0) self._pos = ac.getPosition(self._ac_obj) self.size = (int(w), int(h)) self.update()
def position(self) -> tuple: if self.has_id: position = ac.getPosition(self.id) if position != -1: return position return self._position.tuple()
def getPosition(obj): return ac.getPosition(obj)
def getPos(self): self.x, self.y = ac.getPosition(self.app) return self
def get_position(self): """ Returns the window position. """ return ac.getPosition(self.__window_id)