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)
|
||||
|
||||
def draw(self, cr: cairo.Context):
|
||||
last = None
|
||||
|
||||
for item in self.commands:
|
||||
command, args = item
|
||||
|
||||
|
@ -38,7 +40,10 @@ class Path():
|
|||
cr.move_to(*arg)
|
||||
elif command == 'm':
|
||||
for arg in args:
|
||||
cr.rel_move_to(*arg)
|
||||
if last == 'Z' or last == 'z':
|
||||
cr.move_to(*arg)
|
||||
else:
|
||||
cr.rel_move_to(*arg)
|
||||
elif command == 'L':
|
||||
for arg in args:
|
||||
cr.line_to(*arg)
|
||||
|
@ -66,28 +71,31 @@ class Path():
|
|||
elif command == 'Z' or command == 'z':
|
||||
cr.close_path()
|
||||
|
||||
last = command
|
||||
|
||||
class HexagonPattern(Path):
|
||||
COMMANDS = (
|
||||
['M', [[23.246093, 0], [0, 13.382812]]],
|
||||
['V', [44.689453,]],
|
||||
COMMANDS = [
|
||||
['M', [[23.246093, 0],
|
||||
[0, 13.382812]]],
|
||||
['V', [44.689453]],
|
||||
['L', [[0.0839844, 44.640625],
|
||||
[24.033203, 58.505859],
|
||||
[24.001953, 86.332031],
|
||||
[22.841796, 87]]],
|
||||
['h', [4.478516,]],
|
||||
['h', [4.478516]],
|
||||
['L', [[26.068359, 86.275391],
|
||||
[26.099609, 58.449219],
|
||||
[50.083984, 44.640625],
|
||||
[74.033203, 58.505859],
|
||||
[74.001953, 86.332031],
|
||||
[72.841796, 87]]],
|
||||
['h', [4.478516,]],
|
||||
['h', [4.478516]],
|
||||
['L', [[ 76.068359, 86.275391],
|
||||
[ 76.099609, 58.449219],
|
||||
[100, 44.689453]]],
|
||||
['V', [13.365234,]],
|
||||
['V', [13.365234]],
|
||||
['L', [[76.919921, 0]]],
|
||||
['H', [73.246093,]],
|
||||
['H', [73.246093]],
|
||||
['L', [[50.015625, 13.373047],
|
||||
[26.919921, 0]]],
|
||||
['Z', []],
|
||||
|
@ -98,14 +106,14 @@ class HexagonPattern(Path):
|
|||
[1.0019531, 42.845703]]],
|
||||
['l', [[0.033203, -27.75]]],
|
||||
['z', []],
|
||||
['m', [[50,0],
|
||||
['m', [[50, 0],
|
||||
[24.017576, 13.904297],
|
||||
[-0.0352, 27.75]]],
|
||||
['L', [[75.017578, 56.75],
|
||||
[51.068359, 42.884766],
|
||||
[51.099609, 15.058594]]],
|
||||
['Z', []]
|
||||
)
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(self.COMMANDS)
|
||||
|
@ -230,5 +238,7 @@ class Cluster():
|
|||
cr.rectangle(0, 0, self.WIDTH, self.HEIGHT)
|
||||
cr.fill()
|
||||
|
||||
|
||||
|
||||
for gauge in self.gauges:
|
||||
gauge.draw_bg(cr)
|
||||
|
|
Loading…
Add table
Reference in a new issue