SO FREAKING CLOSE
This commit is contained in:
parent
12606cbdd7
commit
64c9ee3dc5
1 changed files with 20 additions and 10 deletions
|
@ -30,6 +30,8 @@ class Path():
|
||||||
return cr.line_to(x, y + y2)
|
return cr.line_to(x, y + y2)
|
||||||
|
|
||||||
def draw(self, cr: cairo.Context):
|
def draw(self, cr: cairo.Context):
|
||||||
|
last = None
|
||||||
|
|
||||||
for item in self.commands:
|
for item in self.commands:
|
||||||
command, args = item
|
command, args = item
|
||||||
|
|
||||||
|
@ -38,6 +40,9 @@ class Path():
|
||||||
cr.move_to(*arg)
|
cr.move_to(*arg)
|
||||||
elif command == 'm':
|
elif command == 'm':
|
||||||
for arg in args:
|
for arg in args:
|
||||||
|
if last == 'Z' or last == 'z':
|
||||||
|
cr.move_to(*arg)
|
||||||
|
else:
|
||||||
cr.rel_move_to(*arg)
|
cr.rel_move_to(*arg)
|
||||||
elif command == 'L':
|
elif command == 'L':
|
||||||
for arg in args:
|
for arg in args:
|
||||||
|
@ -66,28 +71,31 @@ class Path():
|
||||||
elif command == 'Z' or command == 'z':
|
elif command == 'Z' or command == 'z':
|
||||||
cr.close_path()
|
cr.close_path()
|
||||||
|
|
||||||
|
last = command
|
||||||
|
|
||||||
class HexagonPattern(Path):
|
class HexagonPattern(Path):
|
||||||
COMMANDS = (
|
COMMANDS = [
|
||||||
['M', [[23.246093, 0], [0, 13.382812]]],
|
['M', [[23.246093, 0],
|
||||||
['V', [44.689453,]],
|
[0, 13.382812]]],
|
||||||
|
['V', [44.689453]],
|
||||||
['L', [[0.0839844, 44.640625],
|
['L', [[0.0839844, 44.640625],
|
||||||
[24.033203, 58.505859],
|
[24.033203, 58.505859],
|
||||||
[24.001953, 86.332031],
|
[24.001953, 86.332031],
|
||||||
[22.841796, 87]]],
|
[22.841796, 87]]],
|
||||||
['h', [4.478516,]],
|
['h', [4.478516]],
|
||||||
['L', [[26.068359, 86.275391],
|
['L', [[26.068359, 86.275391],
|
||||||
[26.099609, 58.449219],
|
[26.099609, 58.449219],
|
||||||
[50.083984, 44.640625],
|
[50.083984, 44.640625],
|
||||||
[74.033203, 58.505859],
|
[74.033203, 58.505859],
|
||||||
[74.001953, 86.332031],
|
[74.001953, 86.332031],
|
||||||
[72.841796, 87]]],
|
[72.841796, 87]]],
|
||||||
['h', [4.478516,]],
|
['h', [4.478516]],
|
||||||
['L', [[ 76.068359, 86.275391],
|
['L', [[ 76.068359, 86.275391],
|
||||||
[ 76.099609, 58.449219],
|
[ 76.099609, 58.449219],
|
||||||
[100, 44.689453]]],
|
[100, 44.689453]]],
|
||||||
['V', [13.365234,]],
|
['V', [13.365234]],
|
||||||
['L', [[76.919921, 0]]],
|
['L', [[76.919921, 0]]],
|
||||||
['H', [73.246093,]],
|
['H', [73.246093]],
|
||||||
['L', [[50.015625, 13.373047],
|
['L', [[50.015625, 13.373047],
|
||||||
[26.919921, 0]]],
|
[26.919921, 0]]],
|
||||||
['Z', []],
|
['Z', []],
|
||||||
|
@ -105,7 +113,7 @@ class HexagonPattern(Path):
|
||||||
[51.068359, 42.884766],
|
[51.068359, 42.884766],
|
||||||
[51.099609, 15.058594]]],
|
[51.099609, 15.058594]]],
|
||||||
['Z', []]
|
['Z', []]
|
||||||
)
|
]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(self.COMMANDS)
|
super().__init__(self.COMMANDS)
|
||||||
|
@ -230,5 +238,7 @@ class Cluster():
|
||||||
cr.rectangle(0, 0, self.WIDTH, self.HEIGHT)
|
cr.rectangle(0, 0, self.WIDTH, self.HEIGHT)
|
||||||
cr.fill()
|
cr.fill()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for gauge in self.gauges:
|
for gauge in self.gauges:
|
||||||
gauge.draw_bg(cr)
|
gauge.draw_bg(cr)
|
||||||
|
|
Loading…
Add table
Reference in a new issue