Deftly manoeuvred and muscled for rank
This commit is contained in:
parent
ec0baaef3e
commit
490390a433
3 changed files with 13 additions and 13 deletions
|
@ -99,3 +99,10 @@ class Dial(Gauge):
|
|||
|
||||
def draw_fg(self, cr: cairo.Context):
|
||||
self.draw_needle(cr, 0.5, 0.89, self.value)
|
||||
|
||||
class BottomDial(Dial):
|
||||
def draw_fg(self, cr: cairo.Context):
|
||||
min_radius = 0.8
|
||||
max_radius = 0.9
|
||||
|
||||
self.draw_needle(cr, min_radius, max_radius, self.MAX_VALUE - self.value)
|
||||
|
|
|
@ -2,9 +2,9 @@ import enum
|
|||
import math
|
||||
import cairo
|
||||
|
||||
from hexagram.dial import Dial
|
||||
from hexagram.dial import BottomDial
|
||||
|
||||
class FuelGauge(Dial):
|
||||
class FuelGauge(BottomDial):
|
||||
MIN_ANGLE = 144.0 * (math.pi / 180.0)
|
||||
MAX_ANGLE = 216.0 * (math.pi / 180.0)
|
||||
|
||||
|
@ -75,9 +75,3 @@ class FuelGauge(Dial):
|
|||
cr.set_source_rgb(1, 1, 1)
|
||||
|
||||
self.draw_mark(cr, min_radius, 0.87, self.max_value - level)
|
||||
|
||||
def draw_fg(self, cr: cairo.Context):
|
||||
min_radius = 0.8
|
||||
max_radius = 0.9
|
||||
|
||||
self.draw_needle(cr, min_radius, max_radius, self.MAX_VALUE - self.value)
|
||||
|
|
|
@ -2,9 +2,9 @@ import enum
|
|||
import math
|
||||
import cairo
|
||||
|
||||
from hexagram.dial import Dial
|
||||
from hexagram.dial import BottomDial
|
||||
|
||||
class ThermoGauge(Dial):
|
||||
class ThermoGauge(BottomDial):
|
||||
MIN_ANGLE = 144.0 * (math.pi / 180.0)
|
||||
MAX_ANGLE = 216.0 * (math.pi / 180.0)
|
||||
|
||||
|
@ -17,6 +17,8 @@ class ThermoGauge(Dial):
|
|||
def __init__(self, x: float, y: float, radius: float):
|
||||
super().__init__(x, y, radius, self.MIN_ANGLE, self.MAX_ANGLE, self.MAX_VALUE - self.MIN_VALUE)
|
||||
|
||||
self.value = self.MIN_VALUE
|
||||
|
||||
def draw_value(self, cr: cairo.Context, radius: float, value: float, text: str, x_offset: float, y_offset: float):
|
||||
scale = (self.max_value - value) / self.max_value
|
||||
angle = self.min_angle + ((self.max_angle - self.min_angle) * scale) - self.ANGLE_OFFSET
|
||||
|
@ -70,6 +72,3 @@ class ThermoGauge(Dial):
|
|||
cr.set_source_rgb(1, 1, 1)
|
||||
|
||||
self.draw_mark(cr, 0.83, 0.87, self.max_value - level)
|
||||
|
||||
def draw_fg(self, cr: cairo.Context):
|
||||
pass
|
||||
|
|
Loading…
Add table
Reference in a new issue