code style reformatting using black
This commit is contained in:
parent
4127bcffd0
commit
744cb0c503
1 changed files with 21394 additions and 10488 deletions
|
|
@ -20,6 +20,7 @@
|
|||
from sat.core.i18n import _, D_
|
||||
from sat.core.constants import Const as C
|
||||
from sat.core.log import getLogger
|
||||
|
||||
log = getLogger(__name__)
|
||||
from sat.tools import xml_tools
|
||||
|
||||
|
|
@ -30,7 +31,9 @@ PLUGIN_INFO = {
|
|||
C.PI_TYPE: C.PLUG_TYPE_MISC,
|
||||
C.PI_MAIN: "Welcome",
|
||||
C.PI_HANDLER: "no",
|
||||
C.PI_DESCRIPTION: _("""Plugin which manage welcome message and things to to on first connection.""")
|
||||
C.PI_DESCRIPTION: _(
|
||||
"""Plugin which manage welcome message and things to to on first connection."""
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -40,7 +43,8 @@ WELCOME_PARAM_LABEL = D_(u"Display welcome message")
|
|||
WELCOME_MSG_TITLE = D_(u"Welcome to Libervia/Salut à Toi")
|
||||
# XXX: this message is mainly targetting libervia new users for now
|
||||
# (i.e.: it may look weird on other frontends)
|
||||
WELCOME_MSG = D_(u"""Welcome to a free (as in freedom) network!
|
||||
WELCOME_MSG = D_(
|
||||
u"""Welcome to a free (as in freedom) network!
|
||||
|
||||
If you have any trouble, or you want to help us for the bug hunting, you can contact us in real time chat by using the “Help / Official chat room” menu.
|
||||
|
||||
|
|
@ -49,7 +53,8 @@ To use Libervia, you'll need to add contacts, either people you know, or people
|
|||
We hope that you'll enjoy using this project.
|
||||
|
||||
The Libervia/Salut à Toi Team
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
PARAMS = """
|
||||
|
|
@ -60,11 +65,12 @@ PARAMS = """
|
|||
</category>
|
||||
</individual>
|
||||
</params>
|
||||
""".format(category=WELCOME_PARAM_CATEGORY, name=WELCOME_PARAM_NAME, label=WELCOME_PARAM_LABEL)
|
||||
""".format(
|
||||
category=WELCOME_PARAM_CATEGORY, name=WELCOME_PARAM_NAME, label=WELCOME_PARAM_LABEL
|
||||
)
|
||||
|
||||
|
||||
class Welcome(object):
|
||||
|
||||
def __init__(self, host):
|
||||
log.info(_("plugin Welcome initialization"))
|
||||
self.host = host
|
||||
|
|
@ -73,7 +79,12 @@ class Welcome(object):
|
|||
def profileConnected(self, client):
|
||||
# XXX: if you wan to try first_start again, you'll have to remove manually
|
||||
# the welcome value from your profile params in sat.db
|
||||
welcome = self.host.memory.params.getParamA(WELCOME_PARAM_NAME, WELCOME_PARAM_CATEGORY, use_default=False, profile_key=client.profile)
|
||||
welcome = self.host.memory.params.getParamA(
|
||||
WELCOME_PARAM_NAME,
|
||||
WELCOME_PARAM_CATEGORY,
|
||||
use_default=False,
|
||||
profile_key=client.profile,
|
||||
)
|
||||
if welcome is None:
|
||||
first_start = True
|
||||
welcome = True
|
||||
|
|
@ -82,12 +93,12 @@ class Welcome(object):
|
|||
|
||||
if welcome:
|
||||
xmlui = xml_tools.note(WELCOME_MSG, WELCOME_MSG_TITLE)
|
||||
self.host.actionNew({'xmlui': xmlui.toXml()}, profile=client.profile)
|
||||
self.host.memory.setParam(WELCOME_PARAM_NAME, C.BOOL_FALSE, WELCOME_PARAM_CATEGORY, profile_key=client.profile)
|
||||
self.host.actionNew({"xmlui": xmlui.toXml()}, profile=client.profile)
|
||||
self.host.memory.setParam(
|
||||
WELCOME_PARAM_NAME,
|
||||
C.BOOL_FALSE,
|
||||
WELCOME_PARAM_CATEGORY,
|
||||
profile_key=client.profile,
|
||||
)
|
||||
|
||||
self.host.trigger.point("WELCOME", first_start, welcome, client.profile)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue