Contracted @documentation to @doc
This commit is contained in:
parent
dadf58286f
commit
e42a50dc44
|
@ -330,7 +330,7 @@ def command(*names, **properties):
|
|||
|
||||
return decorator
|
||||
|
||||
def documentation(text):
|
||||
def doc(text):
|
||||
"""
|
||||
This decorator is used to bind a documentation (a help) to a
|
||||
command.
|
||||
|
|
|
@ -21,7 +21,7 @@ Keep in mind that this module is not being loaded, so the code will not
|
|||
be executed and commands defined here will not be detected.
|
||||
"""
|
||||
|
||||
from ..framework import CommandContainer, command, documentation
|
||||
from ..framework import CommandContainer, command, doc
|
||||
from hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
|
||||
|
||||
class CustomCommonCommands(CommandContainer):
|
||||
|
@ -58,7 +58,7 @@ class CustomChatCommands(CommandContainer):
|
|||
|
||||
HOSTS = (ChatCommands,)
|
||||
|
||||
@documentation(_("The same as using a doc-string, except it supports translation"))
|
||||
@doc(_("The same as using a doc-string, except it supports translation"))
|
||||
@command
|
||||
def sing(self):
|
||||
return "Are you phreaking kidding me? Buy yourself a damn stereo..."
|
||||
|
|
|
@ -27,7 +27,7 @@ from common.exceptions import GajimGeneralException
|
|||
from common.logger import Constants
|
||||
|
||||
from ..errors import CommandError
|
||||
from ..framework import CommandContainer, command, documentation
|
||||
from ..framework import CommandContainer, command, doc
|
||||
from ..mapping import generate_usage
|
||||
|
||||
from hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
|
||||
|
@ -45,18 +45,18 @@ class StandardCommonCommands(CommandContainer):
|
|||
HOSTS = (ChatCommands, PrivateChatCommands, GroupChatCommands)
|
||||
|
||||
@command
|
||||
@documentation(_("Clear the text window"))
|
||||
@doc(_("Clear the text window"))
|
||||
def clear(self):
|
||||
self.conv_textview.clear()
|
||||
|
||||
@command
|
||||
@documentation(_("Hide the chat buttons"))
|
||||
@doc(_("Hide the chat buttons"))
|
||||
def compact(self):
|
||||
new_status = not self.hide_chat_buttons
|
||||
self.chat_buttons_set_visible(new_status)
|
||||
|
||||
@command(overlap=True)
|
||||
@documentation(_("Show help on a given command or a list of available commands if -(-a)ll is given"))
|
||||
@doc(_("Show help on a given command or a list of available commands if -(-a)ll is given"))
|
||||
def help(self, command=None, all=False):
|
||||
if command:
|
||||
command = self.get_command(command)
|
||||
|
@ -83,17 +83,17 @@ class StandardCommonCommands(CommandContainer):
|
|||
self.echo(help(self, 'help'))
|
||||
|
||||
@command(raw=True)
|
||||
@documentation(_("Send a message to the contact"))
|
||||
@doc(_("Send a message to the contact"))
|
||||
def say(self, message):
|
||||
self.send(message)
|
||||
|
||||
@command(raw=True)
|
||||
@documentation(_("Send action (in the third person) to the current chat"))
|
||||
@doc(_("Send action (in the third person) to the current chat"))
|
||||
def me(self, action):
|
||||
self.send("/me %s" % action)
|
||||
|
||||
@command('lastlog', overlap=True)
|
||||
@documentation(_("Show logged messages which mention given text"))
|
||||
@doc(_("Show logged messages which mention given text"))
|
||||
def grep(self, text, limit=None):
|
||||
results = gajim.logger.get_search_results_for_query(self.contact.jid,
|
||||
text, self.account)
|
||||
|
@ -129,7 +129,7 @@ class StandardCommonCommands(CommandContainer):
|
|||
self.echo(formatted)
|
||||
|
||||
@command(raw=True, empty=True)
|
||||
@documentation(_("""
|
||||
@doc(_("""
|
||||
Set current the status
|
||||
|
||||
Status can be given as one of the following values: online, away,
|
||||
|
@ -142,7 +142,7 @@ class StandardCommonCommands(CommandContainer):
|
|||
connection.change_status(status, message)
|
||||
|
||||
@command(raw=True, empty=True)
|
||||
@documentation(_("Set the current status to away"))
|
||||
@doc(_("Set the current status to away"))
|
||||
def away(self, message):
|
||||
if not message:
|
||||
message = _("Away")
|
||||
|
@ -150,7 +150,7 @@ class StandardCommonCommands(CommandContainer):
|
|||
connection.change_status('away', message)
|
||||
|
||||
@command('back', raw=True, empty=True)
|
||||
@documentation(_("Set the current status to online"))
|
||||
@doc(_("Set the current status to online"))
|
||||
def online(self, message):
|
||||
if not message:
|
||||
message = _("Available")
|
||||
|
@ -166,19 +166,19 @@ class StandardCommonChatCommands(CommandContainer):
|
|||
HOSTS = (ChatCommands, PrivateChatCommands)
|
||||
|
||||
@command
|
||||
@documentation(_("Toggle the GPG encryption"))
|
||||
@doc(_("Toggle the GPG encryption"))
|
||||
def gpg(self):
|
||||
self._toggle_gpg()
|
||||
|
||||
@command
|
||||
@documentation(_("Send a ping to the contact"))
|
||||
@doc(_("Send a ping to the contact"))
|
||||
def ping(self):
|
||||
if self.account == gajim.ZEROCONF_ACC_NAME:
|
||||
raise CommandError(_('Command is not supported for zeroconf accounts'))
|
||||
gajim.connections[self.account].sendPing(self.contact)
|
||||
|
||||
@command
|
||||
@documentation(_("Send DTMF events through an open audio session"))
|
||||
@doc(_("Send DTMF events through an open audio session"))
|
||||
def dtmf(self, events):
|
||||
if not self.audio_sid:
|
||||
raise CommandError(_("There is no open audio session with this contact"))
|
||||
|
@ -193,7 +193,7 @@ class StandardCommonChatCommands(CommandContainer):
|
|||
raise CommandError(_("No valid DTMF event specified"))
|
||||
|
||||
@command
|
||||
@documentation(_("Toggle audio session"))
|
||||
@doc(_("Toggle audio session"))
|
||||
def audio(self):
|
||||
if self.audio_state == self.JINGLE_STATE_NOT_AVAILABLE:
|
||||
raise CommandError(_("Video sessions are not available"))
|
||||
|
@ -204,7 +204,7 @@ class StandardCommonChatCommands(CommandContainer):
|
|||
self._audio_button.set_active(not state)
|
||||
|
||||
@command
|
||||
@documentation(_("Toggle video session"))
|
||||
@doc(_("Toggle video session"))
|
||||
def video(self):
|
||||
if self.video_state == self.JINGLE_STATE_NOT_AVAILABLE:
|
||||
raise CommandError(_("Video sessions are not available"))
|
||||
|
@ -239,7 +239,7 @@ class StandardGroupChatCommands(CommandContainer):
|
|||
HOSTS = (GroupChatCommands,)
|
||||
|
||||
@command(raw=True)
|
||||
@documentation(_("Change your nickname in a group chat"))
|
||||
@doc(_("Change your nickname in a group chat"))
|
||||
def nick(self, new_nick):
|
||||
try:
|
||||
new_nick = helpers.parse_resource(new_nick)
|
||||
|
@ -249,7 +249,7 @@ class StandardGroupChatCommands(CommandContainer):
|
|||
self.new_nick = new_nick
|
||||
|
||||
@command('query', raw=True)
|
||||
@documentation(_("Open a private chat window with a specified occupant"))
|
||||
@doc(_("Open a private chat window with a specified occupant"))
|
||||
def chat(self, nick):
|
||||
nicks = gajim.contacts.get_nick_list(self.account, self.room_jid)
|
||||
if nick in nicks:
|
||||
|
@ -258,7 +258,7 @@ class StandardGroupChatCommands(CommandContainer):
|
|||
raise CommandError(_("Nickname not found"))
|
||||
|
||||
@command('msg', raw=True)
|
||||
@documentation(_("Open a private chat window with a specified occupant and send him a message"))
|
||||
@doc(_("Open a private chat window with a specified occupant and send him a message"))
|
||||
def message(self, nick, a_message):
|
||||
nicks = gajim.contacts.get_nick_list(self.account, self.room_jid)
|
||||
if nick in nicks:
|
||||
|
@ -267,7 +267,7 @@ class StandardGroupChatCommands(CommandContainer):
|
|||
raise CommandError(_("Nickname not found"))
|
||||
|
||||
@command(raw=True, empty=True)
|
||||
@documentation(_("Display or change a group chat topic"))
|
||||
@doc(_("Display or change a group chat topic"))
|
||||
def topic(self, new_topic):
|
||||
if new_topic:
|
||||
self.connection.send_gc_subject(self.room_jid, new_topic)
|
||||
|
@ -275,13 +275,13 @@ class StandardGroupChatCommands(CommandContainer):
|
|||
return self.subject
|
||||
|
||||
@command(raw=True, empty=True)
|
||||
@documentation(_("Invite a user to a room for a reason"))
|
||||
@doc(_("Invite a user to a room for a reason"))
|
||||
def invite(self, jid, reason):
|
||||
self.connection.send_invite(self.room_jid, jid, reason)
|
||||
return _("Invited %s to %s") % (jid, self.room_jid)
|
||||
|
||||
@command(raw=True, empty=True)
|
||||
@documentation(_("Join a group chat given by a jid, optionally using given nickname"))
|
||||
@doc(_("Join a group chat given by a jid, optionally using given nickname"))
|
||||
def join(self, jid, nick):
|
||||
if not nick:
|
||||
nick = self.nick
|
||||
|
@ -298,12 +298,12 @@ class StandardGroupChatCommands(CommandContainer):
|
|||
pass
|
||||
|
||||
@command('part', 'close', raw=True, empty=True)
|
||||
@documentation(_("Leave the groupchat, optionally giving a reason, and close tab or window"))
|
||||
@doc(_("Leave the groupchat, optionally giving a reason, and close tab or window"))
|
||||
def leave(self, reason):
|
||||
self.parent_win.remove_tab(self, self.parent_win.CLOSE_COMMAND, reason)
|
||||
|
||||
@command(raw=True, empty=True)
|
||||
@documentation(_("""
|
||||
@doc(_("""
|
||||
Ban user by a nick or a jid from a groupchat
|
||||
|
||||
If given nickname is not found it will be treated as a jid.
|
||||
|
@ -315,14 +315,14 @@ class StandardGroupChatCommands(CommandContainer):
|
|||
self.connection.gc_set_affiliation(self.room_jid, who, 'outcast', reason or str())
|
||||
|
||||
@command(raw=True, empty=True)
|
||||
@documentation(_("Kick user by a nick from a groupchat"))
|
||||
@doc(_("Kick user by a nick from a groupchat"))
|
||||
def kick(self, who, reason):
|
||||
if not who in gajim.contacts.get_nick_list(self.account, self.room_jid):
|
||||
raise CommandError(_("Nickname not found"))
|
||||
self.connection.gc_set_role(self.room_jid, who, 'none', reason or str())
|
||||
|
||||
@command
|
||||
@documentation(_("Display names of all group chat occupants"))
|
||||
@doc(_("Display names of all group chat occupants"))
|
||||
def names(self, verbose=False):
|
||||
get_contact = lambda nick: gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
||||
nicks = gajim.contacts.get_nick_list(self.account, self.room_jid)
|
||||
|
@ -343,11 +343,11 @@ class StandardGroupChatCommands(CommandContainer):
|
|||
return ', '.join(nicks)
|
||||
|
||||
@command('ignore', raw=True)
|
||||
@documentation(_("Forbid an occupant to send you public or private messages"))
|
||||
@doc(_("Forbid an occupant to send you public or private messages"))
|
||||
def block(self, who):
|
||||
self.on_block(None, who)
|
||||
|
||||
@command('unignore', raw=True)
|
||||
@documentation(_("Allow an occupant to send you public or private messages"))
|
||||
@doc(_("Allow an occupant to send you public or private messages"))
|
||||
def unblock(self, who):
|
||||
self.on_unblock(None, who)
|
||||
|
|
Loading…
Reference in New Issue