diff sat_frontends/quick_frontend/quick_app.py @ 4037:524856bd7b19

massive refactoring to switch from camelCase to snake_case: historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a pre-PEP8 code, to use the same coding style as in Twisted. However, snake_case is more readable and it's better to follow PEP8 best practices, so it has been decided to move on full snake_case. Because Libervia has a huge codebase, this ended with a ugly mix of camelCase and snake_case. To fix that, this patch does a big refactoring by renaming every function and method (including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case. This is a massive change, and may result in some bugs.
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:54:42 +0200
parents 509f7a1c67dc
children 2594e1951cf7
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_app.py	Fri Apr 07 15:18:39 2023 +0200
+++ b/sat_frontends/quick_frontend/quick_app.py	Sat Apr 08 13:54:42 2023 +0200
@@ -63,23 +63,23 @@
     def plug(self):
         """Plug the profile to the host"""
         # first of all we create the contact lists
-        self.host.contact_lists.addProfile(self.profile)
+        self.host.contact_lists.add_profile(self.profile)
 
         # we get the essential params
-        self.bridge.asyncGetParamA(
+        self.bridge.param_get_a_async(
             "JabberID",
             "Connection",
             profile_key=self.profile,
             callback=self._plug_profile_jid,
-            errback=self._getParamError,
+            errback=self._get_param_error,
         )
 
     def _plug_profile_jid(self, jid_s):
         self.whoami = jid.JID(jid_s)  # resource might change after the connection
         log.info(f"Our current jid is: {self.whoami}")
-        self.bridge.isConnected(self.profile, callback=self._plug_profile_isconnected)
+        self.bridge.is_connected(self.profile, callback=self._plug_profile_isconnected)
 
-    def _autodisconnectEb(self, failure_):
+    def _autodisconnect_eb(self, failure_):
         # XXX: we ignore error on this parameter, as Libervia can't access it
         log.warning(
             _("Error while trying to get autodisconnect param, ignoring: {}").format(
@@ -91,24 +91,24 @@
     def _plug_profile_isconnected(self, connected):
         self.connected = connected
         if connected:
-            self.host.profileConnected(self.profile)
-        self.bridge.asyncGetParamA(
+            self.host.profile_connected(self.profile)
+        self.bridge.param_get_a_async(
             "autodisconnect",
             "Connection",
             profile_key=self.profile,
             callback=self._plug_profile_autodisconnect,
-            errback=self._autodisconnectEb,
+            errback=self._autodisconnect_eb,
         )
 
     def _plug_profile_autodisconnect(self, autodisconnect):
         if C.bool(autodisconnect):
             self._autodisconnect = True
-        self.bridge.asyncGetParamA(
+        self.bridge.param_get_a_async(
             "autoconnect",
             "Connection",
             profile_key=self.profile,
             callback=self._plug_profile_autoconnect,
-            errback=self._getParamError,
+            errback=self._get_param_error,
         )
 
     def _plug_profile_autoconnect(self, value_str):
@@ -124,79 +124,79 @@
         # Profile can be connected or not
         # we get cached data
         self.connected = True
-        self.host.bridge.getFeatures(
+        self.host.bridge.features_get(
             profile_key=self.profile,
-            callback=self._plug_profile_getFeaturesCb,
-            errback=self._plug_profile_getFeaturesEb,
+            callback=self._plug_profile_get_features_cb,
+            errback=self._plug_profile_get_features_eb,
         )
 
-    def _plug_profile_getFeaturesEb(self, failure):
+    def _plug_profile_get_features_eb(self, failure):
         log.error("Couldn't get features: {}".format(failure))
-        self._plug_profile_getFeaturesCb({})
+        self._plug_profile_get_features_cb({})
 
-    def _plug_profile_getFeaturesCb(self, features):
+    def _plug_profile_get_features_cb(self, features):
         self.host.features = features
-        self.host.bridge.getEntitiesData([], ProfileManager.cache_keys_to_get,
+        self.host.bridge.entities_data_get([], ProfileManager.cache_keys_to_get,
                                          profile=self.profile,
-                                         callback=self._plug_profile_gotCachedValues,
-                                         errback=self._plug_profile_failedCachedValues)
+                                         callback=self._plug_profile_got_cached_values,
+                                         errback=self._plug_profile_failed_cached_values)
 
-    def _plug_profile_failedCachedValues(self, failure):
+    def _plug_profile_failed_cached_values(self, failure):
         log.error("Couldn't get cached values: {}".format(failure))
-        self._plug_profile_gotCachedValues({})
+        self._plug_profile_got_cached_values({})
 
-    def _plug_profile_gotCachedValues(self, cached_values):
+    def _plug_profile_got_cached_values(self, cached_values):
         contact_list = self.host.contact_lists[self.profile]
         # add the contact list and its listener
         for entity_s, data in cached_values.items():
             for key, value in data.items():
-                self.host.entityDataUpdatedHandler(entity_s, key, value, self.profile)
+                self.host.entity_data_updated_handler(entity_s, key, value, self.profile)
 
         if not self.connected:
-            self.host.setPresenceStatus(C.PRESENCE_UNAVAILABLE, "", profile=self.profile)
+            self.host.set_presence_status(C.PRESENCE_UNAVAILABLE, "", profile=self.profile)
         else:
 
             contact_list.fill()
-            self.host.setPresenceStatus(profile=self.profile)
+            self.host.set_presence_status(profile=self.profile)
 
             # The waiting subscription requests
-            self.bridge.getWaitingSub(
-                self.profile, callback=self._plug_profile_gotWaitingSub
+            self.bridge.sub_waiting_get(
+                self.profile, callback=self._plug_profile_got_waiting_sub
             )
 
-    def _plug_profile_gotWaitingSub(self, waiting_sub):
+    def _plug_profile_got_waiting_sub(self, waiting_sub):
         for sub in waiting_sub:
-            self.host.subscribeHandler(waiting_sub[sub], sub, self.profile)
+            self.host.subscribe_handler(waiting_sub[sub], sub, self.profile)
 
-        self.bridge.mucGetRoomsJoined(
-            self.profile, callback=self._plug_profile_gotRoomsJoined
+        self.bridge.muc_get_rooms_joined(
+            self.profile, callback=self._plug_profile_got_rooms_joined
         )
 
-    def _plug_profile_gotRoomsJoined(self, rooms_args):
+    def _plug_profile_got_rooms_joined(self, rooms_args):
         # Now we open the MUC window where we already are:
         for room_args in rooms_args:
-            self.host.mucRoomJoinedHandler(*room_args, profile=self.profile)
+            self.host.muc_room_joined_handler(*room_args, profile=self.profile)
         # Presence must be requested after rooms are filled
-        self.host.bridge.getPresenceStatuses(
-            self.profile, callback=self._plug_profile_gotPresences
+        self.host.bridge.presence_statuses_get(
+            self.profile, callback=self._plug_profile_got_presences
         )
 
-    def _plug_profile_gotPresences(self, presences):
+    def _plug_profile_got_presences(self, presences):
         for contact in presences:
             for res in presences[contact]:
                 jabber_id = ("%s/%s" % (jid.JID(contact).bare, res)) if res else contact
                 show = presences[contact][res][0]
                 priority = presences[contact][res][1]
                 statuses = presences[contact][res][2]
-                self.host.presenceUpdateHandler(
+                self.host.presence_update_handler(
                     jabber_id, show, priority, statuses, self.profile
                 )
 
         # At this point, profile should be fully plugged
         # and we launch frontend specific method
-        self.host.profilePlugged(self.profile)
+        self.host.profile_plugged(self.profile)
 
-    def _getParamError(self, failure):
+    def _get_param_error(self, failure):
         log.error(_("Can't get profile parameter: {msg}").format(msg=failure))
 
 
@@ -242,7 +242,7 @@
 
         del self._profiles[profile]
 
-    def chooseOneProfile(self):
+    def choose_one_profile(self):
         return list(self._profiles.keys())[0]
 
 
@@ -260,7 +260,7 @@
     def __init__(self, bridge_factory, xmlui, check_options=None, connect_bridge=True):
         """Create a frontend application
 
-        @param bridge_factory: method to use to create the Bridge
+        @param bridge_factory: method to use to create the bridge
         @param xmlui: xmlui module
         @param check_options: method to call to check options (usually command line
             arguments)
@@ -297,7 +297,7 @@
         self.bridge = bridge_factory()
         ProfileManager.bridge = self.bridge
         if connect_bridge:
-            self.connectBridge()
+            self.connect_bridge()
 
         # frontend notifications
         self._notif_id = 0
@@ -314,58 +314,58 @@
         # state of synchronisation with backend
         self._sync = True
 
-    def connectBridge(self):
-        self.bridge.bridgeConnect(callback=self._bridgeCb, errback=self._bridgeEb)
+    def connect_bridge(self):
+        self.bridge.bridge_connect(callback=self._bridge_cb, errback=self._bridge_eb)
 
-    def _namespacesGetCb(self, ns_map):
+    def _namespaces_get_cb(self, ns_map):
         self.ns_map = ns_map
 
-    def _namespacesGetEb(self, failure_):
+    def _namespaces_get_eb(self, failure_):
         log.error(_("Can't get namespaces map: {msg}").format(msg=failure_))
 
-    def _encryptionPluginsGetCb(self, plugins_ser):
+    def _encryption_plugins_get_cb(self, plugins_ser):
         self.encryption_plugins = data_format.deserialise(plugins_ser, type_check=list)
 
-    def _encryptionPluginsGetEb(self, failure_):
+    def _encryption_plugins_get_eb(self, failure_):
         log.warning(_("Can't retrieve encryption plugins: {msg}").format(msg=failure_))
 
-    def onBridgeConnected(self):
-        self.bridge.getReady(self.onBackendReady)
+    def on_bridge_connected(self):
+        self.bridge.ready_get(self.on_backend_ready)
 
-    def _bridgeCb(self):
-        self.registerSignal("connected")
-        self.registerSignal("disconnected")
-        self.registerSignal("actionNew")
-        self.registerSignal("newContact")
-        self.registerSignal("messageNew")
+    def _bridge_cb(self):
+        self.register_signal("connected")
+        self.register_signal("disconnected")
+        self.register_signal("action_new")
+        self.register_signal("contact_new")
+        self.register_signal("message_new")
         if self.ENCRYPTION_HANDLERS:
-            self.registerSignal("messageEncryptionStarted")
-            self.registerSignal("messageEncryptionStopped")
-        self.registerSignal("presenceUpdate")
-        self.registerSignal("subscribe")
-        self.registerSignal("paramUpdate")
-        self.registerSignal("contactDeleted")
-        self.registerSignal("entityDataUpdated")
-        self.registerSignal("progressStarted")
-        self.registerSignal("progressFinished")
-        self.registerSignal("progressError")
-        self.registerSignal("mucRoomJoined", iface="plugin")
-        self.registerSignal("mucRoomLeft", iface="plugin")
-        self.registerSignal("mucRoomUserChangedNick", iface="plugin")
-        self.registerSignal("mucRoomNewSubject", iface="plugin")
-        self.registerSignal("chatStateReceived", iface="plugin")
-        self.registerSignal("messageState", iface="plugin")
-        self.registerSignal("psEvent", iface="plugin")
+            self.register_signal("message_encryption_started")
+            self.register_signal("message_encryption_stopped")
+        self.register_signal("presence_update")
+        self.register_signal("subscribe")
+        self.register_signal("param_update")
+        self.register_signal("contact_deleted")
+        self.register_signal("entity_data_updated")
+        self.register_signal("progress_started")
+        self.register_signal("progress_finished")
+        self.register_signal("progress_error")
+        self.register_signal("muc_room_joined", iface="plugin")
+        self.register_signal("muc_room_left", iface="plugin")
+        self.register_signal("muc_room_user_changed_nick", iface="plugin")
+        self.register_signal("muc_room_new_subject", iface="plugin")
+        self.register_signal("chat_state_received", iface="plugin")
+        self.register_signal("message_state", iface="plugin")
+        self.register_signal("ps_event", iface="plugin")
         # useful for debugging
-        self.registerSignal("_debug", iface="core")
+        self.register_signal("_debug", iface="core")
 
         # FIXME: do it dynamically
-        quick_games.Tarot.registerSignals(self)
-        quick_games.Quiz.registerSignals(self)
-        quick_games.Radiocol.registerSignals(self)
-        self.onBridgeConnected()
+        quick_games.Tarot.register_signals(self)
+        quick_games.Quiz.register_signals(self)
+        quick_games.Radiocol.register_signals(self)
+        self.on_bridge_connected()
 
-    def _bridgeEb(self, failure):
+    def _bridge_eb(self, failure):
         if isinstance(failure, exceptions.BridgeExceptionNoService):
             print((_("Can't connect to SàT backend, are you sure it's launched ?")))
             sys.exit(C.EXIT_BACKEND_NOT_FOUND)
@@ -375,15 +375,15 @@
         else:
             print((_("Error while initialising bridge: {}".format(failure))))
 
-    def onBackendReady(self):
+    def on_backend_ready(self):
         log.info("backend is ready")
-        self.bridge.namespacesGet(
-            callback=self._namespacesGetCb, errback=self._namespacesGetEb)
+        self.bridge.namespaces_get(
+            callback=self._namespaces_get_cb, errback=self._namespaces_get_eb)
         # we cache available encryption plugins, as we'll use them on each
         # new chat widget
-        self.bridge.encryptionPluginsGet(
-            callback=self._encryptionPluginsGetCb,
-            errback=self._encryptionPluginsGetEb)
+        self.bridge.encryption_plugins_get(
+            callback=self._encryption_plugins_get_cb,
+            errback=self._encryption_plugins_get_eb)
 
 
     @property
@@ -392,7 +392,7 @@
         try:
             return self.selected_widget.profile
         except (TypeError, AttributeError):
-            return self.profiles.chooseOneProfile()
+            return self.profiles.choose_one_profile()
 
     @property
     def visible_widgets(self):
@@ -434,13 +434,13 @@
             return
         self._selected_widget = wid
         try:
-            onSelected = wid.onSelected
+            on_selected = wid.on_selected
         except AttributeError:
             pass
         else:
-            onSelected()
+            on_selected()
 
-        self.callListeners("selected", wid)
+        self.call_listeners("selected", wid)
 
     # backend state management
 
@@ -486,7 +486,7 @@
                 except AttributeError:
                     pass
 
-    def registerSignal(
+    def register_signal(
         self, function_name, handler=None, iface="core", with_profile=True
     ):
         """Register a handler for a signal
@@ -500,12 +500,12 @@
         """
         log.debug("registering signal {name}".format(name=function_name))
         if handler is None:
-            handler = getattr(self, "{}{}".format(function_name, "Handler"))
+            handler = getattr(self, "{}{}".format(function_name, "_handler"))
         if not with_profile:
             self.bridge.register_signal(function_name, handler, iface)
             return
 
-        def signalReceived(*args, **kwargs):
+        def signal_received(*args, **kwargs):
             profile = kwargs.get("profile")
             if profile is None:
                 if not args:
@@ -522,7 +522,7 @@
                     return  # we ignore signal for profiles we don't manage
             handler(*args, **kwargs)
 
-        self.bridge.register_signal(function_name, signalReceived, iface)
+        self.bridge.register_signal(function_name, signal_received, iface)
 
     def addListener(self, type_, callback, profiles_filter=None):
         """Add a listener for an event
@@ -551,15 +551,15 @@
                 args: (widget_deleted,)
             - menu: called when a menu item is added or removed
                 args: (type_, path, path_i18n, item) were values are:
-                    type_: same as in [sat.core.sat_main.SAT.importMenu]
-                    path: same as in [sat.core.sat_main.SAT.importMenu]
+                    type_: same as in [sat.core.sat_main.SAT.import_menu]
+                    path: same as in [sat.core.sat_main.SAT.import_menu]
                     path_i18n: translated path (or None if the item is removed)
                     item: instance of quick_menus.MenuItemBase or None if the item is
                           removed
             - gotMenus: called only once when menu are available (no arg)
-            - progressFinished: called when a progressing action has just finished
+            - progress_finished: called when a progressing action has just finished
                 args:  (progress_id, metadata, profile)
-            - progressError: called when a progressing action failed
+            - progress_error: called when a progressing action failed
                 args: (progress_id, error_msg, profile):
         @param callback: method to call on event
         @param profiles_filter (set[unicode]): if set and not empty, the
@@ -585,7 +585,7 @@
                     f"Trying to remove an inexisting listener (type = {type_}): "
                     f"{callback}")
 
-    def callListeners(self, type_, *args, **kwargs):
+    def call_listeners(self, type_, *args, **kwargs):
         """Call the methods which listen type_ event. If a profiles filter has
         been register with a listener and profile argument is not None, the
         listener will be called only if profile is in the profiles filter list.
@@ -609,7 +609,7 @@
         """Tell if the profile is currently followed by the application, and ready"""
         return profile in self.ready_profiles
 
-    def postInit(self, profile_manager):
+    def post_init(self, profile_manager):
         """Must be called after initialization is done, do all automatic task
 
         (auto plug profile)
@@ -619,7 +619,7 @@
         if self.options and self.options.profile:
             profile_manager.autoconnect([self.options.profile])
 
-    def profilePlugged(self, profile):
+    def profile_plugged(self, profile):
         """Method called when the profile is fully plugged
 
         This will launch frontend specific workflow
@@ -641,15 +641,15 @@
             )
             handler(*args, **kwargs)
 
-        self.callListeners("profilePlugged", profile=profile)
+        self.call_listeners("profile_plugged", profile=profile)
         if not self._plugs_in_progress:
-            self.contact_lists.lockUpdate(False)
+            self.contact_lists.lock_update(False)
 
-    def profileConnected(self, profile):
+    def profile_connected(self, profile):
         """Called when a plugged profile is connected
 
-        it is called independently of profilePlugged (may be called before or after
-        profilePlugged)
+        it is called independently of profile_plugged (may be called before or after
+        profile_plugged)
         """
         pass
 
@@ -676,9 +676,9 @@
                     module.startswith("twisted.words.protocols.jabber")
                     and failure.condition == "not-authorized"
                 ):
-                    self.launchAction(C.CHANGE_XMPP_PASSWD_ID, {}, profile=profile)
+                    self.action_launch(C.CHANGE_XMPP_PASSWD_ID, {}, profile=profile)
                 else:
-                    self.showDialog(message, fullname, "error")
+                    self.show_dialog(message, fullname, "error")
 
         self.bridge.connect(profile, callback=callback, errback=errback)
 
@@ -687,7 +687,7 @@
 
         @param profiles: list of valid profile names
         """
-        self.contact_lists.lockUpdate()
+        self.contact_lists.lock_update()
         self._plugs_in_progress.update(profiles)
         self.plugging_profiles()
         for profile in profiles:
@@ -709,12 +709,12 @@
     def clear_profile(self):
         self.profiles.clear()
 
-    def newWidget(self, widget):
+    def new_widget(self, widget):
         raise NotImplementedError
 
     # bridge signals hanlers
 
-    def connectedHandler(self, jid_s, profile):
+    def connected_handler(self, jid_s, profile):
         """Called when the connection is made.
 
         @param jid_s (unicode): the JID that we were assigned by the server,
@@ -722,7 +722,7 @@
         """
         log.debug(_("Connected"))
         self.profiles[profile].whoami = jid.JID(jid_s)
-        self.setPresenceStatus(profile=profile)
+        self.set_presence_status(profile=profile)
         # FIXME: fill() is already called for all profiles when doing self.sync = True
         #        a per-profile fill() should be done once, see below note
         self.contact_lists[profile].fill()
@@ -732,25 +732,25 @@
         #        A mechanism similar to sync should be available
         #        on a per-profile basis
         self.sync = True
-        self.profileConnected(profile)
+        self.profile_connected(profile)
 
-    def disconnectedHandler(self, profile):
+    def disconnected_handler(self, profile):
         """called when the connection is closed"""
         log.debug(_("Disconnected"))
         self.contact_lists[profile].disconnect()
-        # FIXME: see note on connectedHandler
+        # FIXME: see note on connected_handler
         self.sync = False
-        self.setPresenceStatus(C.PRESENCE_UNAVAILABLE, "", profile=profile)
+        self.set_presence_status(C.PRESENCE_UNAVAILABLE, "", profile=profile)
 
-    def actionNewHandler(self, action_data, id_, security_limit, profile):
-        self.actionManager(action_data, user_action=False, profile=profile)
+    def action_new_handler(self, action_data, id_, security_limit, profile):
+        self.action_manager(action_data, user_action=False, profile=profile)
 
-    def newContactHandler(self, jid_s, attributes, groups, profile):
+    def contact_new_handler(self, jid_s, attributes, groups, profile):
         entity = jid.JID(jid_s)
         groups = list(groups)
-        self.contact_lists[profile].setContact(entity, groups, attributes, in_roster=True)
+        self.contact_lists[profile].set_contact(entity, groups, attributes, in_roster=True)
 
-    def messageNewHandler(
+    def message_new_handler(
             self, uid, timestamp, from_jid_s, to_jid_s, msg, subject, type_, extra_s,
             profile):
         from_jid = jid.JID(from_jid_s)
@@ -767,7 +767,7 @@
         contact_list = self.contact_lists[profile]
 
         try:
-            is_room = contact_list.isRoom(target)
+            is_room = contact_list.is_room(target)
         except exceptions.NotFound:
             is_room = False
 
@@ -776,7 +776,7 @@
             # messages
             target = target
         # we want to be sure to have at least one QuickChat instance
-        self.widgets.getOrCreateWidget(
+        self.widgets.get_or_create_widget(
             quick_chat.QuickChat,
             target,
             type_ = C.CHAT_GROUP if is_room else C.CHAT_ONE2ONE,
@@ -790,36 +790,36 @@
         ):
             # XXX: needed to show entities which haven't sent any
             #     presence information and which are not in roster
-            contact_list.setContact(from_jid)
+            contact_list.set_contact(from_jid)
 
         # we dispatch the message in the widgets
-        for widget in self.widgets.getWidgets(
+        for widget in self.widgets.get_widgets(
             quick_chat.QuickChat, target=target, profiles=(profile,)
         ):
-            widget.messageNew(
+            widget.message_new(
                 uid, timestamp, from_jid, mess_to_jid, msg, subject, type_, extra, profile
             )
 
-    def messageEncryptionStartedHandler(self, destinee_jid_s, plugin_data, profile):
+    def message_encryption_started_handler(self, destinee_jid_s, plugin_data, profile):
         destinee_jid = jid.JID(destinee_jid_s)
         plugin_data = data_format.deserialise(plugin_data)
-        for widget in self.widgets.getWidgets(quick_chat.QuickChat,
+        for widget in self.widgets.get_widgets(quick_chat.QuickChat,
                                               target=destinee_jid.bare,
                                               profiles=(profile,)):
-            widget.messageEncryptionStarted(plugin_data)
+            widget.message_encryption_started(plugin_data)
 
-    def messageEncryptionStoppedHandler(self, destinee_jid_s, plugin_data, profile):
+    def message_encryption_stopped_handler(self, destinee_jid_s, plugin_data, profile):
         destinee_jid = jid.JID(destinee_jid_s)
-        for widget in self.widgets.getWidgets(quick_chat.QuickChat,
+        for widget in self.widgets.get_widgets(quick_chat.QuickChat,
                                               target=destinee_jid.bare,
                                               profiles=(profile,)):
-            widget.messageEncryptionStopped(plugin_data)
+            widget.message_encryption_stopped(plugin_data)
 
-    def messageStateHandler(self, uid, status, profile):
-        for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)):
-            widget.onMessageState(uid, status, profile)
+    def message_state_handler(self, uid, status, profile):
+        for widget in self.widgets.get_widgets(quick_chat.QuickChat, profiles=(profile,)):
+            widget.on_message_state(uid, status, profile)
 
-    def messageSend(self, to_jid, message, subject=None, mess_type="auto", extra=None, callback=None, errback=None, profile_key=C.PROF_KEY_NONE):
+    def message_send(self, to_jid, message, subject=None, mess_type="auto", extra=None, callback=None, errback=None, profile_key=C.PROF_KEY_NONE):
         if not subject and not extra and (not message or message == {'': ''}):
             log.debug("Not sending empty message")
             return
@@ -834,14 +834,14 @@
             )  # FIXME: optional argument is here because pyjamas doesn't support callback
                #        without arg with json proxy
         if errback is None:
-            errback = lambda failure: self.showDialog(
+            errback = lambda failure: self.show_dialog(
                 message=failure.message, title=failure.fullname, type="error"
             )
 
         if not self.trigger.point("messageSendTrigger", to_jid, message, subject, mess_type, extra, callback, errback, profile_key=profile_key):
             return
 
-        self.bridge.messageSend(
+        self.bridge.message_send(
             str(to_jid),
             message,
             subject,
@@ -852,10 +852,10 @@
             errback=errback,
         )
 
-    def setPresenceStatus(self, show="", status=None, profile=C.PROF_KEY_NONE):
+    def set_presence_status(self, show="", status=None, profile=C.PROF_KEY_NONE):
         raise NotImplementedError
 
-    def presenceUpdateHandler(self, entity_s, show, priority, statuses, profile):
+    def presence_update_handler(self, entity_s, show, priority, statuses, profile):
         # XXX: this log is commented because it's really too verbose even for DEBUG logs
         #      but it is kept here as it may still be useful for troubleshooting
         # log.debug(
@@ -875,16 +875,16 @@
 
         if entity == self.profiles[profile].whoami:
             if show == C.PRESENCE_UNAVAILABLE:
-                self.setPresenceStatus(C.PRESENCE_UNAVAILABLE, "", profile=profile)
+                self.set_presence_status(C.PRESENCE_UNAVAILABLE, "", profile=profile)
             else:
                 # FIXME: try to retrieve user language status before fallback to default
                 status = statuses.get(C.PRESENCE_STATUSES_DEFAULT, None)
-                self.setPresenceStatus(show, status, profile=profile)
+                self.set_presence_status(show, status, profile=profile)
             return
 
-        self.callListeners("presence", entity, show, priority, statuses, profile=profile)
+        self.call_listeners("presence", entity, show, priority, statuses, profile=profile)
 
-    def mucRoomJoinedHandler(
+    def muc_room_joined_handler(
             self, room_jid_s, occupants, user_nick, subject, statuses, profile):
         """Called when a MUC room is joined"""
         log.debug(
@@ -893,8 +893,8 @@
             )
         )
         room_jid = jid.JID(room_jid_s)
-        self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP)
-        self.widgets.getOrCreateWidget(
+        self.contact_lists[profile].set_special(room_jid, C.CONTACT_SPECIAL_GROUP)
+        self.widgets.get_or_create_widget(
             quick_chat.QuickChat,
             room_jid,
             type_=C.CHAT_GROUP,
@@ -905,44 +905,44 @@
             profile=profile,
         )
 
-    def mucRoomLeftHandler(self, room_jid_s, profile):
+    def muc_room_left_handler(self, room_jid_s, profile):
         """Called when a MUC room is left"""
         log.debug(
             "Room [%(room_jid)s] left by %(profile)s"
             % {"room_jid": room_jid_s, "profile": profile}
         )
         room_jid = jid.JID(room_jid_s)
-        chat_widget = self.widgets.getWidget(quick_chat.QuickChat, room_jid, profile)
+        chat_widget = self.widgets.get_widget(quick_chat.QuickChat, room_jid, profile)
         if chat_widget:
-            self.widgets.deleteWidget(
+            self.widgets.delete_widget(
                 chat_widget, all_instances=True, explicit_close=True)
-        self.contact_lists[profile].removeContact(room_jid)
+        self.contact_lists[profile].remove_contact(room_jid)
 
-    def mucRoomUserChangedNickHandler(self, room_jid_s, old_nick, new_nick, profile):
+    def muc_room_user_changed_nick_handler(self, room_jid_s, old_nick, new_nick, profile):
         """Called when an user joined a MUC room"""
         room_jid = jid.JID(room_jid_s)
-        chat_widget = self.widgets.getOrCreateWidget(
+        chat_widget = self.widgets.get_or_create_widget(
             quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile
         )
-        chat_widget.changeUserNick(old_nick, new_nick)
+        chat_widget.change_user_nick(old_nick, new_nick)
         log.debug(
             "user [%(old_nick)s] is now known as [%(new_nick)s] in room [%(room_jid)s]"
             % {"old_nick": old_nick, "new_nick": new_nick, "room_jid": room_jid}
         )
 
-    def mucRoomNewSubjectHandler(self, room_jid_s, subject, profile):
+    def muc_room_new_subject_handler(self, room_jid_s, subject, profile):
         """Called when subject of MUC room change"""
         room_jid = jid.JID(room_jid_s)
-        chat_widget = self.widgets.getOrCreateWidget(
+        chat_widget = self.widgets.get_or_create_widget(
             quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile
         )
-        chat_widget.setSubject(subject)
+        chat_widget.set_subject(subject)
         log.debug(
             "new subject for room [%(room_jid)s]: %(subject)s"
             % {"room_jid": room_jid, "subject": subject}
         )
 
-    def chatStateReceivedHandler(self, from_jid_s, state, profile):
+    def chat_state_received_handler(self, from_jid_s, state, profile):
         """Called when a new chat state (XEP-0085) is received.
 
         @param from_jid_s (unicode): JID of a contact or C.ENTITY_ALL
@@ -950,9 +950,9 @@
         @param profile (unicode): current profile
         """
         from_jid = jid.JID(from_jid_s)
-        for widget in self.widgets.getWidgets(quick_chat.QuickChat, target=from_jid.bare,
+        for widget in self.widgets.get_widgets(quick_chat.QuickChat, target=from_jid.bare,
                                               profiles=(profile,)):
-            widget.onChatState(from_jid, state, profile)
+            widget.on_chat_state(from_jid, state, profile)
 
     def notify(self, type_, entity=None, message=None, subject=None, callback=None,
                cb_args=None, widget=None, profile=C.PROF_KEY_NONE):
@@ -986,9 +986,9 @@
         type_notifs.append(notif_data)
         self._notifications[self._notif_id] = notif_data
         self._notif_id += 1
-        self.callListeners("notification", entity, notif_data, profile=profile)
+        self.call_listeners("notification", entity, notif_data, profile=profile)
 
-    def getNotifs(self, entity=None, type_=None, exact_jid=None, profile=C.PROF_KEY_NONE):
+    def get_notifs(self, entity=None, type_=None, exact_jid=None, profile=C.PROF_KEY_NONE):
         """return notifications for given entity
 
         @param entity(jid.JID, None, C.ENTITY_ALL): jid of the entity to check
@@ -1032,7 +1032,7 @@
                         continue
                     yield notif
 
-    def clearNotifs(self, entity, type_=None, profile=C.PROF_KEY_NONE):
+    def clear_notifs(self, entity, type_=None, profile=C.PROF_KEY_NONE):
         """return notifications for given entity
 
         @param entity(jid.JID, None): bare jid of the entity to check
@@ -1050,9 +1050,9 @@
                 del notif_dict[key][type_]
         except KeyError:
             return
-        self.callListeners("notificationsClear", entity, type_, profile=profile)
+        self.call_listeners("notificationsClear", entity, type_, profile=profile)
 
-    def psEventHandler(self, category, service_s, node, event_type, data, profile):
+    def ps_event_handler(self, category, service_s, node, event_type, data, profile):
         """Called when a PubSub event is received.
 
         @param category(unicode): event category (e.g. "PEP", "MICROBLOG")
@@ -1073,8 +1073,8 @@
                 # FIXME: check if [] make sense (instead of None)
                 _groups = data.get("group")
 
-                for wid in self.widgets.getWidgets(quick_blog.QuickBlog):
-                    wid.addEntryIfAccepted(service_s, node, data, _groups, profile)
+                for wid in self.widgets.get_widgets(quick_blog.QuickBlog):
+                    wid.add_entry_if_accepted(service_s, node, data, _groups, profile)
 
                 try:
                     comments_node, comments_service = (
@@ -1084,7 +1084,7 @@
                 except KeyError:
                     pass
                 else:
-                    self.bridge.mbGet(
+                    self.bridge.mb_get(
                         comments_service,
                         comments_node,
                         C.NO_LIMIT,
@@ -1093,13 +1093,13 @@
                         profile=profile,
                     )
             elif event_type == C.PS_RETRACT:
-                for wid in self.widgets.getWidgets(quick_blog.QuickBlog):
-                    wid.deleteEntryIfPresent(service_s, node, data["id"], profile)
+                for wid in self.widgets.get_widgets(quick_blog.QuickBlog):
+                    wid.delete_entry_if_present(service_s, node, data["id"], profile)
                 pass
             else:
                 log.warning("Unmanaged PubSub event type {}".format(event_type))
 
-    def registerProgressCbs(self, progress_id, callback, errback):
+    def register_progress_cbs(self, progress_id, callback, errback):
         """Register progression callbacks
 
         @param progress_id(unicode): id of the progression to check
@@ -1112,10 +1112,10 @@
         callbacks = self._progress_ids.setdefault(progress_id, [])
         callbacks.append((callback, errback))
 
-    def progressStartedHandler(self, pid, metadata, profile):
+    def progress_started_handler(self, pid, metadata, profile):
         log.info("Progress {} started".format(pid))
 
-    def progressFinishedHandler(self, pid, metadata, profile):
+    def progress_finished_handler(self, pid, metadata, profile):
         log.info("Progress {} finished".format(pid))
         try:
             callbacks = self._progress_ids.pop(pid)
@@ -1125,9 +1125,9 @@
             for callback, __ in callbacks:
                 if callback is not None:
                     callback(metadata, profile=profile)
-        self.callListeners("progressFinished", pid, metadata, profile=profile)
+        self.call_listeners("progress_finished", pid, metadata, profile=profile)
 
-    def progressErrorHandler(self, pid, err_msg, profile):
+    def progress_error_handler(self, pid, err_msg, profile):
         log.warning("Progress {pid} error: {err_msg}".format(pid=pid, err_msg=err_msg))
         try:
             callbacks = self._progress_ids.pop(pid)
@@ -1137,20 +1137,20 @@
             for __, errback in callbacks:
                 if errback is not None:
                     errback(err_msg, profile=profile)
-        self.callListeners("progressError", pid, err_msg, profile=profile)
+        self.call_listeners("progress_error", pid, err_msg, profile=profile)
 
     def _subscribe_cb(self, answer, data):
         entity, profile = data
         type_ = "subscribed" if answer else "unsubscribed"
         self.bridge.subscription(type_, str(entity.bare), profile_key=profile)
 
-    def subscribeHandler(self, type, raw_jid, profile):
+    def subscribe_handler(self, type, raw_jid, profile):
         """Called when a subsciption management signal is received"""
         entity = jid.JID(raw_jid)
         if type == "subscribed":
             # this is a subscription confirmation, we just have to inform user
             # TODO: call self.getEntityMBlog to add the new contact blogs
-            self.showDialog(
+            self.show_dialog(
                 _("The contact {contact} has accepted your subscription").format(
                     contact=entity.bare
                 ),
@@ -1158,7 +1158,7 @@
             )
         elif type == "unsubscribed":
             # this is a subscription refusal, we just have to inform user
-            self.showDialog(
+            self.show_dialog(
                 _("The contact {contact} has refused your subscription").format(
                     contact=entity.bare
                 ),
@@ -1168,7 +1168,7 @@
         elif type == "subscribe":
             # this is a subscriptionn request, we have to ask for user confirmation
             # TODO: use sat.stdui.ui_contact_list to display the groups selector
-            self.showDialog(
+            self.show_dialog(
                 _(
                     "The contact {contact} wants to subscribe to your presence"
                     ".\nDo you accept ?"
@@ -1179,7 +1179,7 @@
                 answer_data=(entity, profile),
             )
 
-    def _debugHandler(self, action, parameters, profile):
+    def _debug_handler(self, action, parameters, profile):
         if action == "widgets_dump":
             from pprint import pformat
             log.info("Widgets dump:\n{data}".format(data=pformat(self.widgets._widgets)))
@@ -1187,7 +1187,7 @@
             log.warning("Unknown debug action: {action}".format(action=action))
 
 
-    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):
         """Show a dialog to user
 
         Frontends must override this method
@@ -1206,25 +1206,25 @@
         # FIXME: misnamed method + types are not well chosen. Need to be rethought
         raise NotImplementedError
 
-    def showAlert(self, message):
+    def show_alert(self, message):
         # FIXME: doesn't seems used anymore, to remove?
         pass  # FIXME
 
-    def dialogFailure(self, failure):
+    def dialog_failure(self, failure):
         log.warning("Failure: {}".format(failure))
 
-    def progressIdHandler(self, progress_id, profile):
+    def progress_id_handler(self, progress_id, profile):
         """Callback used when an action result in a progress id"""
         log.info("Progress ID received: {}".format(progress_id))
 
-    def isHidden(self):
+    def is_hidden(self):
         """Tells if the frontend window is hidden.
 
         @return bool
         """
         raise NotImplementedError
 
-    def paramUpdateHandler(self, name, value, namespace, profile):
+    def param_update_handler(self, name, value, namespace, profile):
         log.debug(
             _("param update: [%(namespace)s] %(name)s = %(value)s")
             % {"namespace": namespace, "name": name, "value": value}
@@ -1233,37 +1233,37 @@
             log.debug(_("Changing JID to %s") % value)
             self.profiles[profile].whoami = jid.JID(value)
         elif (namespace, name) == ("General", C.SHOW_OFFLINE_CONTACTS):
-            self.contact_lists[profile].showOfflineContacts(C.bool(value))
+            self.contact_lists[profile].show_offline_contacts(C.bool(value))
         elif (namespace, name) == ("General", C.SHOW_EMPTY_GROUPS):
-            self.contact_lists[profile].showEmptyGroups(C.bool(value))
+            self.contact_lists[profile].show_empty_groups(C.bool(value))
 
-    def contactDeletedHandler(self, jid_s, profile):
+    def contact_deleted_handler(self, jid_s, profile):
         target = jid.JID(jid_s)
-        self.contact_lists[profile].removeContact(target)
+        self.contact_lists[profile].remove_contact(target)
 
-    def entityDataUpdatedHandler(self, entity_s, key, value_raw, profile):
+    def entity_data_updated_handler(self, entity_s, key, value_raw, profile):
         entity = jid.JID(entity_s)
         value = data_format.deserialise(value_raw, type_check=None)
         if key == "nicknames":
             assert isinstance(value, list) or value is None
             if entity in self.contact_lists[profile]:
-                self.contact_lists[profile].setCache(entity, "nicknames", value)
-                self.callListeners("nicknames", entity, value, profile=profile)
+                self.contact_lists[profile].set_cache(entity, "nicknames", value)
+                self.call_listeners("nicknames", entity, value, profile=profile)
         elif key == "avatar" and self.AVATARS_HANDLER:
             assert isinstance(value, dict) or value is None
-            self.contact_lists[profile].setCache(entity, "avatar", value)
-            self.callListeners("avatar", entity, value, profile=profile)
+            self.contact_lists[profile].set_cache(entity, "avatar", value)
+            self.call_listeners("avatar", entity, value, profile=profile)
 
-    def actionManager(self, action_data, callback=None, ui_show_cb=None, user_action=True,
+    def action_manager(self, action_data, callback=None, ui_show_cb=None, user_action=True,
                       progress_cb=None, progress_eb=None, profile=C.PROF_KEY_NONE):
         """Handle backend action
 
-        @param action_data(dict): action dict as sent by launchAction or returned by an
+        @param action_data(dict): action dict as sent by action_launch or returned by an
             UI action
         @param callback(None, callback): if not None, callback to use on XMLUI answer
         @param ui_show_cb(None, callback): if not None, method to call to show the XMLUI
         @param user_action(bool): if True, the action is a result of a user interaction
-            else the action come from backend direclty (i.e. actionNew).
+            else the action come from backend direclty (i.e. action_new).
             This is useful to know if the frontend can display a popup immediately (if
             True) or if it should add it to a queue that the user can activate later.
         @param progress_cb(None, callable): method to call when progression is finished.
@@ -1295,8 +1295,8 @@
             pass
         else:
             if progress_cb or progress_eb:
-                self.registerProgressCbs(progress_id, progress_cb, progress_eb)
-            self.progressIdHandler(progress_id, profile)
+                self.register_progress_cbs(progress_id, progress_cb, progress_eb)
+            self.progress_id_handler(progress_id, profile)
 
         # we ignore metadata
         action_data = {
@@ -1310,13 +1310,13 @@
                 )
             )
 
-    def _actionCb(self, data, callback, callback_id, profile):
+    def _action_cb(self, data, callback, callback_id, profile):
         if callback is None:
-            self.actionManager(data, profile=profile)
+            self.action_manager(data, profile=profile)
         else:
             callback(data=data, cb_id=callback_id, profile=profile)
 
-    def launchAction(
+    def action_launch(
         self, callback_id, data=None, callback=None, profile=C.PROF_KEY_NONE
     ):
         """Launch a dynamic action
@@ -1324,7 +1324,7 @@
         @param callback_id: id of the action to launch
         @param data: data needed only for certain actions
         @param callback(callable, None): will be called with the resut
-            if None, self.actionManager will be called
+            if None, self.action_manager will be called
             else the callable will be called with the following kw parameters:
                 - data: action_data
                 - cb_id: callback id
@@ -1334,12 +1334,12 @@
         """
         if data is None:
             data = dict()
-        action_cb = lambda data: self._actionCb(data, callback, callback_id, profile)
-        self.bridge.launchAction(
-            callback_id, data, profile, callback=action_cb, errback=self.dialogFailure
+        action_cb = lambda data: self._action_cb(data, callback, callback_id, profile)
+        self.bridge.action_launch(
+            callback_id, data, profile, callback=action_cb, errback=self.dialog_failure
         )
 
-    def launchMenu(
+    def launch_menu(
         self,
         menu_type,
         path,
@@ -1354,7 +1354,7 @@
         @param path(iterable[unicode]): path to the menu
         @param data: data needed only for certain actions
         @param callback(callable, None): will be called with the resut
-            if None, self.actionManager will be called
+            if None, self.action_manager will be called
             else the callable will be called with the following kw parameters:
                 - data: action_data
                 - cb_id: (menu_type, path) tuple
@@ -1364,25 +1364,25 @@
         """
         if data is None:
             data = dict()
-        action_cb = lambda data: self._actionCb(
+        action_cb = lambda data: self._action_cb(
             data, callback, (menu_type, path), profile
         )
-        self.bridge.menuLaunch(
+        self.bridge.menu_launch(
             menu_type,
             path,
             data,
             security_limit,
             profile,
             callback=action_cb,
-            errback=self.dialogFailure,
+            errback=self.dialog_failure,
         )
 
     def disconnect(self, profile):
         log.info("disconnecting")
-        self.callListeners("disconnect", profile=profile)
+        self.call_listeners("disconnect", profile=profile)
         self.bridge.disconnect(profile)
 
-    def onExit(self):
+    def on_exit(self):
         """Must be called when the frontend is terminating"""
         to_unplug = []
         for profile, profile_manager in self.profiles.items():