Ejemplo n.º 1
0
    def __init__(self, data: ACData = None, meta: ACMeta = None):
        super().__init__('ACLIB_Camera', 200, 200, 150, 250)

        self.hide_decoration()
        self.background_color = TRANSPARENT

        self._data = data

        self._grid = ACGrid(2, 11, self)
        self._prev = ACLabel(self._grid, '<-', 'center')
        self._next = ACLabel(self._grid, '->', 'center')

        self._prev.background_color = DARKGRAY
        self._next.background_color = DARKGRAY

        self._grid.add(self._prev, 0, 0)
        self._grid.add(self._next, 1, 0)

        self._prev.on(ACWidget.EVENT.ON_MOUSE_DOWN, self.prev)
        self._next.on(ACWidget.EVENT.ON_MOUSE_DOWN, self.next)

        self._cameras = ['Cockpit', 'Car', 'Drivable', 'Track', 'Helicopter', 'OnBoardFree', 'Free', 'Random', 'ImageGeneratorCamera', 'Start']

        self._labels = []
        self._cam_id = 0

        self._active_font = Font('Roboto Mono')
        self._active_font.size = 12
        self._active_font.color = WHITE

        self._inactive_font = Font('Roboto Mono')
        self._inactive_font.size = 12
        self._inactive_font.color = WHITE

        i = 0
        for cam_id, name in enumerate(self._cameras):
            label = ACLabel(self._grid, name, 'center', self._inactive_font)
            label.background_color = BLACK
            label.on(ACWidget.EVENT.ON_MOUSE_DOWN, self.select)
            setattr(label, 'cam', cam_id)
            self._labels.append(label)

            self._grid.add(label, 0, i + 1, 2, 1)
            i += 1
            console(label.size)

        self._data.on(ACData.EVENT.READY, self.init)
Ejemplo n.º 2
0
    def __init__(self,
                 parent: ACWidget,
                 value: float,
                 start: float = 0,
                 stop: float = 1,
                 progress: bool = False):
        super().__init__(parent)

        self._show_progress = progress
        self._range = (min(start, stop), max(start, stop))
        self._value = value if start <= value <= stop else start

        self.id = ac.addLabel(self.app, '')

        self._progress = ACLabel(self)
        self._text = ACLabel(self, '', 'center')

        font = Font('Roboto Mono')
        font.size = 14
        font.bold = 1
        font.color = BLACK

        self._progress.background_color = GREEN
        self._text.font = font
Ejemplo n.º 3
0
    def __init__(self, data: ACData = None, meta: ACMeta = None):
        super().__init__('ACLIB UIDebug', 200, 200, 550, 80)

        self.hide_decoration()
        self.background_color = BLACK

        self._data = data
        self._active_widgets = []
        self._timer = time()

        self._font = Font('Roboto Mono', WHITE)

        self._grid = ACGrid(4, 4, self)

        self._widget_label = ACLabel(self._grid, 'Widget:', font=self._font)
        self._widget_text = ACLabel(self._grid, '', font=self._font)

        self._position_label = ACLabel(self._grid,
                                       'Position:',
                                       font=self._font)
        self._position_text = ACLabel(self._grid, '', font=self._font)

        self._size_label = ACLabel(self._grid, 'Size:', font=self._font)
        self._size_text = ACLabel(self._grid, '', font=self._font)

        self._property_name = ACLIBListBox(self._grid, 4)
        self._property_value = ACLIBListBox(self._grid, 4)

        col, row = 0, 0
        self._grid.add(self._widget_label, col, row)
        self._grid.add(self._position_label, col, row + 1)
        self._grid.add(self._size_label, col, row + 2)

        col, row = 1, 0
        self._grid.add(self._widget_text, col, row)
        self._grid.add(self._position_text, col, row + 1)
        self._grid.add(self._size_text, col, row + 2)

        col, row = 2, 0
        self._grid.add(self._property_name, col, row, 1, 4)

        col, row = 3, 0
        self._grid.add(self._property_value, col, row, 1, 4)

        self._data.on(ACData.EVENT.READY, self.init)
        self.on(ACWidget.EVENT.DISMISSED, self.dismissed)
Ejemplo n.º 4
0
    def __init__(self, data: ACData = None, meta: ACMeta = None):
        super().__init__('ACLIB Fuel', 200, 200, 300, 100, True, True)
        self.hide_decoration()

        self._data = data
        self._meta = meta

        # Init

        self._normal_font = Font('Roboto Mono')
        self._normal_font.bold = 1
        self._normal_font.color = WHITE

        self._main_grid = ACGrid(5, 4, self)

        self._grid = ACGrid(3, 3, self._main_grid)

        self._avg_km = ACLabel(self._grid, 'Ø 00.0  l/km', 'center',
                               self._normal_font)
        self._avg_lap = ACLabel(self._grid, 'Ø 00.0   l/L', 'center',
                                self._normal_font)
        self._avg_min = ACLabel(self._grid, 'Ø 00.0 l/min', 'center',
                                self._normal_font)

        self._fuel = ACLabel(self._grid, '+ 00.0   l', 'center',
                             self._normal_font)
        self._km = ACLabel(self._grid, '+ 00.0  km', 'center',
                           self._normal_font)
        self._lap = ACLabel(self._grid, '+ 00.0   L', 'center',
                            self._normal_font)
        self._min = ACLabel(self._grid, '+ 00.0 min', 'center',
                            self._normal_font)

        # Style

        self.background_color = Color(0, 0, 0, 0.5)

        #self._fuel.background_color = Color(0.75, 0.75, 0, 0.75)

        self._main_grid.add(self._fuel, 3, 0, 2, 1)
        self._main_grid.add(self._avg_km, 1, 1, 2, 1)
        self._main_grid.add(self._km, 3, 1, 2, 1)
        self._main_grid.add(self._avg_lap, 1, 2, 2, 1)
        self._main_grid.add(self._lap, 3, 2, 2, 1)
        self._main_grid.add(self._avg_min, 1, 3, 2, 1)
        self._main_grid.add(self._min, 3, 3, 2, 1)

        # Data

        self._monitor = False
        self._timer = 0
        self._track_len = 0

        self._km_fuel_ref = 0
        self._lap_fuel_ref = 0
        self._min_fuel_ref = 0

        self._km_fuel_avg = 0
        self._lap_fuel_avg = 0
        self._min_fuel_avg = 0

        self._data.on(ACData.EVENT.READY, self._on_ready)
Ejemplo n.º 5
0
class CR_Button(ACButton):
    FONT = Font("Roboto Mono", Color(0, 0, 0))

    def __init__(self, parent: ACWidget, text: str):
        super().__init__(parent, text, 'center', CR_Button.FONT)
Ejemplo n.º 6
0
class CR_Label(ACLabel):
    BRIGHT = Font("Roboto Mono", Color(1.0, 1.0, 1.0))
    DARK = Font("Roboto Mono", Color(0.0, 0.0, 0.0))

    def __init__(self, parent: ACWidget, text: str):
        super().__init__(parent, text, 'center', CR_Label.BRIGHT)
Ejemplo n.º 7
0
class CR_Name(ACLabel):
    FONT = Font("Roboto Mono", Color(1.0, 0.0, 0.0, 0.75), True)

    def __init__(self, parent: ACWidget, text: str):
        super().__init__(parent, text, 'center', CR_Name.FONT)