diff cagou/core/cagou_main.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 38ca44d96752
children
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Sat Apr 08 13:34:55 2023 +0200
+++ b/cagou/core/cagou_main.py	Sat Apr 08 13:44:32 2023 +0200
@@ -42,8 +42,8 @@
 import kivy
 kivy.require('1.11.0')
 import kivy.support
-main_config = config.parseMainConf(log_filenames=True)
-bridge_name = config.getConfig(main_config, '', 'bridge', 'dbus')
+main_config = config.parse_main_conf(log_filenames=True)
+bridge_name = config.config_get(main_config, '', 'bridge', 'dbus')
 # FIXME: event loop is choosen according to bridge_name, a better way should be used
 if 'dbus' in bridge_name:
     kivy.support.install_gobject_iteration()
@@ -107,7 +107,7 @@
         callback, args, kwargs = self.notifs.pop(0)
         callback(*args, **kwargs)
 
-    def addNotif(self, callback, *args, **kwargs):
+    def add_notif(self, callback, *args, **kwargs):
         self.notifs.append((callback, args, kwargs))
 
 
@@ -159,7 +159,7 @@
 
     def on_select(self, action_kwargs):
         app = App.get_running_app()
-        app.host.doAction(**action_kwargs)
+        app.host.do_action(**action_kwargs)
 
 
 class RootHeadWidget(BoxLayout):
@@ -175,15 +175,15 @@
         self.notes_event = None
         self.notes_drop = NotesDrop(self.notes)
 
-    def addNotif(self, callback, *args, **kwargs):
+    def add_notif(self, callback, *args, **kwargs):
         """add a notification with a callback attached
 
         when notification is pressed, callback is called
         @param *args, **kwargs: arguments of callback
         """
-        self.notifs_icon.addNotif(callback, *args, **kwargs)
+        self.notifs_icon.add_notif(callback, *args, **kwargs)
 
-    def addNote(self, title, message, level, symbol, action):
+    def add_note(self, title, message, level, symbol, action):
         kwargs = {
             'title': title,
             'message': message,
@@ -196,17 +196,17 @@
         note = Note(**kwargs)
         self.notes.append(note)
         if self.notes_event is None:
-            self.notes_event = Clock.schedule_interval(self._displayNextNote, 5)
-            self._displayNextNote()
+            self.notes_event = Clock.schedule_interval(self._display_next_note, 5)
+            self._display_next_note()
 
-    def addNotifUI(self, ui):
-        self.notifs_icon.addNotif(ui.show, force=True)
+    def add_notif_ui(self, ui):
+        self.notifs_icon.add_notif(ui.show, force=True)
 
-    def addNotifWidget(self, widget):
+    def add_notif_widget(self, widget):
         app = App.get_running_app()
-        self.notifs_icon.addNotif(app.host.showExtraUI, widget=widget)
+        self.notifs_icon.add_notif(app.host.show_extra_ui, widget=widget)
 
-    def _displayNextNote(self, __=None):
+    def _display_next_note(self, __=None):
         screen = Screen()
         try:
             idx = self.notes.index(self.notes_last) + 1
@@ -248,7 +248,7 @@
         self._manager.add_widget(extra_screen)
         self.root_body.add_widget(self._manager)
 
-    def changeWidget(self, widget, screen_name="main"):
+    def change_widget(self, widget, screen_name="main"):
         """change main widget"""
         if self._manager.transition.is_active:
             # FIXME: workaround for what seems a Kivy bug
@@ -271,18 +271,18 @@
             self._manager.transition = RiseInTransition()
         self._manager.current = screen
 
-    def newAction(self, handler, action_data, id_, security_limit, profile):
+    def new_action(self, handler, action_data, id_, security_limit, profile):
         """Add a notification for an action"""
-        self.head_widget.addNotif(handler, action_data, id_, security_limit, profile)
+        self.head_widget.add_notif(handler, action_data, id_, security_limit, profile)
 
-    def addNote(self, title, message, level, symbol, action):
-        self.head_widget.addNote(title, message, level, symbol, action)
+    def add_note(self, title, message, level, symbol, action):
+        self.head_widget.add_note(title, message, level, symbol, action)
 
-    def addNotifUI(self, ui):
-        self.head_widget.addNotifUI(ui)
+    def add_notif_ui(self, ui):
+        self.head_widget.add_notif_ui(ui)
 
-    def addNotifWidget(self, widget):
-        self.head_widget.addNotifWidget(widget)
+    def add_notif_widget(self, widget):
+        self.head_widget.add_notif_widget(widget)
 
 
 class CagouApp(App):
@@ -311,9 +311,9 @@
         local_platform.on_app_build(wid)
         return wid
 
-    def showProfileManager(self):
+    def show_profile_manager(self):
         self._profile_manager = ProfileManager()
-        self.root.changeWidget(self._profile_manager)
+        self.root.change_widget(self._profile_manager)
 
     def expand(self, path, *args, **kwargs):
         """expand path and replace known values
@@ -326,9 +326,9 @@
         """
         return os.path.expanduser(path).format(*args, media=self.host.media_dir, **kwargs)
 
-    def initFrontendState(self):
+    def init_frontend_state(self):
         """Init state to handle paused/stopped/running on mobile OSes"""
-        local_platform.on_initFrontendState()
+        local_platform.on_init_frontend_state()
 
     def on_pause(self):
         return local_platform.on_pause()
@@ -339,7 +339,7 @@
     def on_stop(self):
         return local_platform.on_stop()
 
-    def showHeadWidget(self, show=None, animation=True):
+    def show_head_widget(self, show=None, animation=True):
         """Show/Hide the head widget
 
         @param show(bool, None): True to show, False to hide, None to switch
@@ -386,7 +386,7 @@
             return True
         elif key == 110 and 'alt' in modifier:
             # M-n we hide/show notifications
-            self.showHeadWidget()
+            self.show_head_widget()
             return True
         else:
             return False
@@ -418,16 +418,16 @@
             sys.exit(3)
         else:
             log.debug(f"Loading {bridge_name} bridge")
-        super(Cagou, self).__init__(bridge_factory=bridge_module.Bridge,
+        super(Cagou, self).__init__(bridge_factory=bridge_module.bridge,
                                     xmlui=xmlui,
                                     check_options=quick_utils.check_options,
                                     connect_bridge=False)
         self._import_kv()
         self.app = CagouApp()
         self.app.host = self
-        self.media_dir = self.app.media_dir = config.getConfig(main_config, '',
+        self.media_dir = self.app.media_dir = config.config_get(main_config, '',
                                                                'media_dir')
-        self.downloads_dir = self.app.downloads_dir = config.getConfig(main_config, '',
+        self.downloads_dir = self.app.downloads_dir = config.config_get(main_config, '',
                                                                        'downloads_dir')
         if not os.path.exists(self.downloads_dir):
             try:
@@ -449,16 +449,16 @@
         # used to keep track of last selected widget in "main" screen when changing
         # root screen
         self._selected_widget_main = None
-        self.backend_version = sat.__version__  # will be replaced by getVersion()
+        self.backend_version = sat.__version__  # will be replaced by version_get()
         if C.APP_VERSION.endswith('D'):
             self.version = "{} {}".format(
                 C.APP_VERSION,
-                sat_utils.getRepositoryData(cagou)
+                sat_utils.get_repository_data(cagou)
             )
         else:
             self.version = C.APP_VERSION
 
-        self.tls_validation =  not C.bool(config.getConfig(main_config,
+        self.tls_validation =  not C.bool(config.config_get(main_config,
                                                            C.CONFIG_SECTION,
                                                            'no_certificate_validation',
                                                            C.BOOL_FALSE))
@@ -484,7 +484,7 @@
     @QuickApp.sync.setter
     def sync(self, state):
         QuickApp.sync.fset(self, state)
-        # widget are resynchronised in onVisible event,
+        # widget are resynchronised in on_visible event,
         # so we must call resync for widgets which are already visible
         if state:
             for w in self.visible_widgets:
@@ -496,14 +496,14 @@
                     resync()
             self.contact_lists.fill()
 
-    def getConfig(self, section, name, default=None):
-        return config.getConfig(main_config, section, name, default)
+    def config_get(self, section, name, default=None):
+        return config.config_get(main_config, section, name, default)
 
-    def onBridgeConnected(self):
-        super(Cagou, self).onBridgeConnected()
-        self.registerSignal("otrState", iface="plugin")
+    def on_bridge_connected(self):
+        super(Cagou, self).on_bridge_connected()
+        self.register_signal("otr_state", iface="plugin")
 
-    def _bridgeEb(self, failure):
+    def _bridge_eb(self, failure):
         if bridge_name == "pb" and sys.platform == "android":
             try:
                 self.retried += 1
@@ -513,12 +513,12 @@
                  and self.retried < 100)):
                 if self.retried % 20 == 0:
                     log.debug("backend not ready, retrying ({})".format(self.retried))
-                Clock.schedule_once(lambda __: self.connectBridge(), 0.05)
+                Clock.schedule_once(lambda __: self.connect_bridge(), 0.05)
                 return
-        super(Cagou, self)._bridgeEb(failure)
+        super(Cagou, self)._bridge_eb(failure)
 
     def run(self):
-        self.connectBridge()
+        self.connect_bridge()
         self.app.bind(on_stop=self.onStop)
         self.app.run()
 
@@ -530,42 +530,42 @@
         else:
             sat_instance.stopService()
 
-    def _getVersionCb(self, version):
+    def _get_version_cb(self, version):
         self.backend_version = version
 
-    def onBackendReady(self):
-        super().onBackendReady()
-        self.app.showProfileManager()
-        self.bridge.getVersion(callback=self._getVersionCb)
-        self.app.initFrontendState()
-        if local_platform.do_postInit():
-            self.postInit()
+    def on_backend_ready(self):
+        super().on_backend_ready()
+        self.app.show_profile_manager()
+        self.bridge.version_get(callback=self._get_version_cb)
+        self.app.init_frontend_state()
+        if local_platform.do_post_init():
+            self.post_init()
 
-    def postInit(self, __=None):
+    def post_init(self, __=None):
         # FIXME: resize doesn't work with SDL2 on android, so we use below_target for now
         self.app.root_window.softinput_mode = "below_target"
         profile_manager = self.app._profile_manager
         del self.app._profile_manager
-        super(Cagou, self).postInit(profile_manager)
+        super(Cagou, self).post_init(profile_manager)
 
-    def profilePlugged(self, profile):
-        super().profilePlugged(profile)
+    def profile_plugged(self, profile):
+        super().profile_plugged(profile)
         # FIXME: this won't work with multiple profiles
         self.app.connected = self.profiles[profile].connected
 
-    def _bookmarksListCb(self, bookmarks_dict, profile):
+    def _bookmarks_list_cb(self, bookmarks_dict, profile):
         bookmarks = set()
         for data in bookmarks_dict.values():
             bookmarks.update({jid.JID(k) for k in data.keys()})
         self.profiles[profile]._bookmarks = sorted(bookmarks)
 
-    def profileConnected(self, profile):
-        self.bridge.bookmarksList(
+    def profile_connected(self, profile):
+        self.bridge.bookmarks_list(
             "muc", "all", profile,
-            callback=partial(self._bookmarksListCb, profile=profile),
+            callback=partial(self._bookmarks_list_cb, profile=profile),
             errback=partial(self.errback, title=_("Bookmark error")))
 
-    def _defaultFactoryMain(self, plugin_info, target, profiles):
+    def _default_factory_main(self, plugin_info, target, profiles):
         """default factory used to create main widgets instances
 
         used when PLUGIN_INFO["factory"] is not set
@@ -574,12 +574,12 @@
         @param profiles(iterable): list of profiles
         """
         main_cls = plugin_info['main']
-        return self.widgets.getOrCreateWidget(main_cls,
+        return self.widgets.get_or_create_widget(main_cls,
                                               target,
                                               on_new_widget=None,
                                               profiles=iter(self.profiles))
 
-    def _defaultFactoryTransfer(self, plugin_info, callback, cancel_cb, profiles):
+    def _default_factory_transfer(self, plugin_info, callback, cancel_cb, profiles):
         """default factory used to create transfer widgets instances
 
         @param plugin_info(dict): plugin datas
@@ -637,10 +637,10 @@
             # and select the variable to use according to type
             if plugin_type == C.PLUG_TYPE_WID:
                 imported_names = imported_names_main
-                default_factory = self._defaultFactoryMain
+                default_factory = self._default_factory_main
             elif plugin_type == C.PLUG_TYPE_TRANSFER:
                 imported_names = imported_names_transfer
-                default_factory = self._defaultFactoryTransfer
+                default_factory = self._default_factory_transfer
             else:
                 log.error("unknown plugin type {type_} for plugin {file_}, skipping"
                     .format(
@@ -648,7 +648,7 @@
                     file_ = plug
                     ))
                 continue
-            plugins_set = self._getPluginsSet(plugin_type)
+            plugins_set = self._get_plugins_set(plugin_type)
 
             mod = import_module(plugin_path)
             try:
@@ -701,7 +701,7 @@
             plugin_info['main'] = main_cls
 
             # factory is used to create the instance
-            # if not found, we use a defaut one with getOrCreateWidget
+            # if not found, we use a defaut one with get_or_create_widget
             if 'factory' not in plugin_info:
                 plugin_info['factory'] = default_factory
 
@@ -731,7 +731,7 @@
             # we have no selector widget, we use the first widget as default
             self.default_wid = self._plg_wids[0]
 
-    def _getPluginsSet(self, type_):
+    def _get_plugins_set(self, type_):
         if type_ == C.PLUG_TYPE_WID:
             return self._plg_wids
         elif type_ == C.PLUG_TYPE_TRANSFER:
@@ -739,7 +739,7 @@
         else:
             raise KeyError("{} plugin type is unknown".format(type_))
 
-    def getPluggedWidgets(self, type_=C.PLUG_TYPE_WID, except_cls=None):
+    def get_plugged_widgets(self, type_=C.PLUG_TYPE_WID, except_cls=None):
         """get available widgets plugin infos
 
         @param type_(unicode): type of widgets to get
@@ -748,13 +748,13 @@
             widgets from this class will be excluded
         @return (iter[dict]): available widgets plugin infos
         """
-        plugins_set = self._getPluginsSet(type_)
+        plugins_set = self._get_plugins_set(type_)
         for plugin_data in plugins_set:
             if plugin_data['main'] == except_cls:
                 continue
             yield plugin_data
 
-    def getPluginInfo(self, type_=C.PLUG_TYPE_WID, **kwargs):
+    def get_plugin_info(self, type_=C.PLUG_TYPE_WID, **kwargs):
         """get first plugin info corresponding to filters
 
         @param type_(unicode): type of widgets to get
@@ -763,7 +763,7 @@
             exist and be of the same value in requested plugin info
         @return (dict, None): found plugin info or None
         """
-        plugins_set = self._getPluginsSet(type_)
+        plugins_set = self._get_plugins_set(type_)
         for plugin_info in plugins_set:
             for k, w in kwargs.items():
                 try:
@@ -775,12 +775,12 @@
 
     ## widgets handling
 
-    def newWidget(self, widget):
+    def new_widget(self, widget):
         log.debug("new widget created: {}".format(widget))
         if isinstance(widget, quick_chat.QuickChat) and widget.type == C.CHAT_GROUP:
-            self.addNote("", _("room {} has been joined").format(widget.target))
+            self.add_note("", _("room {} has been joined").format(widget.target))
 
-    def switchWidget(self, old, new=None):
+    def switch_widget(self, old, new=None):
         """Replace old widget by new one
 
         @param old(CagouWidget, None): CagouWidget instance or a child
@@ -790,7 +790,7 @@
         @return (CagouWidget): new widget
         """
         if old is None:
-            old = self.getWidgetToSwitch()
+            old = self.get_widget_to_switch()
         if new is None:
             factory = self.default_wid['factory']
             try:
@@ -811,15 +811,15 @@
             raise exceptions.InternalError("no CagouWidget found when "
                                            "trying to switch widget")
 
-        # selected_widget can be modified in changeWidget, so we need to set it before
+        # selected_widget can be modified in change_widget, so we need to set it before
         self.selected_widget = new
         if to_change == new:
-            log.debug("switchWidget called with old==new, nothing to do")
+            log.debug("switch_widget called with old==new, nothing to do")
             return new
-        to_change.whwrapper.changeWidget(new)
+        to_change.whwrapper.change_widget(new)
         return new
 
-    def _addVisibleWidget(self, widget):
+    def _add_visible_widget(self, widget):
         """declare a widget visible
 
         for internal use only!
@@ -827,10 +827,10 @@
         assert isinstance(widget, CagouWidget)
         log.debug(f"Visible widget: {widget}")
         self._visible_widgets.setdefault(widget.__class__, set()).add(widget)
-        log.debug(f"visible widgets list: {self.getVisibleList(None)}")
-        widget.onVisible()
+        log.debug(f"visible widgets list: {self.get_visible_list(None)}")
+        widget.on_visible()
 
-    def _removeVisibleWidget(self, widget, ignore_missing=False):
+    def _remove_visible_widget(self, widget, ignore_missing=False):
         """declare a widget not visible anymore
 
         for internal use only!
@@ -842,13 +842,13 @@
             if not ignore_missing:
                 log.error(f"trying to remove a not visible widget ({widget}): {e}")
             return
-        log.debug(f"visible widgets list: {self.getVisibleList(None)}")
+        log.debug(f"visible widgets list: {self.get_visible_list(None)}")
         if isinstance(widget, CagouWidget):
-            widget.onNotVisible()
+            widget.on_not_visible()
         if isinstance(widget, quick_widgets.QuickWidget):
-            self.widgets.deleteWidget(widget)
+            self.widgets.delete_widget(widget)
 
-    def getVisibleList(self, cls):
+    def get_visible_list(self, cls):
         """get list of visible widgets for a given class
 
         @param cls(type): type of widgets to get
@@ -866,7 +866,7 @@
         except KeyError:
             return set()
 
-    def deleteUnusedWidgetInstances(self, widget):
+    def delete_unused_widget_instances(self, widget):
         """Delete instance of this widget which are not attached to a WHWrapper
 
         @param widget(quick_widgets.QuickWidget): reference widget
@@ -874,14 +874,14 @@
         """
         to_delete = []
         if isinstance(widget, quick_widgets.QuickWidget):
-            for w in self.widgets.getWidgetInstances(widget):
+            for w in self.widgets.get_widget_instances(widget):
                 if w.whwrapper is None and w != widget:
                     to_delete.append(w)
             for w in to_delete:
                 log.debug("cleaning widget: {wid}".format(wid=w))
-                self.widgets.deleteWidget(w)
+                self.widgets.delete_widget(w)
 
-    def getOrClone(self, widget, **kwargs):
+    def get_or_clone(self, widget, **kwargs):
         """Get a QuickWidget if it is not in a WHWrapper, else clone it
 
         if an other instance of this widget exist without being in a WHWrapper
@@ -890,26 +890,26 @@
         if widget.whwrapper is None:
             if widget.parent is not None:
                 widget.parent.remove_widget(widget)
-            self.deleteUnusedWidgetInstances(widget)
+            self.delete_unused_widget_instances(widget)
             return widget
-        for w in self.widgets.getWidgetInstances(widget):
+        for w in self.widgets.get_widget_instances(widget):
             if w.whwrapper is None:
                 if w.parent is not None:
                     w.parent.remove_widget(w)
-                self.deleteUnusedWidgetInstances(w)
+                self.delete_unused_widget_instances(w)
                 return w
         targets = list(widget.targets)
-        w = self.widgets.getOrCreateWidget(widget.__class__,
+        w = self.widgets.get_or_create_widget(widget.__class__,
                                            targets[0],
                                            on_new_widget=None,
                                            on_existing_widget=C.WIDGET_RECREATE,
                                            profiles=widget.profiles,
                                            **kwargs)
         for t in targets[1:]:
-            w.addTarget(t)
+            w.add_target(t)
         return w
 
-    def getWidgetToSwitch(self):
+    def get_widget_to_switch(self):
         """Choose best candidate when we need to switch widget and old is not specified
 
         @return (CagouWidget): widget to switch
@@ -931,7 +931,7 @@
         # no default widget found, we return the first widget
         return next(iter(self.visible_widgets))
 
-    def doAction(self, action, target, profiles):
+    def do_action(self, action, target, profiles):
         """Launch an action handler by a plugin
 
         @param action(unicode): action to do, can be:
@@ -943,14 +943,14 @@
         try:
             # FIXME: Q&D way to get chat plugin, should be replaced by a clean method
             #        in host
-            plg_infos = [p for p in self.getPluggedWidgets()
+            plg_infos = [p for p in self.get_plugged_widgets()
                          if action in p['import_name']][0]
         except IndexError:
             log.warning("No plugin widget found to do {action}".format(action=action))
         else:
             try:
                 # does the widget already exist?
-                wid = next(self.widgets.getWidgets(
+                wid = next(self.widgets.get_widgets(
                     plg_infos['main'],
                     target=target,
                     profiles=profiles))
@@ -959,93 +959,93 @@
                 factory = plg_infos['factory']
                 wid = factory(plg_infos, target=target, profiles=profiles)
 
-            return self.switchWidget(None, wid)
+            return self.switch_widget(None, wid)
 
     ## bridge handlers ##
 
-    def otrStateHandler(self, state, dest_jid, profile):
+    def otr_state_handler(self, state, dest_jid, profile):
         """OTR state has changed for on destinee"""
         # XXX: this method could be in QuickApp but it's here as
         #      it's only used by Cagou so far
         dest_jid = jid.JID(dest_jid)
         bare_jid = dest_jid.bare
-        for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)):
+        for widget in self.widgets.get_widgets(quick_chat.QuickChat, profiles=(profile,)):
             if widget.type == C.CHAT_ONE2ONE and widget.target == bare_jid:
-                widget.onOTRState(state, dest_jid, profile)
+                widget.on_otr_state(state, dest_jid, profile)
 
-    def _debugHandler(self, action, parameters, profile):
+    def _debug_handler(self, action, parameters, profile):
         if action == "visible_widgets_dump":
             from pprint import pformat
             log.info("Visible widgets dump:\n{data}".format(
                 data=pformat(self._visible_widgets)))
         else:
-            return super(Cagou, self)._debugHandler(action, parameters, profile)
+            return super(Cagou, self)._debug_handler(action, parameters, profile)
 
-    def connectedHandler(self, jid_s, profile):
+    def connected_handler(self, jid_s, profile):
         # FIXME: this won't work with multiple profiles
-        super().connectedHandler(jid_s, profile)
+        super().connected_handler(jid_s, profile)
         self.app.connected = True
 
-    def disconnectedHandler(self, profile):
+    def disconnected_handler(self, profile):
         # FIXME: this won't work with multiple profiles
-        super().disconnectedHandler(profile)
+        super().disconnected_handler(profile)
         self.app.connected = False
 
     ## misc ##
 
     def plugging_profiles(self):
         self.widgets_handler = widgets_handler.WidgetsHandler()
-        self.app.root.changeWidget(self.widgets_handler)
+        self.app.root.change_widget(self.widgets_handler)
 
-    def setPresenceStatus(self, show='', status=None, profile=C.PROF_KEY_NONE):
+    def set_presence_status(self, show='', status=None, profile=C.PROF_KEY_NONE):
         log.info("Profile presence status set to {show}/{status}".format(show=show,
                                                                           status=status))
 
     def errback(self, failure_, title=_('error'),
                 message=_('error while processing: {msg}')):
-        self.addNote(title, message.format(msg=failure_), level=C.XMLUI_DATA_LVL_WARNING)
+        self.add_note(title, message.format(msg=failure_), level=C.XMLUI_DATA_LVL_WARNING)
 
-    def addNote(self, title, message, level=C.XMLUI_DATA_LVL_INFO, symbol=None,
+    def add_note(self, title, message, level=C.XMLUI_DATA_LVL_INFO, symbol=None,
         action=None):
         """add a note (message which disappear) to root widget's header"""
-        self.app.root.addNote(title, message, level, symbol, action)
+        self.app.root.add_note(title, message, level, symbol, action)
 
-    def addNotifUI(self, ui):
+    def add_notif_ui(self, ui):
         """add a notification with a XMLUI attached
 
         @param ui(xmlui.XMLUIPanel): XMLUI instance to show when notification is selected
         """
-        self.app.root.addNotifUI(ui)
+        self.app.root.add_notif_ui(ui)
 
-    def addNotifWidget(self, widget):
+    def add_notif_widget(self, widget):
         """add a notification with a Kivy widget attached
 
         @param widget(kivy.uix.Widget): widget to attach to notification
         """
-        self.app.root.addNotifWidget(widget)
+        self.app.root.add_notif_widget(widget)
 
-    def showUI(self, ui):
+    def show_ui(self, ui):
         """show a XMLUI"""
-        self.app.root.changeWidget(ui, "xmlui")
+        self.app.root.change_widget(ui, "xmlui")
         self.app.root.show("xmlui")
         self._selected_widget_main = self.selected_widget
         self.selected_widget = ui
 
-    def showExtraUI(self, widget):
+    def show_extra_ui(self, widget):
         """show any extra widget"""
-        self.app.root.changeWidget(widget, "extra")
+        self.app.root.change_widget(widget, "extra")
         self.app.root.show("extra")
         self._selected_widget_main = self.selected_widget
         self.selected_widget = widget
 
-    def closeUI(self):
+    def close_ui(self):
         self.app.root.show()
         self.selected_widget = self._selected_widget_main
         self._selected_widget_main = None
         screen = self.app.root._manager.get_screen("extra")
         screen.clear_widgets()
 
-    def getDefaultAvatar(self, entity=None):
+    def get_default_avatar(self, entity=None):
         return self.app.default_avatar
 
     def _dialog_cb(self, cb, *args, **kwargs):
@@ -1054,13 +1054,13 @@
         close dialog then call the callback with given arguments
         """
         def callback():
-            self.closeUI()
+            self.close_ui()
             cb(*args, **kwargs)
         return callback
 
-    def showDialog(self, message, title, type="info", answer_cb=None, answer_data=None):
+    def show_dialog(self, message, title, type="info", answer_cb=None, answer_data=None):
         if type in ('info', 'warning', 'error'):
-            self.addNote(title, message, type)
+            self.add_note(title, message, type)
         elif type == "yes/no":
             wid = dialog.ConfirmDialog(title=title, message=message,
                                        yes_cb=self._dialog_cb(answer_cb,
@@ -1070,19 +1070,19 @@
                                                              False,
                                                              answer_data)
                                        )
-            self.addNotifWidget(wid)
+            self.add_notif_widget(wid)
         else:
             log.warning(_("unknown dialog type: {dialog_type}").format(dialog_type=type))
 
     def share(self, media_type, data):
         share_wid = ShareWidget(media_type=media_type, data=data)
         try:
-            self.showExtraUI(share_wid)
+            self.show_extra_ui(share_wid)
         except Exception as e:
             log.error(e)
-            self.closeUI()
+            self.close_ui()
 
-    def downloadURL(
+    def download_url(
         self, url, callback, errback=None, options=None, dest=C.FILE_DEST_DOWNLOAD,
         profile=C.PROF_KEY_NONE):
         """Download an URL (decrypt it if necessary)
@@ -1094,7 +1094,7 @@
         @param dest(str): where the file should be downloaded:
             - C.FILE_DEST_DOWNLOAD: in platform download directory
             - C.FILE_DEST_CACHE: in SàT cache
-        @param options(dict, None): options to pass to bridge.fileDownloadComplete
+        @param options(dict, None): options to pass to bridge.file_download_complete
         """
         if not isinstance(url, urlparse.ParseResult):
             url = urlparse.urlparse(url)
@@ -1111,7 +1111,7 @@
             dest_path = ''
         else:
             raise exceptions.InternalError(f"Invalid dest_path: {dest_path!r}")
-        self.bridge.fileDownloadComplete(
+        self.bridge.file_download_complete(
             data_format.serialise({"uri": url.geturl()}),
             str(dest_path),
             '' if not options else data_format.serialise(options),
@@ -1146,13 +1146,13 @@
                     msg = e))
                 notification = None
 
-    def getParentWHWrapper(self, wid):
+    def get_parent_wh_wrapper(self, wid):
         """Retrieve parent WHWrapper instance managing a widget
 
         @param wid(Widget): widget to check
         @return (WHWrapper, None): found instance if any, else None
         """
-        wh = self.getAncestorWidget(wid, widgets_handler.WHWrapper)
+        wh = self.get_ancestor_widget(wid, widgets_handler.WHWrapper)
         if wh is None:
             # we may have a screen
             try:
@@ -1160,10 +1160,10 @@
             except (exceptions.InternalError, exceptions.NotFound):
                 return None
             else:
-                wh = self.getAncestorWidget(sm, widgets_handler.WHWrapper)
+                wh = self.get_ancestor_widget(sm, widgets_handler.WHWrapper)
         return wh
 
-    def getAncestorWidget(self, wid, cls):
+    def get_ancestor_widget(self, wid, cls):
         """Retrieve an ancestor of given class
 
         @param wid(Widget): current widget