]> git.mar77i.info Git - zenbook_gui/commitdiff
no need to super().draw() and super().update() on Parent
authormar77i <mar77i@protonmail.ch>
Thu, 13 Feb 2025 23:40:38 +0000 (00:40 +0100)
committermar77i <mar77i@protonmail.ch>
Fri, 14 Feb 2025 00:02:49 +0000 (01:02 +0100)
ui/child.py
ui/drop_down.py
ui/event_method_dispatcher.py
ui/parent.py

index efbec9a323e25552a3153e9ee5430918a4930890..d70296d09658d599d93203ad5d7bfeab22ab7315 100644 (file)
@@ -59,3 +59,9 @@ class Child(EventMethodDispatcher):
     @property
     def stop_event(self):
         return self.root.stop_event
+
+    def update(self):
+        pass
+
+    def draw(self):
+        pass
index 92076e8b169a43432580f69b7f83a34868869fb5..ac48dee40c10b1e419ec4c965d26984759cd809c 100644 (file)
@@ -35,10 +35,7 @@ class DropDownMenu(Modal):
             self.deactivate()
 
 
-class DropDown(Parent, Button):
+class DropDown(Button):
     def __init__(self, parent, rect, value, entries, callback, is_active=False):
-        super().__init__(parent, rect, value, self.activate, is_active)
-        self.dropdown_menu = DropDownMenu(self, rect, entries, callback)
-
-    def activate(self):
-        self.dropdown_menu.activate()
+        self.dropdown_menu = DropDownMenu(parent, rect, entries, callback)
+        super().__init__(parent, rect, value, self.dropdown_menu.activate, is_active)
index 8e548545e461673aaaea284d97eb894780a1aa1d..2b03755a42ca413fdbc97025b4ad7fbf672ac97b 100644 (file)
@@ -28,9 +28,3 @@ class EventMethodDispatcher:
         method_name = f"handle_{pygame.event.event_name(ev.type).lower()}"
         if hasattr(self, method_name):
             getattr(self, method_name)(ev)
-
-    def update(self):
-        pass
-
-    def draw(self):
-        pass
index bfd87d216341d2fccf1222df4c806159f8a173ec..22fed96cc9418680309a4953c6d1f374be681014 100644 (file)
@@ -20,11 +20,9 @@ class Parent(EventMethodDispatcher):
                 break
 
     def update(self):
-        super().update()
         for child in self.children:
             child.update()
 
     def draw(self):
-        super().draw()
         for child in self.children:
             child.draw()