diff cagou/core/cagou_widget.py @ 491:203755bbe0fe

massive refactoring from camelCase -> snake_case. See backend commit log for more details
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:44:32 +0200
parents 3c9ba4a694ef
children
line wrap: on
line diff
--- a/cagou/core/cagou_widget.py	Sat Apr 08 13:34:55 2023 +0200
+++ b/cagou/core/cagou_widget.py	Sat Apr 08 13:44:32 2023 +0200
@@ -45,7 +45,7 @@
 
     def __init__(self, **kwargs):
         super().__init__(**kwargs)
-        self.bind(on_release=lambda btn: self.cagou_widget.switchWidget(
+        self.bind(on_release=lambda btn: self.cagou_widget.switch_widget(
             self.plugin_info))
 
 
@@ -62,7 +62,7 @@
     def __init__(self, cagou_widget):
         super(HeaderWidgetSelector, self).__init__()
         plg_info_cls = cagou_widget.plugin_info_class or cagou_widget.__class__
-        for plugin_info in G.host.getPluggedWidgets(except_cls=plg_info_cls):
+        for plugin_info in G.host.get_plugged_widgets(except_cls=plg_info_cls):
             choice = HeaderChoiceWidget(
                 cagou_widget=cagou_widget,
                 plugin_info=plugin_info,
@@ -102,7 +102,7 @@
 
     def __init__(self, **kwargs):
         plg_info_cls = self.plugin_info_class or self.__class__
-        for p in G.host.getPluggedWidgets():
+        for p in G.host.get_plugged_widgets():
             if p['main'] == plg_info_cls:
                 self.plugin_info = p
                 break
@@ -115,8 +115,8 @@
                 multiline=False,
             )
             self.header_input.bind(
-                on_text_validate=lambda *args: self.onHeaderInput(),
-                text=self.onHeaderInputComplete,
+                on_text_validate=lambda *args: self.on_header_wid_input(),
+                text=self.on_header_wid_input_complete,
             )
             self.header_box.add_widget(self.header_input)
 
@@ -139,7 +139,7 @@
             raise exceptions.InternalError(
                 "screen_manager property can't be used if global_screen_manager is not "
                 "set")
-        screen = self.getAncestor(Screen)
+        screen = self.get_ancestor(Screen)
         if screen is None:
             raise exceptions.NotFound("Can't find parent Screen")
         if screen.manager is None:
@@ -149,36 +149,36 @@
     @property
     def whwrapper(self):
         """Retrieve parent widget handler"""
-        return G.host.getParentWHWrapper(self)
+        return G.host.get_parent_wh_wrapper(self)
 
-    def screenManagerInit(self, screen_manager):
+    def screen_manager_init(self, screen_manager):
         """Override this method to do init when ScreenManager is instantiated
 
         This is only called once even if collection_carousel is used.
         """
         if not self.global_screen_manager:
-            raise exceptions.InternalError("screenManagerInit should not be called")
+            raise exceptions.InternalError("screen_manager_init should not be called")
 
-    def getAncestor(self, cls):
-        """Helper method to use host.getAncestorWidget with self"""
-        return G.host.getAncestorWidget(self, cls)
+    def get_ancestor(self, cls):
+        """Helper method to use host.get_ancestor_widget with self"""
+        return G.host.get_ancestor_widget(self, cls)
 
-    def switchWidget(self, plugin_info):
+    def switch_widget(self, plugin_info):
         self.selector.dismiss()
         factory = plugin_info["factory"]
         new_widget = factory(plugin_info, None, iter(G.host.profiles))
-        G.host.switchWidget(self, new_widget)
+        G.host.switch_widget(self, new_widget)
 
     def key_input(self, window, key, scancode, codepoint, modifier):
         if key == 27:
             # we go back to root screen
-            G.host.switchWidget(self)
+            G.host.switch_widget(self)
             return True
 
-    def onHeaderInput(self):
+    def on_header_wid_input(self):
         log.info("header input text entered")
 
-    def onHeaderInputComplete(self, wid, text):
+    def on_header_wid_input_complete(self, wid, text):
         return
 
     def on_touch_down(self, touch):
@@ -186,14 +186,14 @@
             G.host.selected_widget = self
         return super(CagouWidget, self).on_touch_down(touch)
 
-    def headerInputAddExtra(self, widget):
+    def header_input_add_extra(self, widget):
         """add a widget on the right of header input"""
         self.header_box.add_widget(widget)
 
-    def onVisible(self):
+    def on_visible(self):
         pass
         # log.debug(u"{self} is visible".format(self=self))
 
-    def onNotVisible(self):
+    def on_not_visible(self):
         pass
         # log.debug(u"{self} is not visible anymore".format(self=self))