self.width * max(unit),
)
- def draw(self, surf, pos):
- super().draw(surf, pos)
-
class Shapes(Shape):
def __init__(self, shapes):
raise NotImplementedError
return Shapes([s.fit(pos, unit) for s in self.shapes])
- def draw(self, surf, pos):
+ def draw(self, surf, color):
for shape in self.shapes:
- shape.draw(surf, pos)
+ shape.draw(surf, color)
class StrokePath:
self.width * max(unit),
)
- def draw(self, surf, pos):
- super().draw(surf, pos)
-
class StrokeCircleSegment(StrokeCircle):
def __init__(self, center, radius, start_angle, end_angle, width):
def __init__(self):
pygame.init()
+ pygame.display.set_icon(self.get_icon())
+ pygame.display.set_caption("Zenbook Config")
+ window_size = (1536, 1200)
super().__init__(
- pygame.display.set_mode((1536, 1200)), pygame.font.Font(None, size=96),
+ pygame.display.set_mode(window_size), pygame.font.Font(None, size=96),
)
self.xrandr_conf = XrandrConf()
self.xinput_conf = XinputConf(self.xrandr_conf)
"Re-apply",
partial(self.xinput_conf.reapply_by_type, "stylus")
),
+ Button(
+ self,
+ pygame.Rect((window_size[0] - 128, 0), (128, 64)),
+ "×",
+ self.quit,
+ ),
)
)
+ def get_icon(self):
+ surf = pygame.Surface((512, 512), pygame.SRCALPHA, 32)
+ surf.fill(0x0)
+ v = 512 // 22
+ laptop_single.fit((0, 0), (v, v)).draw(surf, "white")
+ return pygame.transform.scale(surf, (32, 32))
+
def laptop_cb(self, name, bt_switch, touch_switch, stylus_switch):
self.xrandr_conf.update(name)
if name != "single":
def laptop_is_active(self, name):
return self.xrandr_conf.is_active(name)
+ def quit(self):
+ self.running = False
+
if __name__ == "__main__":
ZenbookConf().run()