Fix bad-whitespace pylint errors

This commit is contained in:
Philipp Hörist 2018-09-18 12:06:01 +02:00 committed by Philipp Hörist
parent b2a64fe5cc
commit e842298724
39 changed files with 644 additions and 644 deletions

View File

@ -96,14 +96,14 @@ class AdvancedConfigurationWindow:
self.modelfilter.set_visible_func(self.visible_func)
renderer_text = Gtk.CellRendererText()
col = Gtk.TreeViewColumn(_('Preference Name'), renderer_text, text = 0)
col = Gtk.TreeViewColumn(_('Preference Name'), renderer_text, text=0)
treeview.insert_column(col, -1)
col.set_resizable(True)
renderer_text = Gtk.CellRendererText()
renderer_text.connect('edited', self.on_config_edited)
renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END)
col = Gtk.TreeViewColumn(_('Value'),renderer_text, text = 1)
col = Gtk.TreeViewColumn(_('Value'), renderer_text, text=1)
treeview.insert_column(col, -1)
col.set_cell_data_func(renderer_text, self.cb_value_column_data)
@ -112,7 +112,7 @@ class AdvancedConfigurationWindow:
col.props.sizing = Gtk.TreeViewColumnSizing.FIXED
renderer_text = Gtk.CellRendererText()
col = Gtk.TreeViewColumn(_('Type'), renderer_text, text = 2)
col = Gtk.TreeViewColumn(_('Type'), renderer_text, text=2)
treeview.insert_column(col, -1)
col.props.sizing = Gtk.TreeViewColumnSizing.FIXED
@ -211,7 +211,7 @@ class AdvancedConfigurationWindow:
self.restart_box.hide()
for opt in self.changed_opts:
opt_path = opt.split('\n')
if len(opt_path)==3:
if len(opt_path) == 3:
restart = app.config.get_restart_per(opt_path[2], opt_path[1],
opt_path[0])
else:
@ -224,7 +224,7 @@ class AdvancedConfigurationWindow:
def on_config_edited(self, cell, path, text):
# convert modelfilter path to model path
path=Gtk.TreePath.new_from_string(path)
path = Gtk.TreePath.new_from_string(path)
modelpath = self.modelfilter.convert_path_to_child_path(path)
modelrow = self.model[modelpath]
option = modelrow[0]
@ -253,7 +253,7 @@ class AdvancedConfigurationWindow:
# Check for GtkTreeIter
if iter_:
path = model.get_path(iter_)
opt_path = self.get_option_path(model, iter_)
opt_path = self.get_option_path(model, iter_)
if len(opt_path) == 1:
default = app.config.get_default(opt_path[0])
elif len(opt_path) == 3:
@ -311,7 +311,7 @@ class AdvancedConfigurationWindow:
self.model.append(parent, [name, value, type_])
def visible_func(self, model, treeiter, data):
search_string = self.entry.get_text().lower()
search_string = self.entry.get_text().lower()
for it in tree_model_pre_order(model, treeiter):
if model[it][Column.TYPE] != '':
opt_path = self.get_option_path(model, it)

View File

@ -364,7 +364,7 @@ def get_number_of_accounts():
"""
return len(connections.keys())
def get_number_of_connected_accounts(accounts_list = None):
def get_number_of_connected_accounts(accounts_list=None):
"""
Returns the number of CONNECTED accounts. Uou can optionally pass an
accounts_list and if you do those will be checked, else all will be checked
@ -456,7 +456,7 @@ def account_is_securely_connected(account):
return False
return con_types.get(account) in ('tls', 'ssl')
def get_transport_name_from_jid(jid, use_config_setting = True):
def get_transport_name_from_jid(jid, use_config_setting=True):
"""
Returns 'gg', 'irc' etc
@ -517,7 +517,7 @@ def get_our_jids():
our_jids.append(get_jid_from_account(account))
return our_jids
def get_hostname_from_account(account_name, use_srv = False):
def get_hostname_from_account(account_name, use_srv=False):
"""
Returns hostname (if custom hostname is used, that is returned)
"""

View File

@ -28,9 +28,10 @@
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
import re
from gi.repository import GLib
from enum import IntEnum, unique
from gi.repository import GLib
import gajim
from gajim.common.i18n import _
@ -44,14 +45,15 @@ class Option(IntEnum):
# Option.DESC also should be there
RESTART = 3
opt_int = [ 'integer', 0 ]
opt_str = [ 'string', 0 ]
opt_bool = [ 'boolean', 0 ]
opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)$' ]
opt_int = ['integer', 0]
opt_str = ['string', 0]
opt_bool = ['boolean', 0]
opt_color = ['color', '^(#[0-9a-fA-F]{6})|()|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)$']
opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype']
opt_show_roster_on_startup = ['always', 'never', 'last_state']
opt_treat_incoming_messages = ['', 'chat', 'normal']
class Config:
DEFAULT_ICONSET = 'dcraven'
@ -63,415 +65,416 @@ class Config:
DEFAULT_FILE_MANAGER = 'xffm'
__options = ({
# name: [ type, default_value, help_string ]
'verbose': [ opt_bool, False, '', True ],
'autopopup': [ opt_bool, False ],
'notify_on_signin': [ opt_bool, True ],
'notify_on_signout': [ opt_bool, False ],
'notify_on_new_message': [ opt_bool, True ],
'autopopupaway': [ opt_bool, False ],
'autopopup_chat_opened': [ opt_bool, False, _('Show desktop notification even when a chat window is opened for this contact and does not have focus') ],
'sounddnd': [ opt_bool, False, _('Play sound when user is busy')],
'showoffline': [ opt_bool, False ],
'show_only_chat_and_online': [ opt_bool, False, _('Show only online and free for chat contacts in roster.')],
'show_transports_group': [ opt_bool, True ],
'autoaway': [ opt_bool, True ],
'autoawaytime': [ opt_int, 5, _('Time in minutes, after which your status changes to away.') ],
'autoaway_message': [ opt_str, _('$S (Away as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoawaytime.') ],
'autoxa': [ opt_bool, True ],
'autoxatime': [ opt_int, 15, _('Time in minutes, after which your status changes to not available.') ],
'autoxa_message': [ opt_str, _('$S (Not available as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoxatime.') ],
'ask_online_status': [ opt_bool, False ],
'ask_offline_status': [ opt_bool, False ],
'trayicon': [opt_str, 'always', _("When to show notification area icon. Can be 'never', 'on_event', 'always'."), False],
'allow_hide_roster': [opt_bool, False, _("Allow to hide the roster window even if the tray icon is not shown."), False],
'iconset': [ opt_str, DEFAULT_ICONSET, '', True ],
'mood_iconset': [ opt_str, DEFAULT_MOOD_ICONSET, '', True ],
'activity_iconset': [ opt_str, DEFAULT_ACTIVITY_ICONSET, '', True ],
'use_transports_iconsets': [ opt_bool, True, '', True ],
'notif_signin_color': [ opt_color, '#32CD32', _('Contact signed in notification color.') ], # limegreen
'notif_signout_color': [ opt_color, '#FF0000', _('Contact signout notification color') ], # red
'notif_message_color': [ opt_color, '#1E90FF', _('New message notification color.') ], # dodgerblue
'notif_ftrequest_color': [ opt_color, '#F0E68C', _('File transfer request notification color.') ], # khaki
'notif_fterror_color': [ opt_color, '#B22222', _('File transfer error notification color.') ], # firebrick
'notif_ftcomplete_color': [ opt_color, '#9ACD32', _('File transfer complete or stopped notification color.') ], # yellowgreen
'notif_invite_color': [ opt_color, '#D2B48C', _('Groupchat invitation notification color') ], # tan1
'notif_status_color': [ opt_color, '#D8BFD8', _('Background color of status changed notification') ], # thistle2
'notif_other_color': [ opt_color, '#FFFFFF', _('Other dialogs color.') ], # white
'collapsed_rows': [ opt_str, '', _('List (space separated) of rows (accounts and groups) that are collapsed.'), True ],
'roster_theme': [ opt_str, _('default'), '', True ],
'mergeaccounts': [ opt_bool, False, '', True ],
'sort_by_show_in_roster': [ opt_bool, True, '', True ],
'sort_by_show_in_muc': [ opt_bool, False, '', True ],
'use_speller': [ opt_bool, False, ],
'ignore_incoming_xhtml': [ opt_bool, False, ],
'speller_language': [ opt_str, '', _('Language used by speller')],
'print_time': [ opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')],
'print_time_fuzzy': [ opt_int, 0, _('Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable fuzzyclock. 1 is the most precise clock, 4 the least precise one. This is used only if print_time is \'sometimes\'.') ],
'emoticons_theme': [opt_str, 'noto-emoticons', '', True ],
'ascii_emoticons': [opt_bool, True, _('When enabled, ASCII emoticons will be converted to graphical emojis.'), True],
'ascii_formatting': [ opt_bool, True,
_('Treat * / _ pairs as possible formatting characters.'), True],
'show_ascii_formatting_chars': [ opt_bool, True, _('If true, do not '
'remove */_ . So *abc* will be bold but with * * not removed.')],
'rst_formatting_outgoing_messages': [ opt_bool, False,
_('Uses ReStructured text markup to send HTML, plus ascii formatting if selected. For syntax, see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html (If you want to use this, install docutils)')],
'sounds_on': [ opt_bool, True ],
# 'aplay', 'play', 'esdplay', 'artsplay' detected first time only
'soundplayer': [ opt_str, '' ],
'openwith': [ opt_str, DEFAULT_OPENWITH ],
'custombrowser': [ opt_str, DEFAULT_BROWSER ],
'custommailapp': [ opt_str, DEFAULT_MAILAPP ],
'custom_file_manager': [ opt_str, DEFAULT_FILE_MANAGER ],
'gc-hpaned-position': [opt_int, 430],
'gc_refer_to_nick_char': [opt_str, ',', _('Character to add after nickname when using nick completion (tab) in group chat.')],
'gc_proposed_nick_char': [opt_str, '_', _('Character to propose to add after desired nickname when desired nickname is used by someone else in group chat.')],
'msgwin-max-state': [opt_bool, False],
'msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'msgwin-width': [opt_int, 500],
'msgwin-height': [opt_int, 440],
'chat-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'chat-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'chat-msgwin-width': [opt_int, 480],
'chat-msgwin-height': [opt_int, 440],
'gc-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'gc-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'gc-msgwin-width': [opt_int, 600],
'gc-msgwin-height': [opt_int, 440],
'pm-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'pm-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'pm-msgwin-width': [opt_int, 480],
'pm-msgwin-height': [opt_int, 440],
'single-msg-x-position': [opt_int, 0],
'single-msg-y-position': [opt_int, 0],
'single-msg-width': [opt_int, 400],
'single-msg-height': [opt_int, 280],
'save-roster-position': [opt_bool, True, _('If true, Gajim will save roster position when hiding roster, and restore it when showing roster.')],
'roster_x-position': [ opt_int, 0 ],
'roster_y-position': [ opt_int, 0 ],
'roster_width': [ opt_int, 200 ],
'roster_height': [ opt_int, 400 ],
'roster_hpaned_position': [opt_int, 200],
'roster_on_the_right': [opt_bool, False, _('Place the roster on the right in single window mode'), True],
'history_window_width': [ opt_int, -1 ],
'history_window_height': [ opt_int, 450 ],
'history_window_x-position': [ opt_int, 0 ],
'history_window_y-position': [ opt_int, 0 ],
'latest_disco_addresses': [ opt_str, '' ],
'time_stamp': [ opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html') ],
'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ],
'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ],
'use_gpg_agent': [ opt_bool, False ],
'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')],
'restore_lines': [opt_int, 10, _('How many history messages should be restored when a chat tab/window is reopened?')],
'restore_timeout': [opt_int, -1, _('How far back in time (minutes) history is restored. -1 means no limit.')],
'muc_restore_lines': [opt_int, 100, _('How many lines to request from server when entering a groupchat. -1 means no limit')],
'muc_restore_timeout': [opt_int, -1, _('Minutes of backlog to request when entering a groupchat. -1 means no limit')],
'muc_autorejoin_timeout': [opt_int, 1, _('How many seconds to wait before trying to autorejoin to a conference you are being disconnected from. Set to 0 to disable autorejoining.')],
'muc_autorejoin_on_kick': [opt_bool, False, _('Should autorejoin be activated when kicked from a conference?')],
'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')],
'last_roster_visible': [opt_bool, True],
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],
'version': [ opt_str, gajim.__version__ ], # which version created the config
'search_engine': [opt_str, 'https://www.google.com/search?&q=%s&sourceid=gajim'],
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom URL with %%s in it where %%s is the word/phrase or 'WIKTIONARY' which means use Wikitionary.")],
'always_english_wikipedia': [opt_bool, False],
'always_english_wiktionary': [opt_bool, True],
'remote_control': [opt_bool, False, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True],
'outgoing_chat_state_notifications': [opt_str, 'all', _('Sent chat state notifications. Can be one of all, composing_only, disabled.')],
'displayed_chat_state_notifications': [opt_str, 'all', _('Displayed chat state notifications in chat windows. Can be one of all, composing_only, disabled.')],
'autodetect_browser_mailer': [opt_bool, True, '', True],
'print_ichat_every_foo_minutes': [opt_int, 5, _('When not printing time for every message (print_time==sometimes), print it every x minutes.')],
'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')],
'confirm_close_muc_rooms': [opt_str, '', _('Always ask for confirmation before closing groupchats with any of the JIDs on this space separated list.')],
'noconfirm_close_muc_rooms': [opt_str, '', _('Never ask for confirmation before closing groupchats with any of the JIDs on this space separated list.')],
'confirm_close_multiple_tabs': [opt_bool, True, _('Ask before closing tabbed chat window if there are controls that can lose data (chat, private chat, groupchat that will not be minimized)')],
'notify_on_file_complete': [opt_bool, True],
'file_transfers_port': [opt_int, 28011],
'ft_add_hosts_to_send': [opt_str, '', _('Comma separated list of sent hosts, in addition of local interfaces, for File Transfer in case of address translation/port forwarding.')],
'use_kib_mib': [opt_bool, False, _('IEC standard says KiB = 1024 bytes, KB = 1000 bytes.')],
'notify_on_all_muc_messages': [opt_bool, False],
'trayicon_notification_on_events': [opt_bool, True, _('Notify of events in the notification area.')],
'trayicon_blink': [opt_bool, True, _('If False, Gajim will display a static event icon instead of the blinking status icon in the notification area when notifying on event.')],
'last_save_dir': [opt_str, ''],
'last_send_dir': [opt_str, ''],
'last_emoticons_dir': [opt_str, ''],
'last_sounds_dir': [opt_str, ''],
'tabs_position': [opt_str, 'top'],
'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')],
'tabs_border': [opt_bool, False, _('Show tabbed notebook border in chat windows?')],
'tabs_close_button': [opt_bool, True, _('Show close button in tab?')],
'esession_modp': [opt_str, '15,16,14', _('A list of modp groups to use in a Diffie-Hellman, highest preference first, separated by commas. Valid groups are 1, 2, 5, 14, 15, 16, 17 and 18. Higher numbers are more secure, but take longer to calculate when you start a session.')],
'tooltip_status_online_color': [opt_color, '#73D216'],
'tooltip_status_free_for_chat_color': [opt_color, '#3465A4'],
'tooltip_status_away_color': [opt_color, '#EDD400'],
'tooltip_status_busy_color': [opt_color, '#F57900'],
'tooltip_status_na_color': [opt_color, '#CC0000'],
'tooltip_status_offline_color': [opt_color, '#555753'],
'tooltip_affiliation_none_color': [opt_color, '#555753'],
'tooltip_affiliation_member_color': [opt_color, '#73D216'],
'tooltip_affiliation_administrator_color': [opt_color, '#F57900'],
'tooltip_affiliation_owner_color': [opt_color, '#CC0000'],
'tooltip_account_name_color': [opt_color, '#888A85'],
'tooltip_idle_color': [opt_color, '#888A85'],
'notification_preview_message': [opt_bool, True, _('Preview new messages in notification popup?')],
'notification_position_x': [opt_int, -1],
'notification_position_y': [opt_int, -1],
'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in group chats.')],
'quit_on_roster_x_button': [opt_bool, False, _('If true, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if notification icon is used.')],
'hide_on_roster_x_button': [opt_bool, False, _('If true, Gajim hides the Roster window on pressing the X button instead of minimizing into the Dock.')],
'show_unread_tab_icon': [opt_bool, False, _('If true, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')],
'show_status_msgs_in_roster': [opt_bool, True, _('If true, Gajim will display the status message, if not empty, for every contact under the contact name in roster window.'), True],
'show_avatars_in_roster': [opt_bool, True, '', True],
'show_mood_in_roster': [opt_bool, True, '', True],
'show_activity_in_roster': [opt_bool, True, '', True],
'show_tunes_in_roster': [opt_bool, True, '', True],
'show_location_in_roster': [opt_bool, True, '', True],
'avatar_position_in_roster': [opt_str, 'right', _('Define the position of the avatar in roster. Can be left or right'), True],
'print_status_in_chats': [opt_bool, False, _('If False, Gajim will no longer print status line in chats when a contact changes their status and/or their status message.')],
'print_status_in_muc': [opt_str, 'none', _('Can be "none", "all" or "in_and_out". If "none", Gajim will no longer print status line in groupchats when a member changes their status and/or their status message. If "all" Gajim will print all status messages. If "in_and_out", Gajim will only print FOO enters/leaves group chat.')],
'log_contact_status_changes': [opt_bool, False],
'log_xhtml_messages': [opt_bool, False, _('Log XHTML messages instead of plain text messages.')],
'restored_messages_small': [opt_bool, True, _('If true, restored messages will use a smaller font than the default one.')],
'hide_avatar_of_transport': [opt_bool, False, _('Don\'t show avatar for the transport itself.')],
'roster_window_skip_taskbar': [opt_bool, False, _('Don\'t show roster in the system taskbar.')],
'use_urgency_hint': [opt_bool, True, _('If true, make the window flash (the default behaviour in most Window Managers) when holding pending events.')],
'notification_timeout': [opt_int, 5],
'one_message_window': [opt_str, 'always',
#always, never, peracct, pertype should not be translated
_('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'always_with_roster\' - Like \'always\' but the messages are in a single window along with the roster.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g. chats vs. groupchats) is sent to a specific window.')],
'show_roster_on_startup':[opt_str, 'always', _('Show roster on startup.\n\'always\' - Always show roster.\n\'never\' - Never show roster.\n\'last_state\' - Restore the last state roster.')],
'show_avatar_in_chat': [opt_bool, True, _('If False, you will no longer see the avatar in the chat window.')],
'escape_key_closes': [opt_bool, True, _('If true, pressing the escape key closes a tab/window.')],
'hide_groupchat_banner': [opt_bool, False, _('Hides the banner in a group chat window')],
'hide_chat_banner': [opt_bool, False, _('Hides the banner in two persons chat window')],
'hide_groupchat_occupants_list': [opt_bool, False, _('Hides the group chat occupants list in group chat window.')],
'chat_merge_consecutive_nickname': [opt_bool, False, _('In a chat, show the nickname at the beginning of a line only when it\'s not the same person talking than in previous message.')],
'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickname.')],
'gc_nicknames_colors': [ opt_str, '#4e9a06:#f57900:#ce5c00:#3465a4:#204a87:#75507b:#5c3566:#c17d11:#8f5902:#ef2929:#cc0000:#a40000', _('List of colors, separated by ":", that will be used to color nicknames in group chats.'), True ],
'ctrl_tab_go_to_next_composing': [opt_bool, True, _('Ctrl-Tab go to next composing tab when none is unread.')],
'confirm_metacontacts': [ opt_str, '', _('Show the confirm metacontacts creation dialog or not? Empty string means never show the dialog.')],
'confirm_block': [ opt_str, '', _('Show the confirm block contact dialog or not? Empty string means never show the dialog.')],
'confirm_custom_status': [ opt_str, '', _('Show the confirm custom status dialog or not? Empty string means never show the dialog.')],
'enable_negative_priority': [ opt_bool, False, _('If true, you will be able to set a negative priority to your account in account modification window. BE CAREFUL, when you are logged in with a negative priority, you will NOT receive any message from your server.')],
'show_contacts_number': [opt_bool, True, _('If true, Gajim will show number of online and total contacts in account and group rows.')],
'treat_incoming_messages': [ opt_str, '', _('Can be empty, \'chat\' or \'normal\'. If not empty, treat all incoming messages as if they were of this type')],
'scroll_roster_to_last_message': [opt_bool, True, _('If true, Gajim will scroll and select the contact who sent you the last message, if chat window is not already opened.')],
'change_status_window_timeout': [opt_int, 15, _('Time of inactivity needed before the change status window closes down.')],
'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')],
'attach_notifications_to_systray': [opt_bool, False, _('If true, notification windows from notification-daemon will be attached to notification icon.')],
'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')],
'uri_schemes': [opt_str, 'aaa:// aaas:// acap:// cap:// cid: crid:// data: dav: dict:// dns: fax: file:/ ftp:// geo: go: gopher:// h323: http:// https:// iax: icap:// im: imap:// info: ipp:// iris: iris.beep: iris.xpc: iris.xpcs: iris.lwz: ldap:// mid: modem: msrp:// msrps:// mtqp:// mupdate:// news: nfs:// nntp:// opaquelocktoken: pop:// pres: prospero:// rtsp:// service: shttp:// sip: sips: sms: snmp:// soap.beep:// soap.beeps:// tag: tel: telnet:// tftp:// thismessage:/ tip:// tv: urn:// vemmi:// xmlrpc.beep:// xmlrpc.beeps:// z39.50r:// z39.50s:// about: apt: cvs:// daap:// ed2k:// feed: fish:// git:// iax2: irc:// ircs:// ldaps:// magnet: mms:// rsync:// ssh:// svn:// sftp:// smb:// webcal:// aesgcm://', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled separately)'), True],
'shell_like_completion': [ opt_bool, False, _('If true, completion in groupchats will be like a shell auto-completion')],
'show_self_contact': [opt_str, 'when_other_resource', _('When is self contact row displayed. Can be "always", "when_other_resource" or "never"'), True],
'audio_input_device': [opt_str, 'autoaudiosrc ! volume name=gajim_vol'],
'audio_output_device': [opt_str, 'autoaudiosink'],
'video_input_device': [opt_str, 'autovideosrc'],
'video_output_device': [opt_str, 'autovideosink'],
'video_framerate': [opt_str, '', _('Optionally fix jingle output video framerate. Example: 10/1 or 25/2')],
'video_size': [opt_str, '', _('Optionally resize jingle output video. Example: 320x240')],
'video_see_self': [opt_bool, True, _('If true, You will also see your webcam')],
'audio_input_volume': [opt_int, 50],
'audio_output_volume': [opt_int, 50],
'use_stun_server': [opt_bool, False, _('If true, Gajim will try to use a STUN server when using Jingle. The one in "stun_server" option, or the one given by the XMPP server.')],
'stun_server': [opt_str, '', _('STUN server to use when using Jingle')],
'show_affiliation_in_groupchat': [opt_bool, True, _('If true, Gajim will show affiliation of groupchat occupants by adding a colored square to the status icon')],
'global_proxy': [opt_str, '', _('Proxy used for all outgoing connections if the account does not have a specific proxy configured')],
'ignore_incoming_attention': [opt_bool, False, _('If true, Gajim will ignore incoming attention requestd ("wizz").')],
'remember_opened_chat_controls': [ opt_bool, True, _('If enabled, Gajim will reopen chat windows that were opened last time Gajim was closed.')],
'positive_184_ack': [ opt_bool, False, _('If enabled, Gajim will show an icon to show that sent message has been received by your contact')],
'show_avatar_in_tabs': [ opt_bool, False, _('Show a mini avatar in chat window tabs and in window icon')],
'use_keyring': [opt_bool, True, _('If true, Gajim will use the Systems Keyring to store account passwords.')],
'pgp_encoding': [ opt_str, '', _('Sets the encoding used by python-gnupg'), True],
'remote_commands': [opt_bool, False, _('If true, Gajim will execute XEP-0146 Commands.')],
# name: [ type, default_value, help_string ]
'verbose': [opt_bool, False, '', True],
'autopopup': [opt_bool, False],
'notify_on_signin': [opt_bool, True],
'notify_on_signout': [opt_bool, False],
'notify_on_new_message': [opt_bool, True],
'autopopupaway': [opt_bool, False],
'autopopup_chat_opened': [opt_bool, False, _('Show desktop notification even when a chat window is opened for this contact and does not have focus')],
'sounddnd': [opt_bool, False, _('Play sound when user is busy')],
'showoffline': [opt_bool, False],
'show_only_chat_and_online': [opt_bool, False, _('Show only online and free for chat contacts in roster.')],
'show_transports_group': [opt_bool, True],
'autoaway': [opt_bool, True],
'autoawaytime': [opt_int, 5, _('Time in minutes, after which your status changes to away.')],
'autoaway_message': [opt_str, _('$S (Away as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoawaytime.')],
'autoxa': [opt_bool, True],
'autoxatime': [opt_int, 15, _('Time in minutes, after which your status changes to not available.')],
'autoxa_message': [opt_str, _('$S (Not available as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoxatime.')],
'ask_online_status': [opt_bool, False],
'ask_offline_status': [opt_bool, False],
'trayicon': [opt_str, 'always', _("When to show notification area icon. Can be 'never', 'on_event', 'always'."), False],
'allow_hide_roster': [opt_bool, False, _("Allow to hide the roster window even if the tray icon is not shown."), False],
'iconset': [opt_str, DEFAULT_ICONSET, '', True],
'mood_iconset': [opt_str, DEFAULT_MOOD_ICONSET, '', True],
'activity_iconset': [opt_str, DEFAULT_ACTIVITY_ICONSET, '', True],
'use_transports_iconsets': [opt_bool, True, '', True],
'notif_signin_color': [opt_color, '#32CD32', _('Contact signed in notification color.')], # limegreen
'notif_signout_color': [opt_color, '#FF0000', _('Contact signout notification color')], # red
'notif_message_color': [opt_color, '#1E90FF', _('New message notification color.')], # dodgerblue
'notif_ftrequest_color': [opt_color, '#F0E68C', _('File transfer request notification color.')], # khaki
'notif_fterror_color': [opt_color, '#B22222', _('File transfer error notification color.')], # firebrick
'notif_ftcomplete_color': [opt_color, '#9ACD32', _('File transfer complete or stopped notification color.')], # yellowgreen
'notif_invite_color': [opt_color, '#D2B48C', _('Groupchat invitation notification color')], # tan1
'notif_status_color': [opt_color, '#D8BFD8', _('Background color of status changed notification')], # thistle2
'notif_other_color': [opt_color, '#FFFFFF', _('Other dialogs color.')], # white
'collapsed_rows': [opt_str, '', _('List (space separated) of rows (accounts and groups) that are collapsed.'), True],
'roster_theme': [opt_str, _('default'), '', True],
'mergeaccounts': [opt_bool, False, '', True],
'sort_by_show_in_roster': [opt_bool, True, '', True],
'sort_by_show_in_muc': [opt_bool, False, '', True],
'use_speller': [opt_bool, False, ],
'ignore_incoming_xhtml': [opt_bool, False, ],
'speller_language': [opt_str, '', _('Language used by speller')],
'print_time': [opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')],
'print_time_fuzzy': [opt_int, 0, _('Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable fuzzyclock. 1 is the most precise clock, 4 the least precise one. This is used only if print_time is \'sometimes\'.')],
'emoticons_theme': [opt_str, 'noto-emoticons', '', True],
'ascii_emoticons': [opt_bool, True, _('When enabled, ASCII emoticons will be converted to graphical emojis.'), True],
'ascii_formatting': [opt_bool, True,
_('Treat * / _ pairs as possible formatting characters.'), True],
'show_ascii_formatting_chars': [opt_bool, True, _('If true, do not '
'remove */_ . So *abc* will be bold but with * * not removed.')],
'rst_formatting_outgoing_messages': [opt_bool, False,
_('Uses ReStructured text markup to send HTML, plus ascii formatting if selected. For syntax, see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html (If you want to use this, install docutils)')],
'sounds_on': [opt_bool, True],
# 'aplay', 'play', 'esdplay', 'artsplay' detected first time only
'soundplayer': [opt_str, ''],
'openwith': [opt_str, DEFAULT_OPENWITH],
'custombrowser': [opt_str, DEFAULT_BROWSER],
'custommailapp': [opt_str, DEFAULT_MAILAPP],
'custom_file_manager': [opt_str, DEFAULT_FILE_MANAGER],
'gc-hpaned-position': [opt_int, 430],
'gc_refer_to_nick_char': [opt_str, ',', _('Character to add after nickname when using nick completion (tab) in group chat.')],
'gc_proposed_nick_char': [opt_str, '_', _('Character to propose to add after desired nickname when desired nickname is used by someone else in group chat.')],
'msgwin-max-state': [opt_bool, False],
'msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'msgwin-width': [opt_int, 500],
'msgwin-height': [opt_int, 440],
'chat-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'chat-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'chat-msgwin-width': [opt_int, 480],
'chat-msgwin-height': [opt_int, 440],
'gc-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'gc-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'gc-msgwin-width': [opt_int, 600],
'gc-msgwin-height': [opt_int, 440],
'pm-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'pm-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'pm-msgwin-width': [opt_int, 480],
'pm-msgwin-height': [opt_int, 440],
'single-msg-x-position': [opt_int, 0],
'single-msg-y-position': [opt_int, 0],
'single-msg-width': [opt_int, 400],
'single-msg-height': [opt_int, 280],
'save-roster-position': [opt_bool, True, _('If true, Gajim will save roster position when hiding roster, and restore it when showing roster.')],
'roster_x-position': [opt_int, 0],
'roster_y-position': [opt_int, 0],
'roster_width': [opt_int, 200],
'roster_height': [opt_int, 400],
'roster_hpaned_position': [opt_int, 200],
'roster_on_the_right': [opt_bool, False, _('Place the roster on the right in single window mode'), True],
'history_window_width': [opt_int, -1],
'history_window_height': [opt_int, 450],
'history_window_x-position': [opt_int, 0],
'history_window_y-position': [opt_int, 0],
'latest_disco_addresses': [opt_str, ''],
'time_stamp': [opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html')],
'before_nickname': [opt_str, '', _('Characters that are printed before the nickname in conversations')],
'after_nickname': [opt_str, ':', _('Characters that are printed after the nickname in conversations')],
'use_gpg_agent': [opt_bool, False],
'change_roster_title': [opt_bool, True, _('Add * and [n] in roster title?')],
'restore_lines': [opt_int, 10, _('How many history messages should be restored when a chat tab/window is reopened?')],
'restore_timeout': [opt_int, -1, _('How far back in time (minutes) history is restored. -1 means no limit.')],
'muc_restore_lines': [opt_int, 100, _('How many lines to request from server when entering a groupchat. -1 means no limit')],
'muc_restore_timeout': [opt_int, -1, _('Minutes of backlog to request when entering a groupchat. -1 means no limit')],
'muc_autorejoin_timeout': [opt_int, 1, _('How many seconds to wait before trying to autorejoin to a conference you are being disconnected from. Set to 0 to disable autorejoining.')],
'muc_autorejoin_on_kick': [opt_bool, False, _('Should autorejoin be activated when kicked from a conference?')],
'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')],
'last_roster_visible': [opt_bool, True],
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],
'version': [opt_str, gajim.__version__], # which version created the config
'search_engine': [opt_str, 'https://www.google.com/search?&q=%s&sourceid=gajim'],
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom URL with %%s in it where %%s is the word/phrase or 'WIKTIONARY' which means use Wikitionary.")],
'always_english_wikipedia': [opt_bool, False],
'always_english_wiktionary': [opt_bool, True],
'remote_control': [opt_bool, False, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True],
'outgoing_chat_state_notifications': [opt_str, 'all', _('Sent chat state notifications. Can be one of all, composing_only, disabled.')],
'displayed_chat_state_notifications': [opt_str, 'all', _('Displayed chat state notifications in chat windows. Can be one of all, composing_only, disabled.')],
'autodetect_browser_mailer': [opt_bool, True, '', True],
'print_ichat_every_foo_minutes': [opt_int, 5, _('When not printing time for every message (print_time==sometimes), print it every x minutes.')],
'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')],
'confirm_close_muc_rooms': [opt_str, '', _('Always ask for confirmation before closing groupchats with any of the JIDs on this space separated list.')],
'noconfirm_close_muc_rooms': [opt_str, '', _('Never ask for confirmation before closing groupchats with any of the JIDs on this space separated list.')],
'confirm_close_multiple_tabs': [opt_bool, True, _('Ask before closing tabbed chat window if there are controls that can lose data (chat, private chat, groupchat that will not be minimized)')],
'notify_on_file_complete': [opt_bool, True],
'file_transfers_port': [opt_int, 28011],
'ft_add_hosts_to_send': [opt_str, '', _('Comma separated list of sent hosts, in addition of local interfaces, for File Transfer in case of address translation/port forwarding.')],
'use_kib_mib': [opt_bool, False, _('IEC standard says KiB = 1024 bytes, KB = 1000 bytes.')],
'notify_on_all_muc_messages': [opt_bool, False],
'trayicon_notification_on_events': [opt_bool, True, _('Notify of events in the notification area.')],
'trayicon_blink': [opt_bool, True, _('If False, Gajim will display a static event icon instead of the blinking status icon in the notification area when notifying on event.')],
'last_save_dir': [opt_str, ''],
'last_send_dir': [opt_str, ''],
'last_emoticons_dir': [opt_str, ''],
'last_sounds_dir': [opt_str, ''],
'tabs_position': [opt_str, 'top'],
'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')],
'tabs_border': [opt_bool, False, _('Show tabbed notebook border in chat windows?')],
'tabs_close_button': [opt_bool, True, _('Show close button in tab?')],
'esession_modp': [opt_str, '15,16,14', _('A list of modp groups to use in a Diffie-Hellman, highest preference first, separated by commas. Valid groups are 1, 2, 5, 14, 15, 16, 17 and 18. Higher numbers are more secure, but take longer to calculate when you start a session.')],
'tooltip_status_online_color': [opt_color, '#73D216'],
'tooltip_status_free_for_chat_color': [opt_color, '#3465A4'],
'tooltip_status_away_color': [opt_color, '#EDD400'],
'tooltip_status_busy_color': [opt_color, '#F57900'],
'tooltip_status_na_color': [opt_color, '#CC0000'],
'tooltip_status_offline_color': [opt_color, '#555753'],
'tooltip_affiliation_none_color': [opt_color, '#555753'],
'tooltip_affiliation_member_color': [opt_color, '#73D216'],
'tooltip_affiliation_administrator_color': [opt_color, '#F57900'],
'tooltip_affiliation_owner_color': [opt_color, '#CC0000'],
'tooltip_account_name_color': [opt_color, '#888A85'],
'tooltip_idle_color': [opt_color, '#888A85'],
'notification_preview_message': [opt_bool, True, _('Preview new messages in notification popup?')],
'notification_position_x': [opt_int, -1],
'notification_position_y': [opt_int, -1],
'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in group chats.')],
'quit_on_roster_x_button': [opt_bool, False, _('If true, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if notification icon is used.')],
'hide_on_roster_x_button': [opt_bool, False, _('If true, Gajim hides the Roster window on pressing the X button instead of minimizing into the Dock.')],
'show_unread_tab_icon': [opt_bool, False, _('If true, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')],
'show_status_msgs_in_roster': [opt_bool, True, _('If true, Gajim will display the status message, if not empty, for every contact under the contact name in roster window.'), True],
'show_avatars_in_roster': [opt_bool, True, '', True],
'show_mood_in_roster': [opt_bool, True, '', True],
'show_activity_in_roster': [opt_bool, True, '', True],
'show_tunes_in_roster': [opt_bool, True, '', True],
'show_location_in_roster': [opt_bool, True, '', True],
'avatar_position_in_roster': [opt_str, 'right', _('Define the position of the avatar in roster. Can be left or right'), True],
'print_status_in_chats': [opt_bool, False, _('If False, Gajim will no longer print status line in chats when a contact changes their status and/or their status message.')],
'print_status_in_muc': [opt_str, 'none', _('Can be "none", "all" or "in_and_out". If "none", Gajim will no longer print status line in groupchats when a member changes their status and/or their status message. If "all" Gajim will print all status messages. If "in_and_out", Gajim will only print FOO enters/leaves group chat.')],
'log_contact_status_changes': [opt_bool, False],
'log_xhtml_messages': [opt_bool, False, _('Log XHTML messages instead of plain text messages.')],
'restored_messages_small': [opt_bool, True, _('If true, restored messages will use a smaller font than the default one.')],
'hide_avatar_of_transport': [opt_bool, False, _('Don\'t show avatar for the transport itself.')],
'roster_window_skip_taskbar': [opt_bool, False, _('Don\'t show roster in the system taskbar.')],
'use_urgency_hint': [opt_bool, True, _('If true, make the window flash (the default behaviour in most Window Managers) when holding pending events.')],
'notification_timeout': [opt_int, 5],
'one_message_window': [opt_str, 'always',
#always, never, peracct, pertype should not be translated
_('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'always_with_roster\' - Like \'always\' but the messages are in a single window along with the roster.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g. chats vs. groupchats) is sent to a specific window.')],
'show_roster_on_startup':[opt_str, 'always', _('Show roster on startup.\n\'always\' - Always show roster.\n\'never\' - Never show roster.\n\'last_state\' - Restore the last state roster.')],
'show_avatar_in_chat': [opt_bool, True, _('If False, you will no longer see the avatar in the chat window.')],
'escape_key_closes': [opt_bool, True, _('If true, pressing the escape key closes a tab/window.')],
'hide_groupchat_banner': [opt_bool, False, _('Hides the banner in a group chat window')],
'hide_chat_banner': [opt_bool, False, _('Hides the banner in two persons chat window')],
'hide_groupchat_occupants_list': [opt_bool, False, _('Hides the group chat occupants list in group chat window.')],
'chat_merge_consecutive_nickname': [opt_bool, False, _('In a chat, show the nickname at the beginning of a line only when it\'s not the same person talking than in previous message.')],
'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickname.')],
'gc_nicknames_colors': [opt_str, '#4e9a06:#f57900:#ce5c00:#3465a4:#204a87:#75507b:#5c3566:#c17d11:#8f5902:#ef2929:#cc0000:#a40000', _('List of colors, separated by ":", that will be used to color nicknames in group chats.'), True],
'ctrl_tab_go_to_next_composing': [opt_bool, True, _('Ctrl-Tab go to next composing tab when none is unread.')],
'confirm_metacontacts': [opt_str, '', _('Show the confirm metacontacts creation dialog or not? Empty string means never show the dialog.')],
'confirm_block': [opt_str, '', _('Show the confirm block contact dialog or not? Empty string means never show the dialog.')],
'confirm_custom_status': [opt_str, '', _('Show the confirm custom status dialog or not? Empty string means never show the dialog.')],
'enable_negative_priority': [opt_bool, False, _('If true, you will be able to set a negative priority to your account in account modification window. BE CAREFUL, when you are logged in with a negative priority, you will NOT receive any message from your server.')],
'show_contacts_number': [opt_bool, True, _('If true, Gajim will show number of online and total contacts in account and group rows.')],
'treat_incoming_messages': [opt_str, '', _('Can be empty, \'chat\' or \'normal\'. If not empty, treat all incoming messages as if they were of this type')],
'scroll_roster_to_last_message': [opt_bool, True, _('If true, Gajim will scroll and select the contact who sent you the last message, if chat window is not already opened.')],
'change_status_window_timeout': [opt_int, 15, _('Time of inactivity needed before the change status window closes down.')],
'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')],
'attach_notifications_to_systray': [opt_bool, False, _('If true, notification windows from notification-daemon will be attached to notification icon.')],
'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')],
'uri_schemes': [opt_str, 'aaa:// aaas:// acap:// cap:// cid: crid:// data: dav: dict:// dns: fax: file:/ ftp:// geo: go: gopher:// h323: http:// https:// iax: icap:// im: imap:// info: ipp:// iris: iris.beep: iris.xpc: iris.xpcs: iris.lwz: ldap:// mid: modem: msrp:// msrps:// mtqp:// mupdate:// news: nfs:// nntp:// opaquelocktoken: pop:// pres: prospero:// rtsp:// service: shttp:// sip: sips: sms: snmp:// soap.beep:// soap.beeps:// tag: tel: telnet:// tftp:// thismessage:/ tip:// tv: urn:// vemmi:// xmlrpc.beep:// xmlrpc.beeps:// z39.50r:// z39.50s:// about: apt: cvs:// daap:// ed2k:// feed: fish:// git:// iax2: irc:// ircs:// ldaps:// magnet: mms:// rsync:// ssh:// svn:// sftp:// smb:// webcal:// aesgcm://', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled separately)'), True],
'shell_like_completion': [opt_bool, False, _('If true, completion in groupchats will be like a shell auto-completion')],
'show_self_contact': [opt_str, 'when_other_resource', _('When is self contact row displayed. Can be "always", "when_other_resource" or "never"'), True],
'audio_input_device': [opt_str, 'autoaudiosrc ! volume name=gajim_vol'],
'audio_output_device': [opt_str, 'autoaudiosink'],
'video_input_device': [opt_str, 'autovideosrc'],
'video_output_device': [opt_str, 'autovideosink'],
'video_framerate': [opt_str, '', _('Optionally fix jingle output video framerate. Example: 10/1 or 25/2')],
'video_size': [opt_str, '', _('Optionally resize jingle output video. Example: 320x240')],
'video_see_self': [opt_bool, True, _('If true, You will also see your webcam')],
'audio_input_volume': [opt_int, 50],
'audio_output_volume': [opt_int, 50],
'use_stun_server': [opt_bool, False, _('If true, Gajim will try to use a STUN server when using Jingle. The one in "stun_server" option, or the one given by the XMPP server.')],
'stun_server': [opt_str, '', _('STUN server to use when using Jingle')],
'show_affiliation_in_groupchat': [opt_bool, True, _('If true, Gajim will show affiliation of groupchat occupants by adding a colored square to the status icon')],
'global_proxy': [opt_str, '', _('Proxy used for all outgoing connections if the account does not have a specific proxy configured')],
'ignore_incoming_attention': [opt_bool, False, _('If true, Gajim will ignore incoming attention requestd ("wizz").')],
'remember_opened_chat_controls': [opt_bool, True, _('If enabled, Gajim will reopen chat windows that were opened last time Gajim was closed.')],
'positive_184_ack': [opt_bool, False, _('If enabled, Gajim will show an icon to show that sent message has been received by your contact')],
'show_avatar_in_tabs': [opt_bool, False, _('Show a mini avatar in chat window tabs and in window icon')],
'use_keyring': [opt_bool, True, _('If true, Gajim will use the Systems Keyring to store account passwords.')],
'pgp_encoding': [opt_str, '', _('Sets the encoding used by python-gnupg'), True],
'remote_commands': [opt_bool, False, _('If true, Gajim will execute XEP-0146 Commands.')],
}, {})
__options_per_key = {
'accounts': ({
'name': [ opt_str, '', '', True ],
'account_label': [ opt_str, '', '', False ],
'hostname': [ opt_str, '', '', True ],
'anonymous_auth': [ opt_bool, False ],
'avatar_sha': [opt_str, '', '', False],
'client_cert': [ opt_str, '', '', True ],
'client_cert_encrypted': [ opt_bool, False, '', False ],
'savepass': [ opt_bool, False ],
'password': [ opt_str, '' ],
'resource': [ opt_str, 'gajim.$rand', '', True ],
'priority': [ opt_int, 5, '', True ],
'adjust_priority_with_status': [ opt_bool, True, _('Priority will change automatically according to your status. Priorities are defined in autopriority_* options.') ],
'autopriority_online': [ opt_int, 50],
'autopriority_chat': [ opt_int, 50],
'autopriority_away': [ opt_int, 40],
'autopriority_xa': [ opt_int, 30],
'autopriority_dnd': [ opt_int, 20],
'autopriority_invisible': [ opt_int, 10],
'autoconnect': [ opt_bool, False, '', True ],
'autoconnect_as': [ opt_str, 'online', _('Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. NOTE: this option is used only if restore_last_status is disabled'), True ],
'restore_last_status': [ opt_bool, False, _('If enabled, restore the last status that was used.') ],
'autoreconnect': [ opt_bool, True ],
'autoauth': [ opt_bool, False, _('If true, Contacts requesting authorization will be automatically accepted.')],
'active': [ opt_bool, True, _('If False, this account will be disabled and will not appear in roster window.'), True],
'proxy': [ opt_str, '', '', True ],
'keyid': [ opt_str, '', '', True ],
'gpg_sign_presence': [ opt_bool, True, _('If disabled, don\'t sign presences with GPG key, even if GPG is configured.') ],
'keyname': [ opt_str, '', '', True ],
'allow_plaintext_connection': [ opt_bool, False, _('Allow plaintext connections')],
'tls_version': [ opt_str, '1.2', '' ],
'cipher_list': [ opt_str, 'HIGH:!aNULL', '' ],
'authentication_mechanisms': [ opt_str, '', _('List (space separated) of authentication mechanisms to try. Can contain ANONYMOUS, EXTERNAL, GSSAPI, SCRAM-SHA-1-PLUS, SCRAM-SHA-1, DIGEST-MD5, PLAIN, X-MESSENGER-OAUTH2 or XEP-0078') ],
'action_when_plaintext_connection': [ opt_str, 'warn', _('Show a warning dialog before sending password on an plaintext connection. Can be \'warn\', \'connect\', \'disconnect\'') ],
'warn_when_insecure_ssl_connection': [ opt_bool, True, _('Show a warning dialog before using standard SSL library.') ],
'warn_when_insecure_password': [ opt_bool, True, _('Show a warning dialog before sending PLAIN password over a plain connection.') ],
'ignore_ssl_errors': [ opt_str, '', _('Space separated list of ssl errors to ignore.') ],
'use_srv': [ opt_bool, True, '', True ],
'use_custom_host': [ opt_bool, False, '', True ],
'custom_port': [ opt_int, 5222, '', True ],
'custom_host': [ opt_str, '', '', True ],
'sync_with_global_status': [ opt_bool, False, ],
'no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')],
'sync_logs_with_server': [ opt_bool, True, _('On startup, Gajim will download logs stored on server, provided the server supports XEP-0313')],
'allow_no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')],
'non_minimized_gc': [ opt_str, '' ],
'attached_gpg_keys': [ opt_str, '' ],
'keep_alives_enabled': [ opt_bool, True, _('Whitespace sent after inactivity')],
'ping_alives_enabled': [ opt_bool, True, _('XMPP ping sent after inactivity')],
# send keepalive every N seconds of inactivity
'keep_alive_every_foo_secs': [ opt_int, 55 ],
'ping_alive_every_foo_secs': [ opt_int, 120 ],
'time_for_ping_alive_answer': [ opt_int, 60, _('How many seconds to wait for the answer of ping alive packet before trying to reconnect?') ],
# try for 1 minutes before giving up (aka. timeout after those seconds)
'try_connecting_for_foo_secs': [ opt_int, 60 ],
'http_auth': [opt_str, 'ask'], # yes, no, ask
'dont_ack_subscription': [opt_bool, False, _('Jabberd2 workaround')],
# proxy65 for FT
'file_transfer_proxies': [opt_str, ''],
'use_ft_proxies': [opt_bool, False, _('If checked, Gajim will use your IP and proxies defined in file_transfer_proxies option for file transfer.'), True],
'test_ft_proxies_on_startup': [opt_bool, False, _('If true, Gajim will test file transfer proxies on startup to be sure it works. Openfire\'s proxies are known to fail this test even if they work.')],
'msgwin-x-position': [opt_int, -1], # Default is to let the wm decide
'msgwin-y-position': [opt_int, -1], # Default is to let the wm decide
'msgwin-width': [opt_int, 480],
'msgwin-height': [opt_int, 440],
'is_zeroconf': [opt_bool, False],
'last_status': [opt_str, 'online'],
'last_status_msg': [opt_str, ''],
'zeroconf_first_name': [ opt_str, '', '', True ],
'zeroconf_last_name': [ opt_str, '', '', True ],
'zeroconf_jabber_id': [ opt_str, '', '', True ],
'zeroconf_email': [ opt_str, '', '', True ],
'use_env_http_proxy': [opt_bool, False],
'answer_receipts': [opt_bool, True, _('Answer to receipt requests')],
'request_receipt': [opt_bool, True, _('Sent receipt requests')],
'publish_tune': [opt_bool, False],
'publish_location': [opt_bool, False],
'subscribe_mood': [opt_bool, True],
'subscribe_activity': [opt_bool, True],
'subscribe_tune': [opt_bool, True],
'subscribe_nick': [opt_bool, True],
'subscribe_location': [opt_bool, True],
'ignore_unknown_contacts': [ opt_bool, False ],
'send_os_info': [ opt_bool, True, _("Allow Gajim to send information about the operating system you are running.") ],
'send_time_info': [ opt_bool, True, _("Allow Gajim to send your local time.") ],
'send_idle_time': [ opt_bool, True ],
'roster_version': [opt_str, ''],
'subscription_request_msg': [opt_str, '', _('Message that is sent to contacts you want to add')],
'enable_message_carbons': [ opt_bool, True, _('If enabled and if server supports this feature, Gajim will receive messages sent and received by other resources.')],
'ft_send_local_ips': [ opt_bool, True, _('If enabled, Gajim will send your local IPs so your contact can connect to your machine to transfer files.')],
'oauth2_refresh_token': [ opt_str, '', _('Latest token for OAuth 2.0 authentication.')],
'oauth2_client_id': [ opt_str, '0000000044077801', _('client_id for OAuth 2.0 authentication.')],
'oauth2_redirect_url': [ opt_str, 'https%3A%2F%2Fgajim.org%2Fmsnauth%2Findex.cgi', _('redirect_url for OAuth 2.0 authentication.')],
'opened_chat_controls': [opt_str, '', _('Space separated list of JIDs for which chat window will be re-opened on next startup.')],
'recent_groupchats': [ opt_str, '' ],
'httpupload_verify': [ opt_bool, True, _('HTTP Upload: Enable HTTPS Verification')],
'filetransfer_preference' : [ opt_str, 'httpupload', _('Preferred file transfer mechanism for file drag&drop on chat window. Can be \'httpupload\' (default) or \'jingle\'')],
'allow_posh': [ opt_bool, True, _('Allow cert verification with POSH')],
}, {}),
'statusmsg': ({
'message': [ opt_str, '' ],
'activity': [ opt_str, '' ],
'subactivity': [ opt_str, '' ],
'activity_text': [ opt_str, '' ],
'mood': [ opt_str, '' ],
'mood_text': [ opt_str, '' ],
}, {}),
'defaultstatusmsg': ({
'enabled': [ opt_bool, False ],
'message': [ opt_str, '' ],
}, {}),
'soundevents': ({
'enabled': [ opt_bool, True ],
'path': [ opt_str, '' ],
}, {}),
'proxies': ({
'type': [ opt_str, 'http' ],
'host': [ opt_str, '' ],
'port': [ opt_int, 3128 ],
'useauth': [ opt_bool, False ],
'user': [ opt_str, '' ],
'pass': [ opt_str, '' ],
'bosh_uri': [ opt_str, '' ],
'bosh_useproxy': [ opt_bool, False ],
'bosh_wait': [ opt_int, 30 ],
'bosh_hold': [ opt_int, 2 ],
'bosh_content': [ opt_str, 'text/xml; charset=utf-8' ],
'bosh_http_pipelining': [ opt_bool, False ],
'bosh_wait_for_restart_response': [ opt_bool, False ],
}, {}),
'accounts': ({
'name': [opt_str, '', '', True],
'account_label': [opt_str, '', '', False],
'hostname': [opt_str, '', '', True],
'anonymous_auth': [opt_bool, False],
'avatar_sha': [opt_str, '', '', False],
'client_cert': [opt_str, '', '', True],
'client_cert_encrypted': [opt_bool, False, '', False],
'savepass': [opt_bool, False],
'password': [opt_str, ''],
'resource': [opt_str, 'gajim.$rand', '', True],
'priority': [opt_int, 5, '', True],
'adjust_priority_with_status': [opt_bool, True, _('Priority will change automatically according to your status. Priorities are defined in autopriority_* options.')],
'autopriority_online': [opt_int, 50],
'autopriority_chat': [opt_int, 50],
'autopriority_away': [opt_int, 40],
'autopriority_xa': [opt_int, 30],
'autopriority_dnd': [opt_int, 20],
'autopriority_invisible': [opt_int, 10],
'autoconnect': [opt_bool, False, '', True],
'autoconnect_as': [opt_str, 'online', _('Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. NOTE: this option is used only if restore_last_status is disabled'), True],
'restore_last_status': [opt_bool, False, _('If enabled, restore the last status that was used.')],
'autoreconnect': [opt_bool, True],
'autoauth': [opt_bool, False, _('If true, Contacts requesting authorization will be automatically accepted.')],
'active': [opt_bool, True, _('If False, this account will be disabled and will not appear in roster window.'), True],
'proxy': [opt_str, '', '', True],
'keyid': [opt_str, '', '', True],
'gpg_sign_presence': [opt_bool, True, _('If disabled, don\'t sign presences with GPG key, even if GPG is configured.')],
'keyname': [opt_str, '', '', True],
'allow_plaintext_connection': [opt_bool, False, _('Allow plaintext connections')],
'tls_version': [opt_str, '1.2', ''],
'cipher_list': [opt_str, 'HIGH:!aNULL', ''],
'authentication_mechanisms': [opt_str, '', _('List (space separated) of authentication mechanisms to try. Can contain ANONYMOUS, EXTERNAL, GSSAPI, SCRAM-SHA-1-PLUS, SCRAM-SHA-1, DIGEST-MD5, PLAIN, X-MESSENGER-OAUTH2 or XEP-0078')],
'action_when_plaintext_connection': [opt_str, 'warn', _('Show a warning dialog before sending password on an plaintext connection. Can be \'warn\', \'connect\', \'disconnect\'')],
'warn_when_insecure_ssl_connection': [opt_bool, True, _('Show a warning dialog before using standard SSL library.')],
'warn_when_insecure_password': [opt_bool, True, _('Show a warning dialog before sending PLAIN password over a plain connection.')],
'ignore_ssl_errors': [opt_str, '', _('Space separated list of ssl errors to ignore.')],
'use_srv': [opt_bool, True, '', True],
'use_custom_host': [opt_bool, False, '', True],
'custom_port': [opt_int, 5222, '', True],
'custom_host': [opt_str, '', '', True],
'sync_with_global_status': [opt_bool, False, ],
'no_log_for': [opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')],
'sync_logs_with_server': [opt_bool, True, _('On startup, Gajim will download logs stored on server, provided the server supports XEP-0313')],
'allow_no_log_for': [opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')],
'non_minimized_gc': [opt_str, ''],
'attached_gpg_keys': [opt_str, ''],
'keep_alives_enabled': [opt_bool, True, _('Whitespace sent after inactivity')],
'ping_alives_enabled': [opt_bool, True, _('XMPP ping sent after inactivity')],
# send keepalive every N seconds of inactivity
'keep_alive_every_foo_secs': [opt_int, 55],
'ping_alive_every_foo_secs': [opt_int, 120],
'time_for_ping_alive_answer': [opt_int, 60, _('How many seconds to wait for the answer of ping alive packet before trying to reconnect?')],
# try for 1 minutes before giving up (aka. timeout after those seconds)
'try_connecting_for_foo_secs': [opt_int, 60],
'http_auth': [opt_str, 'ask'], # yes, no, ask
'dont_ack_subscription': [opt_bool, False, _('Jabberd2 workaround')],
# proxy65 for FT
'file_transfer_proxies': [opt_str, ''],
'use_ft_proxies': [opt_bool, False, _('If checked, Gajim will use your IP and proxies defined in file_transfer_proxies option for file transfer.'), True],
'test_ft_proxies_on_startup': [opt_bool, False, _('If true, Gajim will test file transfer proxies on startup to be sure it works. Openfire\'s proxies are known to fail this test even if they work.')],
'msgwin-x-position': [opt_int, -1], # Default is to let the wm decide
'msgwin-y-position': [opt_int, -1], # Default is to let the wm decide
'msgwin-width': [opt_int, 480],
'msgwin-height': [opt_int, 440],
'is_zeroconf': [opt_bool, False],
'last_status': [opt_str, 'online'],
'last_status_msg': [opt_str, ''],
'zeroconf_first_name': [opt_str, '', '', True],
'zeroconf_last_name': [opt_str, '', '', True],
'zeroconf_jabber_id': [opt_str, '', '', True],
'zeroconf_email': [opt_str, '', '', True],
'use_env_http_proxy': [opt_bool, False],
'answer_receipts': [opt_bool, True, _('Answer to receipt requests')],
'request_receipt': [opt_bool, True, _('Sent receipt requests')],
'publish_tune': [opt_bool, False],
'publish_location': [opt_bool, False],
'subscribe_mood': [opt_bool, True],
'subscribe_activity': [opt_bool, True],
'subscribe_tune': [opt_bool, True],
'subscribe_nick': [opt_bool, True],
'subscribe_location': [opt_bool, True],
'ignore_unknown_contacts': [opt_bool, False],
'send_os_info': [opt_bool, True, _("Allow Gajim to send information about the operating system you are running.")],
'send_time_info': [opt_bool, True, _("Allow Gajim to send your local time.")],
'send_idle_time': [opt_bool, True],
'roster_version': [opt_str, ''],
'subscription_request_msg': [opt_str, '', _('Message that is sent to contacts you want to add')],
'enable_message_carbons': [opt_bool, True, _('If enabled and if server supports this feature, Gajim will receive messages sent and received by other resources.')],
'ft_send_local_ips': [opt_bool, True, _('If enabled, Gajim will send your local IPs so your contact can connect to your machine to transfer files.')],
'oauth2_refresh_token': [opt_str, '', _('Latest token for OAuth 2.0 authentication.')],
'oauth2_client_id': [opt_str, '0000000044077801', _('client_id for OAuth 2.0 authentication.')],
'oauth2_redirect_url': [opt_str, 'https%3A%2F%2Fgajim.org%2Fmsnauth%2Findex.cgi', _('redirect_url for OAuth 2.0 authentication.')],
'opened_chat_controls': [opt_str, '', _('Space separated list of JIDs for which chat window will be re-opened on next startup.')],
'recent_groupchats': [opt_str, ''],
'httpupload_verify': [opt_bool, True, _('HTTP Upload: Enable HTTPS Verification')],
'filetransfer_preference' : [opt_str, 'httpupload', _('Preferred file transfer mechanism for file drag&drop on chat window. Can be \'httpupload\' (default) or \'jingle\'')],
'allow_posh': [opt_bool, True, _('Allow cert verification with POSH')],
}, {}),
'statusmsg': ({
'message': [opt_str, ''],
'activity': [opt_str, ''],
'subactivity': [opt_str, ''],
'activity_text': [opt_str, ''],
'mood': [opt_str, ''],
'mood_text': [opt_str, ''],
}, {}),
'defaultstatusmsg': ({
'enabled': [opt_bool, False],
'message': [opt_str, ''],
}, {}),
'soundevents': ({
'enabled': [opt_bool, True],
'path': [opt_str, ''],
}, {}),
'proxies': ({
'type': [opt_str, 'http'],
'host': [opt_str, ''],
'port': [opt_int, 3128],
'useauth': [opt_bool, False],
'user': [opt_str, ''],
'pass': [opt_str, ''],
'bosh_uri': [opt_str, ''],
'bosh_useproxy': [opt_bool, False],
'bosh_wait': [opt_int, 30],
'bosh_hold': [opt_int, 2],
'bosh_content': [opt_str, 'text/xml; charset=utf-8'],
'bosh_http_pipelining': [opt_bool, False],
'bosh_wait_for_restart_response': [opt_bool, False],
}, {}),
'contacts': ({
'speller_language': [ opt_str, '', _('Language for which misspelled words will be checked')],
}, {}),
'encryption': ({'encryption': [ opt_str, '', _('The currently active encryption for that contact')],
},{}),
'rooms': ({
'speller_language': [ opt_str, '', _('Language for which misspelled words will be checked')],
'muc_restore_lines': [opt_int, -2, _('How many lines to request from server when entering a groupchat. -1 means no limit, -2 means global value')],
'muc_restore_timeout': [opt_int, -2, _('Minutes of backlog to request when entering a groupchat. -1 means no limit, -2 means global value')],
'notify_on_all_messages': [opt_bool, False, _('State whether a notification is created for every message in this room')],
}, {}),
'plugins': ({
'active': [opt_bool, False, _('State whether plugins should be activated on startup (this is saved on Gajim exit). This option SHOULD NOT be used to (de)activate plug-ins. Use GUI instead.')],
},{}),
'contacts': ({
'speller_language': [opt_str, '', _('Language for which misspelled words will be checked')],
}, {}),
'encryption': ({
'encryption': [opt_str, '', _('The currently active encryption for that contact')],
}, {}),
'rooms': ({
'speller_language': [opt_str, '', _('Language for which misspelled words will be checked')],
'muc_restore_lines': [opt_int, -2, _('How many lines to request from server when entering a groupchat. -1 means no limit, -2 means global value')],
'muc_restore_timeout': [opt_int, -2, _('Minutes of backlog to request when entering a groupchat. -1 means no limit, -2 means global value')],
'notify_on_all_messages': [opt_bool, False, _('State whether a notification is created for every message in this room')],
}, {}),
'plugins': ({
'active': [opt_bool, False, _('State whether plugins should be activated on startup (this is saved on Gajim exit). This option SHOULD NOT be used to (de)activate plug-ins. Use GUI instead.')],
}, {}),
}
statusmsg_default = {
_('Sleeping'): [ 'ZZZZzzzzzZZZZZ', 'inactive', 'sleeping', '', 'sleepy', '' ],
_('Back soon'): [ _('Back in some minutes.'), '', '', '', '', '' ],
_('Eating'): [ _("I'm eating, so leave me a message."), 'eating', 'other', '', '', '' ],
_('Movie'): [ _("I'm watching a movie."), 'relaxing', 'watching_a_movie', '', '', '' ],
_('Working'): [ _("I'm working."), 'working', 'other', '', '', '' ],
_('Phone'): [ _("I'm on the phone."), 'talking', 'on_the_phone', '', '', '' ],
_('Out'): [ _("I'm out enjoying life."), 'relaxing', 'going_out', '', '', '' ],
'_last_online': ['', '', '', '', '', ''],
'_last_chat': ['', '', '', '', '', ''],
'_last_away': ['', '', '', '', '', ''],
'_last_xa': ['', '', '', '', '', ''],
'_last_dnd': ['', '', '', '', '', ''],
'_last_invisible': ['', '', '', '', '', ''],
'_last_offline': ['', '', '', '', '', ''],
_('Sleeping'): ['ZZZZzzzzzZZZZZ', 'inactive', 'sleeping', '', 'sleepy', ''],
_('Back soon'): [_('Back in some minutes.'), '', '', '', '', ''],
_('Eating'): [_("I'm eating, so leave me a message."), 'eating', 'other', '', '', ''],
_('Movie'): [_("I'm watching a movie."), 'relaxing', 'watching_a_movie', '', '', ''],
_('Working'): [_("I'm working."), 'working', 'other', '', '', ''],
_('Phone'): [_("I'm on the phone."), 'talking', 'on_the_phone', '', '', ''],
_('Out'): [_("I'm out enjoying life."), 'relaxing', 'going_out', '', '', ''],
'_last_online': ['', '', '', '', '', ''],
'_last_chat': ['', '', '', '', '', ''],
'_last_away': ['', '', '', '', '', ''],
'_last_xa': ['', '', '', '', '', ''],
'_last_dnd': ['', '', '', '', '', ''],
'_last_invisible': ['', '', '', '', '', ''],
'_last_offline': ['', '', '', '', '', ''],
}
defaultstatusmsg_default = {
'online': [ False, _("I'm available.") ],
'chat': [ False, _("I'm free for chat.") ],
'away': [ False, _('Be right back.') ],
'xa': [ False, _("I'm not available.") ],
'dnd': [ False, _('Do not disturb.') ],
'invisible': [ False, _('Bye!') ],
'offline': [ False, _('Bye!') ],
'online': [False, _("I'm available.")],
'chat': [False, _("I'm free for chat.")],
'away': [False, _('Be right back.')],
'xa': [False, _("I'm not available.")],
'dnd': [False, _('Do not disturb.')],
'invisible': [False, _('Bye!')],
'offline': [False, _('Bye!')],
}
soundevents_default = {
'attention_received': [True, 'attention.wav'],
'first_message_received': [ True, 'message1.wav' ],
'next_message_received_focused': [ True, 'message2.wav' ],
'next_message_received_unfocused': [ True, 'message2.wav' ],
'contact_connected': [ False, 'connected.wav' ],
'contact_disconnected': [ False, 'disconnected.wav' ],
'message_sent': [ False, 'sent.wav' ],
'muc_message_highlight': [ True, 'gc_message1.wav', _('Sound to play when a group chat message contains one of the words in muc_highlight_words, or when a group chat message contains your nickname.')],
'muc_message_received': [ False, 'gc_message2.wav', _('Sound to play when any MUC message arrives.') ],
'attention_received': [True, 'attention.wav'],
'first_message_received': [True, 'message1.wav'],
'next_message_received_focused': [True, 'message2.wav'],
'next_message_received_unfocused': [True, 'message2.wav'],
'contact_connected': [False, 'connected.wav'],
'contact_disconnected': [False, 'disconnected.wav'],
'message_sent': [False, 'sent.wav'],
'muc_message_highlight': [True, 'gc_message1.wav', _('Sound to play when a group chat message contains one of the words in muc_highlight_words, or when a group chat message contains your nickname.')],
'muc_message_received': [False, 'gc_message2.wav', _('Sound to play when any MUC message arrives.')],
}
proxies_default = {
@ -597,7 +600,7 @@ class Config:
opt[1][name][o] = opt[0][o][Option.VAL]
self._timeout_save()
def del_per(self, typename, name, subname = None): # per_group_of_option
def del_per(self, typename, name, subname=None): # per_group_of_option
if typename not in self.__options_per_key:
return

View File

@ -169,7 +169,7 @@ class CommonConnection:
return 'bad_pass'
return 'ok'
def get_signed_msg(self, msg, callback = None):
def get_signed_msg(self, msg, callback=None):
"""
Returns the signed message if possible or an empty string if gpg is not
used or None if waiting for passphrase
@ -293,8 +293,8 @@ class CommonConnection:
addresses = msg_iq.addChild('addresses',
namespace=nbxmpp.NS_ADDRESS)
for j in obj.jid:
addresses.addChild('address', attrs = {'type': 'to',
'jid': j})
addresses.addChild('address',
attrs={'type': 'to', 'jid': j})
else:
iqs = []
for j in obj.jid:
@ -708,7 +708,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def _connection_lost(self):
log.info('_connection_lost')
self.disconnect(on_purpose = False)
self.disconnect(on_purpose=False)
if self.removing_account:
return
app.nec.push_incoming_event(ConnectionLostEvent(None, conn=self,
@ -746,7 +746,7 @@ class Connection(CommonConnection, ConnectionHandlers):
self.gpg = gpg.GnuPG()
app.nec.push_incoming_event(
AccountCreatedEvent(None, conn=self,
account_info = self.new_account_info))
account_info=self.new_account_info))
self.new_account_info = None
self.new_account_form = None
if self.connection:
@ -1062,7 +1062,7 @@ class Connection(CommonConnection, ConnectionHandlers):
log.info(msg)
if self._proxy:
msg = '>>>>>> '
if self._proxy['type']=='bosh':
if self._proxy['type'] == 'bosh':
msg = '%s over BOSH %s' % (msg, self._proxy['bosh_uri'])
if self._proxy['type'] in ['http', 'socks5'] or self._proxy['bosh_useproxy']:
msg = '%s over proxy %s:%s' % (msg, self._proxy['host'], self._proxy['port'])
@ -1072,7 +1072,7 @@ class Connection(CommonConnection, ConnectionHandlers):
if not con_type:
# we are not retrying, and not conecting
if not self.retrycount and self.connected != 0:
self.disconnect(on_purpose = True)
self.disconnect(on_purpose=True)
if self._proxy:
pritxt = _('Could not connect to "%(host)s" via proxy "%(proxy)s"') %\
{'host': self._hostname, 'proxy': self._proxy['host']}
@ -1097,7 +1097,7 @@ class Connection(CommonConnection, ConnectionHandlers):
log.error('Connection to proxy failed: %s', reason)
self.time_to_reconnect = None
self.on_connect_failure = None
self.disconnect(on_purpose = True)
self.disconnect(on_purpose=True)
app.nec.push_incoming_event(ConnectionLostEvent(None, conn=self,
title=_('Connection to proxy failed'), msg=reason))
@ -1334,7 +1334,7 @@ class Connection(CommonConnection, ConnectionHandlers):
# Forget password, it's wrong
self.password = None
log.debug("Couldn't authenticate to %s", self._hostname)
self.disconnect(on_purpose = True)
self.disconnect(on_purpose=True)
app.nec.push_incoming_event(OurShowEvent(None, conn=self,
show='offline'))
app.nec.push_incoming_event(InformationEvent(None, conn=self,
@ -1351,7 +1351,7 @@ class Connection(CommonConnection, ConnectionHandlers):
if self.connection:
self.connection.send(' ')
def send_invisible_presence(self, msg, signed, initial = False):
def send_invisible_presence(self, msg, signed, initial=False):
if not app.account_is_connected(self.name):
return
if not self.get_module('PrivacyLists').supported:
@ -1412,7 +1412,7 @@ class Connection(CommonConnection, ConnectionHandlers):
# Inform GUI we just signed in
app.nec.push_incoming_event(SignedInEvent(None, conn=self))
def get_signed_presence(self, msg, callback = None):
def get_signed_presence(self, msg, callback=None):
if app.config.get_per('accounts', self.name, 'gpg_sign_presence'):
return self.get_signed_msg(msg, callback)
return ''

View File

@ -842,8 +842,8 @@ class FileRequestReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
n = file_tag.getTag('name')
n = n.getData() if n else None
pjid = app.get_jid_without_resource(self.fjid)
file_info = self.conn.get_file_info(pjid, hash_=h,
name=n,account=self.conn.name)
file_info = self.conn.get_file_info(
pjid, hash_=h, name=n, account=self.conn.name)
self.file_props.file_name = file_info['file-name']
self.file_props.sender = self.conn._ft_get_our_jid()
self.file_props.receiver = self.fjid
@ -1244,16 +1244,12 @@ class MessageOutgoingEvent(nec.NetworkOutgoingEvent):
return True
class StanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent):
name='stanza-message-outgoing'
name = 'stanza-message-outgoing'
def generate(self):
return True
class GcStanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent):
name='gc-stanza-message-outgoing'
name = 'gc-stanza-message-outgoing'
def generate(self):
return True
class GcMessageOutgoingEvent(nec.NetworkOutgoingEvent):
name = 'gc-message-outgoing'

View File

@ -61,7 +61,7 @@ class Event:
class ChatEvent(Event):
type_ = 'chat'
def __init__ (self, message, subject, kind, time_, encrypted, resource,
def __init__(self, message, subject, kind, time_, encrypted, resource,
msg_log_id, correct_id=None, xhtml=None, session=None, form_node=None,
displaymarking=None, sent_forwarded=False, show_in_roster=False,
show_in_systray=True, additional_data=None):
@ -301,7 +301,7 @@ class Events:
def get_nb_events(self, types=None, account=None):
if types is None:
types = []
return self._get_nb_events(types = types, account = account)
return self._get_nb_events(types=types, account=account)
def get_events(self, account, jid=None, types=None):
"""

View File

@ -274,7 +274,7 @@ def temp_failure_retry(func, *args, **kwargs):
else:
raise
def get_uf_show(show, use_mnemonic = False):
def get_uf_show(show, use_mnemonic=False):
"""
Return a userfriendly string for dnd/xa/chat and make all strings
translatable
@ -361,7 +361,7 @@ def get_uf_ask(ask):
return uf_ask
def get_uf_role(role, plural = False):
def get_uf_role(role, plural=False):
''' plural determines if you get Moderators or Moderator'''
if role == 'none':
role_name = Q_('?Group Chat Contact Role:None')
@ -516,7 +516,7 @@ def sanitize_filename(filename):
return filename
def reduce_chars_newlines(text, max_chars = 0, max_lines = 0):
def reduce_chars_newlines(text, max_chars=0, max_lines=0):
"""
Cut the chars after 'max_chars' on each line and show only the first
'max_lines'
@ -984,7 +984,7 @@ def get_notification_icon_tooltip_dict():
account_name = account['name']
account['event_lines'] = []
# Gather events per-account
pending_events = app.events.get_events(account = account_name)
pending_events = app.events.get_events(account=account_name)
messages, non_messages, total_messages, total_non_messages = {}, {}, 0, 0
for jid in pending_events:
for event in pending_events[jid]:
@ -1028,7 +1028,7 @@ def get_notification_icon_tooltip_dict():
text = ngettext(
'%d event pending',
'%d events pending',
total_non_messages, total_non_messages,total_non_messages)
total_non_messages, total_non_messages, total_non_messages)
account['event_lines'].append(text)
else:
for jid in non_messages:
@ -1194,7 +1194,7 @@ def prepare_and_validate_gpg_keyID(account, jid, keyID):
keyID = 'UNKNOWN'
return keyID
def update_optional_features(account = None):
def update_optional_features(account=None):
if account:
accounts = [account]
else:

View File

@ -1010,9 +1010,9 @@ class Logger:
lang = data[i + 2]
name = data[i + 3]
identities.append({'category': category, 'type': type_,
'xml:lang': lang, 'name': name})
'xml:lang': lang, 'name': name})
i += 4
i+=1
i += 1
while i < len(data):
features.append(data[i])
i += 1

View File

@ -71,6 +71,7 @@ def parseAndSetLogLevels(arg):
class colors:
# pylint: disable=C0326
NONE = chr(27) + "[0m"
BLACk = chr(27) + "[30m"
RED = chr(27) + "[31m"
@ -97,11 +98,11 @@ class FancyFormatter(logging.Formatter):
An eye-candy formatter with colors
"""
colors_mapping = {
'DEBUG': colors.BLUE,
'INFO': colors.GREEN,
'WARNING': colors.BROWN,
'ERROR': colors.RED,
'CRITICAL': colors.BRIGHT_RED,
'DEBUG': colors.BLUE,
'INFO': colors.GREEN,
'WARNING': colors.BROWN,
'ERROR': colors.RED,
'CRITICAL': colors.BRIGHT_RED,
}
def __init__(self, fmt, datefmt=None, use_color=False):
@ -138,11 +139,11 @@ def init():
consoleloghandler = logging.StreamHandler()
consoleloghandler.setFormatter(
FancyFormatter(
'%(asctime)s %(levelname)s %(name)s %(message)s',
'%x %H:%M:%S',
use_color
)
FancyFormatter(
'%(asctime)s %(levelname)s %(name)s %(message)s',
'%x %H:%M:%S',
use_color
)
)
# fake the root logger so we have 'gajim' root name instead of 'root'

View File

@ -141,7 +141,7 @@ class ProxyResolver:
iq = nbxmpp.Protocol(name='iq', to=self.jid, typ='set')
query = iq.setTag('query')
query.setNamespace(nbxmpp.NS_BYTESTREAM)
query.setAttr('sid', self.sid)
query.setAttr('sid', self.sid)
activate = query.setTag('activate')
activate.setData('test@gajim.org/test2')

View File

@ -35,11 +35,11 @@ else:
result = int(text)
if result < 0:
raise ValueError("Error: value '%(text)s' "
"must be a positive integer")
"must be a positive integer")
return result
def generate_uri_role( role_name, aliases, anchor_text, base_url,
interpret_url, validator):
def generate_uri_role(role_name, aliases, anchor_text, base_url,
interpret_url, validator):
"""
Create and register a uri based "interpreted role"
@ -58,13 +58,13 @@ else:
should return the validated text, or raise ValueError
"""
def uri_reference_role(role, rawtext, text, lineno, inliner,
options=None, content=None):
options=None, content=None):
if options is None:
options = {}
try:
valid_text = validator(text)
except ValueError as e:
msg = inliner.reporter.error( e.message % dict(text=text), line=lineno)
msg = inliner.reporter.error(e.message % dict(text=text), line=lineno)
prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg]
ref = base_url + interpret_url % valid_text

View File

@ -24,19 +24,21 @@ import hashlib
import os
import time
import platform
import logging
from errno import EWOULDBLOCK
from errno import ENOBUFS
from errno import EINTR
from errno import EISCONN
from errno import EINPROGRESS
from errno import EAFNOSUPPORT
from nbxmpp.idlequeue import IdleObject
import OpenSSL
from gajim.common.file_props import FilesProp
from gajim.common import app
from gajim.common import jingle_xtls
if jingle_xtls.PYOPENSSL_PRESENT:
import OpenSSL
import logging
log = logging.getLogger('gajim.c.socks5')
MAX_BUFF_LEN = 65536
# after foo seconds without activity label transfer as 'stalled'
@ -159,8 +161,8 @@ class SocksQueue:
file_props.proxy_sender = streamhost['target']
file_props.proxy_receiver = streamhost['initiator']
socks5obj = Socks5SenderClient(self.idlequeue, idx,
self, _sock=None,host=str(streamhost['host']),
port=int(streamhost['port']),fingerprint=fp,
self, _sock=None, host=str(streamhost['host']),
port=int(streamhost['port']), fingerprint=fp,
connected=False, file_props=file_props,
initiator=streamhost['initiator'],
target=streamhost['target'])
@ -342,7 +344,7 @@ class SocksQueue:
sock_hash = sock.__hash__()
if listener.file_props.type_ == 's' and \
not self.isHashInSockObjs(self.senders, sock_hash):
sockobj = Socks5SenderServer(self.idlequeue, sock_hash, self,
sockobj = Socks5SenderServer(self.idlequeue, sock_hash, self,
sock[0], sock[1][0], sock[1][1], fingerprint=None,
file_props=listener.file_props)
self._add(sockobj, self.senders, listener.file_props, sock_hash)
@ -356,8 +358,8 @@ class SocksQueue:
sh['port'] = sock[1][1]
sh['initiator'] = None
sh['target'] = None
sockobj = Socks5ReceiverServer(idlequeue=self.idlequeue,
streamhost=sh,transport_sid=None,
sockobj = Socks5ReceiverServer(idlequeue=self.idlequeue,
streamhost=sh, transport_sid=None,
file_props=listener.file_props, fingerprint=None)
self._add(sockobj, self.readers, listener.file_props, sock_hash)
@ -411,8 +413,8 @@ class SocksQueue:
if idx != -1:
for key in list(self.readers.keys()):
if idx in key:
self.remove_receiver_by_key(key,
do_disconnect=do_disconnect)
self.remove_receiver_by_key(
key, do_disconnect=do_disconnect)
if not remove_all:
break
@ -528,8 +530,8 @@ class Socks5:
def do_connect(self):
try:
self._sock.connect(self._server)
self._send=self._sock.send
self._recv=self._sock.recv
self._send = self._sock.send
self._recv = self._sock.recv
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError):
pass
except Exception as ee:
@ -545,8 +547,8 @@ class Socks5:
return None
# socket is already connected
self._sock.setblocking(False)
self._send=self._sock.send
self._recv=self._sock.recv
self._send = self._sock.send
self._recv = self._sock.recv
self.buff = ''
self.connected = True
self.file_props.connected = True
@ -855,7 +857,7 @@ class Socks5:
self.port >> 8, self.port & 0xff)
return buff
def _get_request_buff(self, msg, command = 0x01):
def _get_request_buff(self, msg, command=0x01):
"""
Connect request by domain name, sid sha, instead of domain name (jep
0096)
@ -931,7 +933,7 @@ class Socks5Sender(IdleObject):
Class for sending file to socket over socks5
"""
def __init__(self, idlequeue, sock_hash, parent, _sock, host=None,
port=None, fingerprint = None, connected=True, file_props=None):
port=None, fingerprint=None, connected=True, file_props=None):
self.fingerprint = fingerprint
self.queue_idx = sock_hash
self.queue = parent
@ -1010,8 +1012,8 @@ class Socks5Sender(IdleObject):
class Socks5Receiver(IdleObject):
def __init__(self, idlequeue, streamhost, sid, file_props = None,
fingerprint=None):
def __init__(self, idlequeue, streamhost, sid, file_props=None,
fingerprint=None):
"""
fingerprint: fingerprint of certificates we shall use, set to None if
TLS connection not desired
@ -1345,23 +1347,23 @@ class Socks5Client(Socks5):
class Socks5SenderClient(Socks5Client, Socks5Sender):
def __init__(self, idlequeue, sock_hash, parent,_sock, host=None,
port=None, fingerprint = None, connected=True, file_props=None,
def __init__(self, idlequeue, sock_hash, parent, _sock, host=None,
port=None, fingerprint=None, connected=True, file_props=None,
initiator=None, target=None):
Socks5Client.__init__(self, idlequeue, host, port, initiator, target,
file_props.transport_sid)
Socks5Sender.__init__(self,idlequeue, sock_hash, parent,_sock,
host, port, fingerprint , connected, file_props)
Socks5Sender.__init__(self, idlequeue, sock_hash, parent, _sock,
host, port, fingerprint, connected, file_props)
class Socks5SenderServer(Socks5Server, Socks5Sender):
def __init__(self, idlequeue, sock_hash, parent,_sock, host=None,
port=None, fingerprint = None, connected=True, file_props=None):
def __init__(self, idlequeue, sock_hash, parent, _sock, host=None,
port=None, fingerprint=None, connected=True, file_props=None):
Socks5Server.__init__(self, idlequeue, host, port, None, None,
file_props.transport_sid)
Socks5Sender.__init__(self,idlequeue, sock_hash, parent, _sock,
host, port, fingerprint , connected, file_props)
Socks5Sender.__init__(self, idlequeue, sock_hash, parent, _sock,
host, port, fingerprint, connected, file_props)
class Socks5ReceiverClient(Socks5Client, Socks5Receiver):
@ -1481,8 +1483,7 @@ class Socks5Listener(IdleObject):
"""
Accept a new incomming connection
"""
_sock = self._serv.accept()
_sock = self._serv.accept()
_sock[0].setblocking(False)
self.connections.append(_sock[0])
return _sock

View File

@ -315,7 +315,7 @@ class P2PClient(IdleObject):
def _register_handlers(self):
self._caller.peerhost = self.Connection._sock.getsockname()
self.RegisterHandler('message', lambda conn,
data:self._caller._messageCB(self.Server, conn, data))
data: self._caller._messageCB(self.Server, conn, data))
self.RegisterHandler('iq', self._caller._siSetCB, 'set', nbxmpp.NS_SI)
self.RegisterHandler('iq', self._caller._siErrorCB, 'error',
nbxmpp.NS_SI)
@ -522,7 +522,7 @@ class P2PConnection(IdleObject, PlugIn):
self.pollend()
# don't proccess result, cas it will raise error
return
elif not received :
elif not received:
if errnum != ssl.SSL_ERROR_EOF:
# 8 EOF occurred in violation of protocol
self.pollend()
@ -716,7 +716,7 @@ class ClientZeroconf:
connection.force_disconnect()
def add_connection(self, connection, ip, port, recipient):
sock_hash=connection.sock_hash
sock_hash = connection.sock_hash
if sock_hash not in self.connections:
self.connections[sock_hash] = connection
self.ip_to_hash[ip] = sock_hash

View File

@ -132,7 +132,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
for key in diffs:
self.roster.setItem(key)
app.nec.push_incoming_event(NetworkEvent(
'roster-info', conn=self,jid=key,
'roster-info', conn=self, jid=key,
nickname=self.roster.getName(key), sub='both',
ask='no', groups=self.roster.getGroups(key),
avatar_sha=None))

View File

@ -62,7 +62,7 @@ class Roster:
i += 1
txt = contact[Constant.TXT]
self._data[jid]={}
self._data[jid] = {}
self._data[jid]['ask'] = 'none'
self._data[jid]['subscription'] = 'both'
self._data[jid]['groups'] = []

View File

@ -77,7 +77,7 @@ class Zeroconf:
return
# synchronous resolving
self.server.ResolveService( int(interface), int(protocol), name, stype,
self.server.ResolveService(int(interface), int(protocol), name, stype,
domain, Protocol.UNSPEC, dbus.UInt32(0),
reply_handler=self.service_resolved_callback,
error_handler=self.error_callback1)
@ -474,7 +474,7 @@ class Zeroconf:
return None
return self.contacts[jid]
def update_txt(self, show = None):
def update_txt(self, show=None):
if show:
self.txt['status'] = self.replace_show(show)

View File

@ -58,7 +58,7 @@ class DomainBrowser(IntEnum):
class Protocol(IntEnum):
UNSPEC = -1
INET = 0
INET6 = 1
INET6 = 1
class Interface(IntEnum):

View File

@ -199,7 +199,7 @@ class ManageProxiesWindow:
else:
proxytype = app.config.get_per('proxies', proxy, 'type')
self.show_bosh_fields(proxytype=='bosh')
self.show_bosh_fields(proxytype == 'bosh')
self.proxyname_entry.set_editable(True)
self.xml.get_object('remove_proxy_button').set_sensitive(True)
@ -254,7 +254,7 @@ class ManageProxiesWindow:
return
types = ['http', 'socks5', 'bosh']
type_ = self.proxytype_combobox.get_active()
self.show_bosh_fields(types[type_]=='bosh')
self.show_bosh_fields(types[type_] == 'bosh')
proxy = self.proxyname_entry.get_text()
app.config.set_per('proxies', proxy, 'type', types[type_])
@ -314,7 +314,7 @@ class FakeDataForm(Gtk.Table):
nbrow = 0
if 'instructions' in self.infos:
nbrow = 1
self.resize(rows = nbrow, columns = 2)
self.resize(rows=nbrow, columns=2)
label = Gtk.Label(label=self.infos['instructions'])
if self.selectable:
label.set_selectable(True)
@ -326,7 +326,7 @@ class FakeDataForm(Gtk.Table):
continue
nbrow = nbrow + 1
self.resize(rows = nbrow, columns = 2)
self.resize(rows=nbrow, columns=2)
label = Gtk.Label(label=name.capitalize() + ':')
self.attach(label, 0, 1, nbrow - 1, nbrow, 0, 0, 0, 0)
entry = Gtk.Entry()

View File

@ -153,14 +153,13 @@ class ConversationTextview(GObject.GObject):
Class for the conversation textview (where user reads already said messages)
for chat/groupchat windows
"""
__gsignals__ = dict(
quote = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION,
None, # return value
(str, ) # arguments
)
)
__gsignals__ = dict(quote=(
GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION,
None, # return value
(str, ) # arguments
))
def __init__(self, account, used_in_history_window = False):
def __init__(self, account, used_in_history_window=False):
"""
If used_in_history_window is True, then we do not show Clear menuitem in
context menu
@ -287,7 +286,7 @@ class ConversationTextview(GObject.GObject):
tag = buffer_.create_tag('underline')
tag.set_property('underline', Pango.Underline.SINGLE)
buffer_.create_tag('focus-out-line', justification = Gtk.Justification.CENTER)
buffer_.create_tag('focus-out-line', justification=Gtk.Justification.CENTER)
self.displaymarking_tags = {}
tag = buffer_.create_tag('xep0184-received')
@ -494,7 +493,7 @@ class ConversationTextview(GObject.GObject):
buffer_.end_user_action()
self.scroll_to_end()
def clear(self, tv = None):
def clear(self, tv=None):
"""
Clear text in the textview
"""
@ -599,7 +598,7 @@ class ConversationTextview(GObject.GObject):
item.set_property('sensitive', False)
else:
item = Gtk.MenuItem.new_with_mnemonic(_('Web _Search for it'))
link = search_link % phrase_for_url
link = search_link % phrase_for_url
id_ = item.connect('activate', self.visit_url_from_menuitem, link)
self.handlers[id_] = item
submenu.append(item)

View File

@ -21,20 +21,20 @@ Words single and multiple refers here to types of data forms:
single means these with one record of data (without <reported/> element),
multiple - these which may contain more data (with <reported/> element).'''
import itertools
import base64
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject
from gi.repository import GLib
import base64
from gajim import gtkgui_helpers
from gajim.common.modules import dataforms
from gajim.common import helpers
from gajim.common import app
import itertools
class DataFormWidget(Gtk.Alignment):
# "public" interface
@ -42,9 +42,8 @@ class DataFormWidget(Gtk.Alignment):
Data Form widget. Use like any other widget
"""
__gsignals__ = dict(
validated = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ())
)
__gsignals__ = dict(validated=(
GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ()))
def __init__(self, dataformnode=None):
''' Create a widget. '''
@ -313,8 +312,8 @@ class SingleForm(Gtk.Table):
forms, it is in another class
"""
__gsignals__ = dict(
validated = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ())
__gsignals__ = dict(validated=(
GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ())
)
def __init__(self, dataform, selectable=False):
@ -376,7 +375,7 @@ class SingleForm(Gtk.Table):
widget.set_property('selectable', selectable)
widget.set_line_wrap(True)
self.attach(widget, leftattach, rightattach, linecounter,
linecounter+1, xoptions=Gtk.AttachOptions.FILL,
linecounter + 1, xoptions=Gtk.AttachOptions.FILL,
yoptions=Gtk.AttachOptions.FILL)
elif field.type_ == 'list-single':
@ -476,16 +475,16 @@ class SingleForm(Gtk.Table):
decorate_with_tooltip(treeview, field)
add_button=xml.get_object('add_button')
add_button = xml.get_object('add_button')
add_button.connect('clicked',
self.on_jid_multi_add_button_clicked, treeview, listmodel, field)
edit_button=xml.get_object('edit_button')
edit_button = xml.get_object('edit_button')
edit_button.connect('clicked',
self.on_jid_multi_edit_button_clicked, treeview)
remove_button=xml.get_object('remove_button')
remove_button = xml.get_object('remove_button')
remove_button.connect('clicked',
self.on_jid_multi_remove_button_clicked, treeview, field)
clear_button=xml.get_object('clear_button')
clear_button = xml.get_object('clear_button')
clear_button.connect('clicked',
self.on_jid_multi_clean_button_clicked, listmodel, field)
if not readwrite:
@ -526,7 +525,7 @@ class SingleForm(Gtk.Table):
widget = Gtk.ScrolledWindow()
widget.add(textwidget)
widget=decorate_with_tooltip(widget, field)
widget = decorate_with_tooltip(widget, field)
self.attach(widget, 1, 2, linecounter, linecounter+1)
else:
@ -548,13 +547,13 @@ class SingleForm(Gtk.Table):
field.value = ''
widget.set_text(field.value)
else:
commonwidget=False
commonwidget = False
widget = Gtk.Label(label=field.value)
widget.set_property('selectable', selectable)
widget.set_sensitive(True)
widget.set_halign(Gtk.Align.START)
widget.set_valign(Gtk.Align.CENTER)
widget=decorate_with_tooltip(widget, field)
widget = decorate_with_tooltip(widget, field)
self.attach(widget, 1, 2, linecounter, linecounter+1,
yoptions=Gtk.AttachOptions.FILL)
@ -602,7 +601,7 @@ class SingleForm(Gtk.Table):
self.attach(label, 2, 3, linecounter, linecounter+1, xoptions=0,
yoptions=0)
linecounter+=1
linecounter += 1
if self.get_property('visible'):
self.show_all()
@ -621,7 +620,7 @@ class SingleForm(Gtk.Table):
if widget.get_active() and value not in field.values:
field.values += [value]
elif not widget.get_active() and value in field.values:
field.values = [v for v in field.values if v!=value]
field.values = [v for v in field.values if v != value]
def on_text_single_entry_changed(self, widget, field):
field.value = widget.get_text()
@ -644,10 +643,10 @@ class SingleForm(Gtk.Table):
app.interface.raise_dialog('jid-in-list')
GLib.idle_add(treeview.set_cursor, path)
return
model[path][0]=newtext
model[path][0] = newtext
values = field.values
values[values.index(old)]=newtext
values[values.index(old)] = newtext
field.values = values
def on_jid_multi_add_button_clicked(self, widget, treeview, model, field):
@ -673,7 +672,7 @@ class SingleForm(Gtk.Table):
deleted = []
def remove(model, path, iter_, deleted):
deleted+=model[iter_]
deleted += model[iter_]
model.remove(iter_)
selection.selected_foreach(remove, deleted)

View File

@ -235,7 +235,7 @@ class PassphraseDialog:
self.window.show_all()
self.check = bool(checkbuttontext)
checkbutton = self.xml.get_object('save_passphrase_checkbutton')
checkbutton = self.xml.get_object('save_passphrase_checkbutton')
if self.check:
checkbutton.set_label(checkbuttontext)
else:
@ -321,7 +321,7 @@ class ChooseGPGKeyDialog:
selection = self.keys_treeview.get_selection()
(model, iter_) = selection.get_selected()
if iter_ and response == Gtk.ResponseType.OK:
keyID = [ model[iter_][0], model[iter_][1] ]
keyID = [model[iter_][0], model[iter_][1]]
else:
keyID = None
self.on_response(keyID)
@ -1048,8 +1048,8 @@ class SynchroniseSelectContactsDialog:
self.remote_account, remote_jid)
# keep same groups and same nickname
app.interface.roster.req_sub(self, remote_jid, message,
self.local_account, groups = remote_contact.groups,
nickname = remote_contact.name, auto_auth = True)
self.local_account, groups=remote_contact.groups,
nickname=remote_contact.name, auto_auth=True)
iter_ = model.iter_next(iter_)
self.dialog.destroy()
@ -1219,7 +1219,7 @@ class RosterItemExchangeWindow:
a = 0
while iter_:
if model[iter_][0]:
a+=1
a += 1
# it is selected
#remote_jid = model[iter_][1]
message = _('%s suggested me to add you in my roster.'
@ -1242,7 +1242,7 @@ class RosterItemExchangeWindow:
a = 0
while iter_:
if model[iter_][0]:
a+=1
a += 1
# it is selected
jid = model[iter_][1]
# keep same groups and same nickname
@ -1267,7 +1267,7 @@ class RosterItemExchangeWindow:
a = 0
while iter_:
if model[iter_][0]:
a+=1
a += 1
# it is selected
jid = model[iter_][1]
app.connections[self.account].get_module('Presence').unsubscribe(jid)

View File

@ -132,7 +132,7 @@ class CacheDictionary:
accessed instead of set as well
"""
def __init__(self, lifetime, getrefresh = True):
def __init__(self, lifetime, getrefresh=True):
self.lifetime = lifetime * 1000 * 60
self.getrefresh = getrefresh
self.cache = {}
@ -215,7 +215,7 @@ class Closure:
Userargs and removeargs must be tuples.
"""
def __init__(self, cb, userargs = (), remove = None, removeargs = ()):
def __init__(self, cb, userargs=(), remove=None, removeargs=()):
self.userargs = userargs
self.remove = remove
self.removeargs = removeargs
@ -250,8 +250,8 @@ class ServicesCache:
def __init__(self, account):
self.account = account
self._items = CacheDictionary(0, getrefresh = False)
self._info = CacheDictionary(0, getrefresh = False)
self._items = CacheDictionary(0, getrefresh=False)
self._info = CacheDictionary(0, getrefresh=False)
self._subscriptions = CacheDictionary(5, getrefresh=False)
self._cbs = {}
@ -597,7 +597,7 @@ _('Without a connection, you can not browse available services'))
markup += '\n<span size="x-small">%s</span>' % text_after
self.banner.set_markup(markup)
def destroy(self, chain = False):
def destroy(self, chain=False):
"""
Close the browser. This can optionally close its children and propagate
to the parent. This should happen on actions like register, or join to
@ -621,13 +621,13 @@ _('Without a connection, you can not browse available services'))
for child in self.children[:]:
child.parent = None
if chain:
child.destroy(chain = chain)
child.destroy(chain=chain)
self.children.remove(child)
if self.parent:
if self in self.parent.children:
self.parent.children.remove(self)
if chain and not self.parent.children:
self.parent.destroy(chain = chain)
self.parent.destroy(chain=chain)
self.parent = None
else:
self.cache.cleanup()
@ -746,7 +746,7 @@ _('Without a connection, you can not browse available services'))
' '.join(self.latest_addresses))
self.travel(jid, '')
def on_services_treeview_row_activated(self, widget, path, col = 0):
def on_services_treeview_row_activated(self, widget, path, col=0):
if self.browser:
self.browser.default_action()
@ -915,7 +915,7 @@ class AgentBrowser:
"""
pass
def on_browse_button_clicked(self, widget = None):
def on_browse_button_clicked(self, widget=None):
"""
When we want to browse an agent: open a new services window with a
browser for the agent type
@ -940,7 +940,7 @@ class AgentBrowser:
jid = model[iter_][0]
node = model[iter_][1]
if jid:
self.cache.get_info(jid, node, self._update_actions, nofetch = True)
self.cache.get_info(jid, node, self._update_actions, nofetch=True)
def _update_actions(self, jid, node, identities, features, data):
"""
@ -963,7 +963,7 @@ class AgentBrowser:
jid = model[iter_][0]
node = model[iter_][1]
if jid:
self.cache.get_info(jid, node, self._default_action, nofetch = True)
self.cache.get_info(jid, node, self._default_action, nofetch=True)
def _default_action(self, jid, node, identities, features, data):
"""
@ -1079,7 +1079,7 @@ class AgentBrowser:
"""
self.model.append((jid, node, item.get('name', ''),
get_agent_address(jid, node)))
self.cache.get_info(jid, node, self._agent_info, force = force)
self.cache.get_info(jid, node, self._agent_info, force=force)
def _update_item(self, iter_, jid, node, item):
"""
@ -1281,7 +1281,7 @@ class ToplevelAgentBrowser(AgentBrowser):
self.search_button = None
AgentBrowser._clean_actions(self)
def on_search_button_clicked(self, widget = None):
def on_search_button_clicked(self, widget=None):
"""
When we want to search something: open search window
"""
@ -1316,7 +1316,7 @@ class ToplevelAgentBrowser(AgentBrowser):
node = model[iter_][1]
adhoc_commands.CommandWindow(self.account, service, commandnode=node)
def on_register_button_clicked(self, widget = None):
def on_register_button_clicked(self, widget=None):
"""
When we want to register an agent: request information about registering
with the agent and close the window
@ -1366,8 +1366,8 @@ class ToplevelAgentBrowser(AgentBrowser):
# Guess what kind of service we're dealing with
if self.browse_button:
jid = model[iter_][0]
type_ = app.get_transport_name_from_jid(jid,
use_config_setting = False)
type_ = app.get_transport_name_from_jid(
jid, use_config_setting=False)
if type_:
identity = {'category': '_jid', 'type': type_}
klass = self.cache.get_browser([identity])
@ -1417,7 +1417,7 @@ class ToplevelAgentBrowser(AgentBrowser):
def browse(self, force=False):
self._progress = 0
AgentBrowser.browse(self, force = force)
AgentBrowser.browse(self, force=force)
def _expand_all(self):
"""
@ -1533,8 +1533,8 @@ class ToplevelAgentBrowser(AgentBrowser):
descr = "<b>%s</b>" % addr
# Guess which kind of service this is
identities = []
type_ = app.get_transport_name_from_jid(jid,
use_config_setting = False)
type_ = app.get_transport_name_from_jid(
jid, use_config_setting=False)
if type_:
identity = {'category': '_jid', 'type': type_}
identities.append(identity)
@ -1801,7 +1801,7 @@ class MucBrowser(AgentBrowser):
iter_ = self.model.iter_next(iter_)
self._fetch_source = None
def _channel_altinfo(self, jid, node, items, name = None):
def _channel_altinfo(self, jid, node, items, name=None):
"""
Callback for the alternate disco#items query. We try to at least get the
amount of users in the room if the service does not support MUC dataforms
@ -1857,7 +1857,7 @@ class MucBrowser(AgentBrowser):
break
else:
# We didn't find a form, switch to alternate query mode
self.cache.get_items(jid, node, self._channel_altinfo, args = (name,))
self.cache.get_items(jid, node, self._channel_altinfo, args=(name,))
return
# Continue with the next
self._fetch_source = None
@ -1975,8 +1975,8 @@ class DiscussionGroupsBrowser(AgentBrowser):
parent_iter = None
if not node or not self._in_list(node):
self.model.append(parent_iter, (jid, node, name, dunno, subscribed))
self.cache.get_items(jid, node, self._add_items, force = force,
args = (force,))
self.cache.get_items(
jid, node, self._add_items, force=force, args=(force,))
def _get_child_iter(self, parent_iter, node):
child_iter = self.model.iter_children(parent_iter)
@ -2141,7 +2141,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
model = self.window.services_treeview.get_model()
for row in model:
if row[1] == groupnode: # 1 = groupnode
row[4]=False
row[4] = False
break
self.update_actions()

View File

@ -459,7 +459,7 @@ class FileTransfersWindow:
return self.images.setdefault(ident,
gtkgui_helpers.get_icon_pixmap(self.icons[ident], 24))
def set_status(self,file_props, status):
def set_status(self, file_props, status):
"""
Change the status of a transfer to state 'status'
"""
@ -519,7 +519,7 @@ class FileTransfersWindow:
return _str
def _format_time(self, _time):
times = { 'hours': 0, 'minutes': 0, 'seconds': 0 }
times = {'hours': 0, 'minutes': 0, 'seconds': 0}
_time = int(_time)
times['seconds'] = _time % 60
if _time >= 60:

View File

@ -173,7 +173,7 @@ class GajimRemote:
],
'prefs_list': [
_('Lists all preferences and their values'),
[ ]
[]
],
'prefs_put': [
_('Sets value of \'key\' to \'value\'.'),
@ -191,7 +191,7 @@ class GajimRemote:
'prefs_store': [
_('Writes the current state of Gajim preferences to the .config '
'file'),
[ ]
[]
],
'remove_contact': [
_('Removes contact from roster'),
@ -219,7 +219,7 @@ class GajimRemote:
'get_unread_msgs_number': [
_('Returns number of unread messages'),
[ ]
[]
],
'send_xml': [
@ -380,7 +380,7 @@ class GajimRemote:
"""
Print usage, and list available commands
"""
s = _('Usage:\n %s command [arguments]\n\nCommand is one of:\n' ) % (
s = _('Usage:\n %s command [arguments]\n\nCommand is one of:\n') % (
BASENAME)
for command in sorted(self.commands):
s += ' ' + command
@ -392,7 +392,7 @@ class GajimRemote:
s += '\n'
return s
def print_info(self, level, prop_dict, encode_return = False):
def print_info(self, level, prop_dict, encode_return=False):
"""
Return formatted string from data structure
"""
@ -404,11 +404,11 @@ class GajimRemote:
spacing = ' ' * level * 4
for val in prop_dict:
if val is None:
ret_str +='\t'
ret_str += '\t'
elif isinstance(val, int):
ret_str +='\t' + str(val)
ret_str += '\t' + str(val)
elif isinstance(val, str):
ret_str +='\t' + val
ret_str += '\t' + val
elif isinstance(val, (list, tuple)):
res = ''
for items in val:

View File

@ -1306,7 +1306,7 @@ class GroupchatControl(ChatControlBase):
except KeyError:
return None
def print_old_conversation(self, text, contact='', tim=None, xhtml = None,
def print_old_conversation(self, text, contact='', tim=None, xhtml=None,
displaymarking=None, msg_stanza_id=None, encrypted=None, additional_data=None):
if additional_data is None:
additional_data = {}
@ -1893,19 +1893,19 @@ class GroupchatControl(ChatControlBase):
self.print_conversation(s, 'info', graphics=False)
elif '321' in obj.status_code:
s = _('%(nick)s has been removed from the room '
'(%(reason)s)') % { 'nick': nick,
'reason': _('affiliation changed') }
'(%(reason)s)') % {'nick': nick,
'reason': _('affiliation changed')}
self.print_conversation(s, 'info', graphics=False)
elif '322' in obj.status_code:
s = _('%(nick)s has been removed from the room '
'(%(reason)s)') % { 'nick': nick,
'(%(reason)s)') % {'nick': nick,
'reason': _('room configuration changed to '
'members-only') }
'members-only')}
self.print_conversation(s, 'info', graphics=False)
elif '332' in obj.status_code:
s = _('%(nick)s has been removed from the room '
'(%(reason)s)') % {'nick': nick,
'reason': _('system shutdown') }
'reason': _('system shutdown')}
self.print_conversation(s, 'info', graphics=False)
# Room has been destroyed.
elif 'destroyed' in obj.status_code:
@ -2640,7 +2640,7 @@ class GroupchatControl(ChatControlBase):
item.set_active(target_role != 'visitor')
if user_role != 'moderator' or \
user_affiliation == 'none' or \
(user_affiliation=='member' and target_affiliation!='none') or \
(user_affiliation == 'member' and target_affiliation != 'none') or \
target_affiliation in ('admin', 'owner'):
item.set_sensitive(False)
id_ = item.connect('activate', self.on_voice_checkmenuitem_activate,
@ -2695,7 +2695,7 @@ class GroupchatControl(ChatControlBase):
bookmarked = False
contact = app.contacts.get_contact(self.account, jid, c.resource)
if contact and contact.supports(nbxmpp.NS_CONFERENCE):
bookmarked=True
bookmarked = True
gui_menu_builder.build_invite_submenu(item, ((c, self.account),),
ignore_rooms=[self.room_jid], show_bookmarked=bookmarked)
else:

View File

@ -567,7 +567,7 @@ class HistoryWindow:
else:
message = _('%(nick)s is now %(status)s') % {
'nick': contact_name,
'status': helpers.get_uf_show(show) }
'status': helpers.get_uf_show(show)}
tag_msg = 'status'
else: # 'status'
# message here (if not None) is status message

View File

@ -88,7 +88,7 @@ class Preferences(Gtk.ApplicationWindow):
# Display status msg under contact name in roster
st = app.config.get('show_status_msgs_in_roster')
self.xml.get_object('show_status_msgs_in_roster_checkbutton'). \
set_active( st)
set_active(st)
# Display PEP in roster
st1 = app.config.get('show_mood_in_roster')

View File

@ -96,7 +96,7 @@ class SingleMessageWindow:
self.close_button = self.xml.get_object('close_button')
self.message_tv_buffer.connect('changed', self.update_char_counter)
if isinstance(to, list):
jid = ', '.join( [i[0].get_full_jid() for i in to])
jid = ', '.join([i[0].get_full_jid() for i in to])
self.to_entry.set_text(jid)
self.to_entry.set_sensitive(False)
else:

View File

@ -491,7 +491,7 @@ def on_avatar_save_as_menuitem_activate(widget, avatar, default_name=''):
_('Image cannot be saved in %(type)s format. Save as '
'%(new_filename)s?') % {'type': image_format,
'new_filename': new_file_path},
on_response_ok = (on_ok, new_file_path, pixbuf))
on_response_ok=(on_ok, new_file_path, pixbuf))
def on_ok(file_path):
if os.path.exists(file_path):
@ -522,7 +522,7 @@ def on_avatar_save_as_menuitem_activate(widget, avatar, default_name=''):
file_name='%s.png' % default_name,
transient_for=transient)
def create_combobox(value_list, selected_value = None):
def create_combobox(value_list, selected_value=None):
"""
Value_list is [(label1, value1)]
"""
@ -588,7 +588,7 @@ def load_mood_icon(icon_name):
icon_list = _load_icon_list([icon_name], path)
return icon_list[icon_name]
def load_activity_icon(category, activity = None):
def load_activity_icon(category, activity=None):
"""
Load an icon from the activity iconset in 16x16
"""
@ -672,7 +672,7 @@ def load_icons_meta():
pixc = None
return pixo, pixc
def _load_icon_list(icons_list, path, pixbuf2 = None):
def _load_icon_list(icons_list, path, pixbuf2=None):
"""
Load icons in icons_list from the given path, and add pixbuf2 on top left of
each static images
@ -764,9 +764,9 @@ def label_set_autowrap(widget):
Make labels automatically re-wrap if their containers are resized.
Accepts label or container widgets
"""
if isinstance (widget, Gtk.Container):
if isinstance(widget, Gtk.Container):
children = widget.get_children()
for i in list(range (len (children))):
for i in list(range(len(children))):
label_set_autowrap(children[i])
elif isinstance(widget, Gtk.Label):
widget.set_line_wrap(True)
@ -785,11 +785,11 @@ def __label_size_allocate(widget, allocation):
# set wrap width to the Pango.Layout of the labels ###
widget.set_alignment(0.0, 0.0)
layout.set_width (allocation.width * Pango.SCALE)
layout.set_width(allocation.width * Pango.SCALE)
lh = layout.get_size()[1]
if lh_old != lh:
widget.set_size_request (-1, lh / Pango.SCALE)
widget.set_size_request(-1, lh / Pango.SCALE)
def get_action(action):
return app.app.lookup_action(action)

View File

@ -210,7 +210,7 @@ class Interface:
if len(obj.id_) > 3 and obj.id_[2] == '_':
sid = obj.id_[3:]
file_props = FilesProp.getFileProp(obj.conn.name, sid)
if file_props :
if file_props:
if str(obj.errcode) == '400':
file_props.error = -3
else:
@ -1011,7 +1011,7 @@ class Interface:
event_class = events.FileStoppedEvent
msg_type = 'file-stopped'
event_type = _('File Transfer Stopped')
elif file_props.error == -10:
elif file_props.error == -10:
event_class = events.FileHashErrorEvent
msg_type = 'file-hash-error'
event_type = _('File Transfer Failed')

View File

@ -375,7 +375,7 @@ control=None, gc_contact=None, is_anonymous=True):
c_ = app.contacts.get_contact(account, gc_contact.jid,
gc_contact.resource)
if c_ and c_.supports(NS_CONFERENCE):
bookmarked=True
bookmarked = True
build_invite_submenu(invite_menuitem, [(gc_contact, account)],
show_bookmarked=bookmarked)
else:

View File

@ -93,9 +93,9 @@ _element_styles = {
_element_styles['dfn'] = _element_styles['em']
_element_styles['var'] = _element_styles['em']
# deprecated, legacy, presentational
_element_styles['tt'] = _element_styles['kbd']
_element_styles['i'] = _element_styles['em']
_element_styles['b'] = _element_styles['strong']
_element_styles['tt'] = _element_styles['kbd']
_element_styles['i'] = _element_styles['em']
_element_styles['b'] = _element_styles['strong']
# ==========
# XEP-0071
@ -168,11 +168,11 @@ _element_styles['b'] = _element_styles['strong']
# Param/Legacy param, font, basefont, center, s, strike, u, dir, menu,
# isindex
BLOCK_HEAD = set(( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', ))
BLOCK_PHRASAL = set(( 'address', 'blockquote', 'pre', ))
BLOCK_PRES = set(( 'hr', )) #not in xhtml-im
BLOCK_STRUCT = set(( 'div', 'p', ))
BLOCK_HACKS = set(( 'table', 'tr' )) # at the very least, they will start line ;)
BLOCK_HEAD = set(('h1', 'h2', 'h3', 'h4', 'h5', 'h6',))
BLOCK_PHRASAL = set(('address', 'blockquote', 'pre',))
BLOCK_PRES = set(('hr', )) #not in xhtml-im
BLOCK_STRUCT = set(('div', 'p', ))
BLOCK_HACKS = set(('table', 'tr')) # at the very least, they will start line ;)
BLOCK = BLOCK_HEAD.union(BLOCK_PHRASAL).union(BLOCK_STRUCT).union(BLOCK_PRES).union(BLOCK_HACKS)
INLINE_PHRASAL = set('abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var'.split(', '))
@ -180,13 +180,13 @@ INLINE_PRES = set('b, i, u, tt'.split(', ')) #not in xhtml-im
INLINE_STRUCT = set('br, span'.split(', '))
INLINE = INLINE_PHRASAL.union(INLINE_PRES).union(INLINE_STRUCT)
LIST_ELEMS = set( 'dl, ol, ul'.split(', '))
LIST_ELEMS = set('dl, ol, ul'.split(', '))
for _name in BLOCK_HEAD:
_num = eval(_name[1])
_header_size = (_num - 1) // 2
_weight = (_num - 1) % 2
_element_styles[_name] = '; font-size: %s; %s' % ( ('large', 'medium', 'small')[_header_size],
_element_styles[_name] = '; font-size: %s; %s' % (('large', 'medium', 'small')[_header_size],
('font-weight: bold', 'font-style: oblique')[_weight],)
def _parse_css_color(color):
@ -214,7 +214,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
self.iter = startiter
self.conv_textview = conv_textview
self.text = ''
self.starting=True
self.starting = True
self.preserve = False
self.styles = [] # a Gtk.TextTag or None, for each span level
self.list_counters = [] # stack (top at head) of list
@ -359,12 +359,12 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
'large': 1.2,
'x-large': 1.4399999999999,
'xx-large': 1.728,
} [value]
}[value]
except KeyError:
pass
else:
attrs = self._get_current_attributes()
if attrs.font_scale ==0:
if attrs.font_scale == 0:
tag.set_property('scale', scale)
return
if value == 'smaller':
@ -383,7 +383,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
'normal': Pango.Style.NORMAL,
'italic': Pango.Style.ITALIC,
'oblique': Pango.Style.OBLIQUE,
} [value]
}[value]
except KeyError:
log.warning('unknown font-style %s', value)
else:
@ -420,7 +420,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
'900': Pango.Weight.HEAVY,
'normal': Pango.Weight.NORMAL,
'bold': Pango.Weight.BOLD,
} [value]
}[value]
except KeyError:
log.warning('unknown font-style %s', value)
else:
@ -436,7 +436,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
'right': Gtk.Justification.RIGHT,
'center': Gtk.Justification.CENTER,
'justify': Gtk.Justification.FILL,
} [value]
}[value]
except KeyError:
log.warning('Invalid text-align: %s requested', value)
else:
@ -1065,11 +1065,11 @@ class HtmlTextView(Gtk.TextView):
if anchor:
text = anchor.plaintext
if text:
selection+=text
selection += text
else:
selection+=character
selection += character
else:
selection+=character
selection += character
search_iter.forward_char()
return selection

View File

@ -396,7 +396,7 @@ class MessageTextView(Gtk.TextView):
def destroy(self):
GLib.idle_add(gc.collect)
def clear(self, widget = None):
def clear(self, widget=None):
"""
Clear text in the textview
"""

View File

@ -109,7 +109,7 @@ class MessageWindow:
id_ = self.window.connect('focus-in-event', self._on_window_focus)
self.handlers[id_] = self.window
keys=['<Control>f', '<Control>g', '<Control>h', '<Control>i',
keys = ['<Control>f', '<Control>g', '<Control>h', '<Control>i',
'<Control>l', '<Control>L', '<Control><Shift>n', '<Control>u',
'<Control>b', '<Control>F4',
'<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right',
@ -546,7 +546,7 @@ class MessageWindow:
self.window.present()
GLib.idle_add(ctrl.msg_textview.grab_focus)
def remove_tab(self, ctrl, method, reason = None, force = False):
def remove_tab(self, ctrl, method, reason=None, force=False):
"""
Reason is only for gc (offline status message) if force is True, do not
ask any confirmation
@ -557,8 +557,9 @@ class MessageWindow:
else: # We are leaving gc without status message or it's a chat
ctrl.shutdown()
# Update external state
app.events.remove_events(ctrl.account, ctrl.get_full_jid,
types = ['printed_msg', 'chat', 'gc_msg'])
app.events.remove_events(
ctrl.account, ctrl.get_full_jid,
types=['printed_msg', 'chat', 'gc_msg'])
fjid = ctrl.get_full_jid()
jid = app.get_jid_without_resource(fjid)
@ -821,7 +822,7 @@ class MessageWindow:
new_ctrl = self._widget_to_control(notebook.get_nth_page(page_num))
new_ctrl.set_control_active(True)
self.show_title(control = new_ctrl)
self.show_title(control=new_ctrl)
control = self.get_active_control()
if isinstance(control, ChatControlBase):
@ -1044,7 +1045,7 @@ class MessageWindowMgr(GObject.GObject):
gtkgui_helpers.move_window(win.window, pos[0], pos[1])
def _mode_to_key(self, contact, acct, type_, resource = None):
def _mode_to_key(self, contact, acct, type_, resource=None):
if self.mode == self.ONE_MSG_WINDOW_NEVER:
key = acct + contact.jid
if resource:
@ -1063,7 +1064,7 @@ class MessageWindowMgr(GObject.GObject):
if self.mode == self.ONE_MSG_WINDOW_PERTYPE:
return type_
def create_window(self, contact, acct, type_, resource = None):
def create_window(self, contact, acct, type_, resource=None):
win_acct = None
win_type = None
win_role = None # X11 window role

View File

@ -316,7 +316,7 @@ class GajimPluginConfigDialog(Gtk.Dialog):
self.on_run()
self.show_all()
self.connect('delete-event', self.on_close_dialog)
result = super(GajimPluginConfigDialog, self)
result = super(GajimPluginConfigDialog, self)
return result
def init(self):

View File

@ -117,11 +117,11 @@ class Singleton(type):
'''
def __init__(cls, name, bases, dic):
super(Singleton, cls).__init__(name, bases, dic)
cls.instance=None
cls.instance = None
def __call__(cls,*args,**kw):
def __call__(cls, *args, **kwargs):
if cls.instance is None:
cls.instance=super(Singleton, cls).__call__(*args,**kw)
cls.instance = super(Singleton, cls).__call__(*args, **kwargs)
#log.debug('%(classname)s - new instance created'%{
#'classname' : cls.__name__})
else:

View File

@ -302,7 +302,7 @@ class PluginManager(metaclass=Singleton):
'''
if ((gui_extpoint_name not in self.gui_extension_points)
or (args not in self.gui_extension_points[gui_extpoint_name])):
self.gui_extension_points.setdefault(gui_extpoint_name,[]).append(
self.gui_extension_points.setdefault(gui_extpoint_name, []).append(
args)
@log_calls('PluginManager')

View File

@ -552,8 +552,8 @@ class RosterWindow:
_contact, self.model), \
"%s already in roster.\n Family: %s" % (_jid, nearby_family)
self._add_entity(_contact, _account,
big_brother_contact = big_brother_contact,
big_brother_account = big_brother_account)
big_brother_contact=big_brother_contact,
big_brother_account=big_brother_account)
brothers.append((_contact, _account))
brothers.insert(0, (big_brother_contact, big_brother_account))
@ -1079,7 +1079,7 @@ class RosterWindow:
app.get_number_of_connected_accounts())) and app.config.get(
'show_contacts_number'):
nbr_on, nbr_total = app.contacts.get_nb_online_total_contacts(
accounts = accounts)
accounts=accounts)
account_name += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
self.model[child_iter][Column.NAME] = GLib.markup_escape_text(account_name)
@ -1139,7 +1139,7 @@ class RosterWindow:
text = '<span strikethrough="true">%s</span>' % text
if app.config.get('show_contacts_number'):
nbr_on, nbr_total = app.contacts.get_nb_online_total_contacts(
accounts = accounts, groups = [group])
accounts=accounts, groups=[group])
text += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
self.model[child_iter][Column.NAME] = text
@ -1254,7 +1254,7 @@ class RosterWindow:
status = contact.status.strip()
if status != '':
status = helpers.reduce_chars_newlines(status,
max_lines = 1)
max_lines=1)
# escape markup entities and make them small
# italic
@ -1304,12 +1304,12 @@ class RosterWindow:
if self.tree.row_expanded(path):
state_images = self.get_appropriate_state_images(
jid, size = 'opened',
icon_name = icon_name)
jid, size='opened',
icon_name=icon_name)
else:
state_images = self.get_appropriate_state_images(
jid, size = 'closed',
icon_name = icon_name)
jid, size='closed',
icon_name=icon_name)
# Expand/collapse icon might differ per iter
# (group)
@ -1322,7 +1322,7 @@ class RosterWindow:
else:
# A normal contact or little brother
state_images = self.get_appropriate_state_images(jid,
icon_name = icon_name)
icon_name=icon_name)
visible = self.contact_is_visible(contact, account)
# All iters have the same icon (no expand/collapse)
@ -2326,7 +2326,7 @@ class RosterWindow:
_('You are participating in one or more group chats'),
_('Changing your status to invisible will result in '
'disconnection from those group chats. Are you sure you want '
'to go invisible?'), on_response_ok = (change, account, status))
'to go invisible?'), on_response_ok=(change, account, status))
else:
change(account, status)
@ -2838,7 +2838,7 @@ class RosterWindow:
sectext = _('You will no longer be able to send and receive '
'messages to contacts from these transports: %s') % jids
ConfirmationDialog(pritext, sectext,
on_response_ok = (remove, list_), transient_for=self.window)
on_response_ok=(remove, list_), transient_for=self.window)
def _nec_blocking(self, obj):
for jid in obj.changed:
@ -3918,7 +3918,7 @@ class RosterWindow:
self._toggeling_row = True
model = widget.get_model()
child_model = model.get_model()
child_iter = model.convert_iter_to_child_iter(titer)
child_iter = model.convert_iter_to_child_iter(titer)
if self.regroup: # merged accounts
accounts = list(app.connections.keys())
@ -3954,7 +3954,7 @@ class RosterWindow:
if account + group + jid not in self.collapsed_rows:
self.collapsed_rows.append(account + group + jid)
family = app.contacts.get_metacontacts_family(account, jid)
nearby_family = \
nearby_family = \
self._get_nearby_family_and_big_brother(family, account)[0]
# Redraw all brothers to show pending events
for data in nearby_family:
@ -4285,7 +4285,7 @@ class RosterWindow:
dlg.checkbutton.set_active(True)
def on_drop_in_group(self, widget, account, c_source, grp_dest,
is_big_brother, context, etime, grp_source = None):
is_big_brother, context, etime, grp_source=None):
if is_big_brother:
# add whole metacontact to new group
self.add_contact_to_groups(c_source.jid, account, [grp_dest, ])
@ -4516,7 +4516,7 @@ class RosterWindow:
return
# we may not add contacts from special_groups
if grp_source in helpers.special_groups :
if grp_source in helpers.special_groups:
return
# Is the contact we drag a meta contact?
@ -5759,7 +5759,7 @@ class RosterWindow:
# (name, renderer_object, expand?, attribute_name, attribute_value,
# cell_data_func, func_arg)
self.renderers_list = []
self.renderers_propertys ={}
self.renderers_propertys = {}
self._pep_type_to_model_column = {'mood': Column.MOOD_PIXBUF,
'activity': Column.ACTIVITY_PIXBUF, 'tune': Column.TUNE_PIXBUF,
'geoloc': Column.LOCATION_PIXBUF}

View File

@ -49,7 +49,7 @@ class VcardWindow:
Class for contact's information window
"""
def __init__(self, contact, account, gc_contact = None):
def __init__(self, contact, account, gc_contact=None):
# the contact variable is the jid if vcard is true
self.xml = gtkgui_helpers.get_gtk_builder('vcard_information_window.ui')
self.window = self.xml.get_object('vcard_information_window')
@ -173,7 +173,7 @@ class VcardWindow:
menuitem.connect('activate',
gtkgui_helpers.on_avatar_save_as_menuitem_activate, sha, name)
menu.append(menuitem)
menu.connect('selection-done', lambda w:w.destroy())
menu.connect('selection-done', lambda w: w.destroy())
# show the menu
menu.show_all()
menu.attach_to_widget(widget, None)
@ -484,7 +484,7 @@ class VcardWindow:
class ZeroconfVcardWindow:
def __init__(self, contact, account, is_fake = False):
def __init__(self, contact, account, is_fake=False):
# the contact variable is the jid if vcard is true
self.xml = gtkgui_helpers.get_gtk_builder('zeroconf_information_window.ui')
self.window = self.xml.get_object('zeroconf_information_window')
@ -517,7 +517,7 @@ class ZeroconfVcardWindow:
gtkgui_helpers.on_avatar_save_as_menuitem_activate,
self.contact.avatar_sha, self.contact.get_shown_name())
menu.append(menuitem)
menu.connect('selection-done', lambda w:w.destroy())
menu.connect('selection-done', lambda w: w.destroy())
# show the menu
menu.show_all()
menu.attach_to_widget(widget, None)