diff --git a/src/atom_window.py b/src/atom_window.py
index 56449846f..4712dfc41 100644
--- a/src/atom_window.py
+++ b/src/atom_window.py
@@ -35,7 +35,9 @@ class AtomWindow:
@classmethod
def newAtomEntry(cls, entry):
- ''' Queue new entry, open window if there's no one opened. '''
+ """
+ Queue new entry, open window if there's no one opened
+ """
cls.entries.append(entry)
if cls.window is None:
@@ -48,7 +50,9 @@ class AtomWindow:
cls.window = None
def __init__(self):
- ''' Create new window... only if we have anything to show. '''
+ """
+ Create new window... only if we have anything to show
+ """
assert len(self.__class__.entries)>0
self.entry = None # the entry actually displayed
@@ -69,7 +73,9 @@ class AtomWindow:
self.feed_title_eventbox.add_events(gtk.gdk.BUTTON_PRESS_MASK)
def displayNextEntry(self):
- ''' Get next entry from the queue and display it in the window. '''
+ """
+ Get next entry from the queue and display it in the window
+ """
assert len(self.__class__.entries)>0
newentry = self.__class__.entries.pop(0)
@@ -103,8 +109,10 @@ class AtomWindow:
self.entry = newentry
def updateCounter(self):
- ''' We display number of events on the top of window, sometimes it needs to be
- changed...'''
+ """
+ Display number of events on the top of window, sometimes it needs to be
+ changed
+ """
count = len(self.__class__.entries)
if count>0:
self.new_entry_label.set_text(i18n.ngettext(
diff --git a/src/config.py b/src/config.py
index 727744a04..adf5078c5 100644
--- a/src/config.py
+++ b/src/config.py
@@ -63,17 +63,23 @@ from common.exceptions import GajimGeneralException
#---------- PreferencesWindow class -------------#
class PreferencesWindow:
- '''Class for Preferences window'''
+ """
+ Class for Preferences window
+ """
def on_preferences_window_destroy(self, widget):
- '''close window'''
+ """
+ Close window
+ """
del gajim.interface.instances['preferences']
def on_close_button_clicked(self, widget):
self.window.destroy()
def __init__(self):
- '''Initialize Preferences window'''
+ """
+ Initialize Preferences window
+ """
self.xml = gtkgui_helpers.get_glade('preferences_window.glade')
self.window = self.xml.get_widget('preferences_window')
self.window.set_transient_for(gajim.interface.roster.window)
@@ -495,8 +501,10 @@ class PreferencesWindow:
self.window.hide()
def get_per_account_option(self, opt):
- '''Return the value of the option opt if it's the same in all accounts
- else returns "mixed"'''
+ """
+ Return the value of the option opt if it's the same in all accounts else
+ returns "mixed"
+ """
if len(gajim.connections) == 0:
# a non existant key return default value
return gajim.config.get_per('accounts', '__default__', opt)
@@ -585,7 +593,9 @@ class PreferencesWindow:
self.toggle_emoticons()
def toggle_emoticons(self):
- '''Update emoticons state in Opened Chat Windows'''
+ """
+ Update emoticons state in Opened Chat Windows
+ """
for win in gajim.interface.msg_win_mgr.windows():
win.toggle_emoticons()
@@ -779,7 +789,9 @@ class PreferencesWindow:
self.sounds_preferences.window.present()
def update_text_tags(self):
- '''Update color tags in Opened Chat Windows'''
+ """
+ Update color tags in opened chat windows
+ """
for win in gajim.interface.msg_win_mgr.windows():
win.update_tags()
@@ -800,7 +812,9 @@ class PreferencesWindow:
gajim.interface.save_config()
def update_text_font(self):
- '''Update text font in Opened Chat Windows'''
+ """
+ Update text font in opened chat windows
+ """
for win in gajim.interface.msg_win_mgr.windows():
win.update_font()
@@ -879,7 +893,9 @@ class PreferencesWindow:
gajim.interface.save_config()
def _set_color(self, state, widget_name, option):
- ''' set color value in prefs and update the UI '''
+ """
+ Set color value in prefs and update the UI
+ """
if state:
color = self.xml.get_widget(widget_name).get_color()
color_string = gtkgui_helpers.make_color_string(color)
@@ -1346,7 +1362,10 @@ class ManageProxiesWindow:
#---------- AccountsWindow class -------------#
class AccountsWindow:
- '''Class for accounts window: list of accounts'''
+ """
+ Class for accounts window: list of accounts
+ """
+
def on_accounts_window_destroy(self, widget):
del gajim.interface.instances['accounts']
@@ -1414,7 +1433,9 @@ class AccountsWindow:
iter_ = model.iter_next(iter_)
def init_accounts(self):
- '''initialize listStore with existing accounts'''
+ """
+ Initialize listStore with existing accounts
+ """
self.remove_button.set_sensitive(False)
self.rename_button.set_sensitive(False)
self.current_account = None
@@ -1440,7 +1461,9 @@ class AccountsWindow:
elif self.need_relogin and self.current_account and \
gajim.connections[self.current_account].connected > 0:
def login(account, show_before, status_before):
- ''' login with previous status'''
+ """
+ Login with previous status
+ """
# first make sure connection is really closed,
# 0.5 may not be enough
gajim.connections[account].disconnect(True)
@@ -1473,7 +1496,9 @@ class AccountsWindow:
self.resend_presence = False
def on_accounts_treeview_cursor_changed(self, widget):
- '''Activate modify buttons when a row is selected, update accounts info'''
+ """
+ Activate modify buttons when a row is selected, update accounts info
+ """
sel = self.accounts_treeview.get_selection()
(model, iter_) = sel.get_selected()
if iter_:
@@ -1739,7 +1764,9 @@ class AccountsWindow:
gajim.config.get_per('accounts', account, 'use_ft_proxies'))
def on_add_button_clicked(self, widget):
- '''When add button is clicked: open an account information window'''
+ """
+ When add button is clicked: open an account information window
+ """
if 'account_creation_wizard' in gajim.interface.instances:
gajim.interface.instances['account_creation_wizard'].window.present()
else:
@@ -1747,8 +1774,10 @@ class AccountsWindow:
AccountCreationWizardWindow()
def on_remove_button_clicked(self, widget):
- '''When delete button is clicked:
- Remove an account from the listStore and from the config file'''
+ """
+ When delete button is clicked: Remove an account from the listStore and
+ from the config file
+ """
if not self.current_account:
return
account = self.current_account
@@ -2409,8 +2438,11 @@ class AccountsWindow:
'zeroconf_email', email)
class FakeDataForm(gtk.Table, object):
- '''Class for forms that are in XML format value1
- infos in a table {entry1: value1, }'''
+ """
+ Class for forms that are in XML format value1 infos in a
+ table {entry1: value1}
+ """
+
def __init__(self, infos):
gtk.Table.__init__(self)
self.infos = infos
@@ -2418,7 +2450,9 @@ class FakeDataForm(gtk.Table, object):
self._draw_table()
def _draw_table(self):
- '''Draw the table'''
+ """
+ Draw the table
+ """
nbrow = 0
if 'instructions' in self.infos:
nbrow = 1
@@ -2452,9 +2486,11 @@ class FakeDataForm(gtk.Table, object):
return self.infos
class ServiceRegistrationWindow:
- '''Class for Service registration window:
- Window that appears when we want to subscribe to a service
- if is_form we use dataforms_widget else we use service_registarion_window'''
+ """
+ Class for Service registration window. Window that appears when we want to
+ subscribe to a service if is_form we use dataforms_widget else we use
+ service_registarion_window
+ """
def __init__(self, service, infos, account, is_form):
self.service = service
self.account = account
@@ -2501,7 +2537,7 @@ class ServiceRegistrationWindow:
self.window.destroy()
class GroupchatConfigWindow:
- '''GroupchatConfigWindow class'''
+
def __init__(self, account, room_jid, form = None):
self.account = account
self.room_jid = room_jid
@@ -2654,7 +2690,9 @@ class GroupchatConfigWindow:
self.remove_button[affiliation].set_sensitive(True)
def affiliation_list_received(self, users_dict):
- '''Fill the affiliation treeview'''
+ """
+ Fill the affiliation treeview
+ """
for jid in users_dict:
affiliation = users_dict[jid]['affiliation']
if affiliation not in self.affiliation_labels.keys():
@@ -2703,8 +2741,10 @@ class GroupchatConfigWindow:
#---------- RemoveAccountWindow class -------------#
class RemoveAccountWindow:
- '''ask for removing from gajim only or from gajim and server too
- and do removing of the account given'''
+ """
+ Ask for removing from gajim only or from gajim and server too and do
+ removing of the account given
+ """
def on_remove_account_window_destroy(self, widget):
if self.account in gajim.interface.instances:
@@ -2904,7 +2944,9 @@ class ManageBookmarksWindow:
del gajim.interface.instances['manage_bookmarks']
def on_add_bookmark_button_clicked(self, widget):
- '''Add a new bookmark.'''
+ """
+ Add a new bookmark
+ """
# Get the account that is currently used
# (the parent of the currently selected item)
(model, iter_) = self.selection.get_selected()
@@ -2929,9 +2971,9 @@ class ManageBookmarksWindow:
self.view.set_cursor(model.get_path(iter_))
def on_remove_bookmark_button_clicked(self, widget):
- '''
- Remove selected bookmark.
- '''
+ """
+ Remove selected bookmark
+ """
(model, iter_) = self.selection.get_selected()
if not iter_: # Nothing selected
return
@@ -2944,9 +2986,9 @@ class ManageBookmarksWindow:
self.clear_fields()
def check_valid_bookmark(self):
- '''
- Check if all neccessary fields are entered correctly.
- '''
+ """
+ Check if all neccessary fields are entered correctly
+ """
(model, iter_) = self.selection.get_selected()
if not model.iter_parent(iter_):
@@ -2963,10 +3005,10 @@ class ManageBookmarksWindow:
return True
def on_ok_button_clicked(self, widget):
- '''
- Parse the treestore data into our new bookmarks array,
- then send the new bookmarks to the server.
- '''
+ """
+ Parse the treestore data into our new bookmarks array, then send the new
+ bookmarks to the server.
+ """
(model, iter_) = self.selection.get_selected()
if iter_ and model.iter_parent(iter_):
#bookmark selected, check it
@@ -2997,9 +3039,9 @@ class ManageBookmarksWindow:
self.window.destroy()
def bookmark_selected(self, selection):
- '''
+ """
Fill in the bookmark's data into the fields.
- '''
+ """
(model, iter_) = selection.get_selected()
if not iter_:
@@ -3444,8 +3486,10 @@ class AccountCreationWizardWindow:
return True # loop forever
def new_acc_connected(self, form, is_form, ssl_msg, ssl_err, ssl_cert,
- ssl_fingerprint):
- '''connection to server succeded, present the form to the user.'''
+ ssl_fingerprint):
+ """
+ Connection to server succeded, present the form to the user
+ """
if self.update_progressbar_timeout_id is not None:
gobject.source_remove(self.update_progressbar_timeout_id)
self.back_button.show()
@@ -3479,7 +3523,9 @@ class AccountCreationWizardWindow:
self.notebook.set_current_page(4) # show form page
def new_acc_not_connected(self, reason):
- '''Account creation failed: connection to server failed'''
+ """
+ Account creation failed: connection to server failed
+ """
if self.account not in gajim.connections:
return
if self.update_progressbar_timeout_id is not None:
@@ -3499,7 +3545,9 @@ class AccountCreationWizardWindow:
self.notebook.set_current_page(6) # show finish page
def acc_is_ok(self, config):
- '''Account creation succeeded'''
+ """
+ Account creation succeeded
+ """
self.create_vars(config)
self.show_finish_page()
@@ -3507,7 +3555,9 @@ class AccountCreationWizardWindow:
gobject.source_remove(self.update_progressbar_timeout_id)
def acc_is_not_ok(self, reason):
- '''Account creation failed'''
+ """
+ Account creation failed
+ """
self.back_button.show()
self.cancel_button.show()
self.go_online_checkbutton.hide()
diff --git a/src/conversation_textview.py b/src/conversation_textview.py
index fa5dcd25e..7744ef685 100644
--- a/src/conversation_textview.py
+++ b/src/conversation_textview.py
@@ -158,8 +158,10 @@ class TextViewImage(gtk.Image):
class ConversationTextview(gobject.GObject):
- '''Class for the conversation textview (where user reads already said
- messages) for chat/groupchat windows'''
+ """
+ Class for the conversation textview (where user reads already said messages)
+ for chat/groupchat windows
+ """
__gsignals__ = dict(
quote = (gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION,
None, # return value
@@ -177,8 +179,10 @@ class ConversationTextview(gobject.GObject):
SCROLL_DELAY = 33 # milliseconds
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'''
+ """
+ If used_in_history_window is True, then we do not show Clear menuitem in
+ context menu
+ """
gobject.GObject.__init__(self)
self.used_in_history_window = used_in_history_window
@@ -642,8 +646,9 @@ class ConversationTextview(gobject.GObject):
return False
def on_textview_motion_notify_event(self, widget, event):
- '''change the cursor to a hand when we are over a mail or an
- url'''
+ """
+ Change the cursor to a hand when we are over a mail or an url
+ """
pointer_x, pointer_y = self.tv.window.get_pointer()[0:2]
x, y = self.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
pointer_x, pointer_y)
@@ -688,7 +693,9 @@ class ConversationTextview(gobject.GObject):
self.change_cursor = True
def clear(self, tv = None):
- '''clear text in the textview'''
+ """
+ Clear text in the textview
+ """
buffer_ = self.tv.get_buffer()
start, end = buffer_.get_bounds()
buffer_.delete(start, end)
@@ -698,15 +705,18 @@ class ConversationTextview(gobject.GObject):
self.focus_out_end_mark = None
def visit_url_from_menuitem(self, widget, link):
- '''basically it filters out the widget instance'''
+ """
+ Basically it filters out the widget instance
+ """
helpers.launch_browser_mailer('url', link)
def on_textview_populate_popup(self, textview, menu):
- '''we override the default context menu and we prepend Clear
- (only if used_in_history_window is False)
- and if we have sth selected we show a submenu with actions on
- the phrase (see on_conversation_textview_button_press_event)'''
-
+ """
+ Override the default context menu and we prepend Clear (only if
+ used_in_history_window is False) and if we have sth selected we show a
+ submenu with actions on the phrase (see
+ on_conversation_textview_button_press_event)
+ """
separator_menuitem_was_added = False
if not self.used_in_history_window:
item = gtk.SeparatorMenuItem()
@@ -971,13 +981,13 @@ class ConversationTextview(gobject.GObject):
def detect_and_print_special_text(self, otext, other_tags, graphics=True):
- '''detects special text (emots & links & formatting)
- prints normal text before any special text it founts,
- then print special text (that happens many times until
- last special text is printed) and then returns the index
+ """
+ Detect special text (emots & links & formatting), print normal text
+ before any special text it founds, then print special text (that happens
+ many times until last special text is printed) and then return the index
after *last* special text, so we can print it in
- print_conversation_line()'''
-
+ print_conversation_line()
+ """
buffer_ = self.tv.get_buffer()
insert_tags_func = buffer_.insert_with_tags_by_name
@@ -1023,8 +1033,10 @@ class ConversationTextview(gobject.GObject):
return buffer_.get_end_iter()
def print_special_text(self, special_text, other_tags, graphics=True):
- '''is called by detect_and_print_special_text and prints
- special text (emots, links, formatting)'''
+ """
+ Is called by detect_and_print_special_text and prints special text
+ (emots, links, formatting)
+ """
tags = []
use_other_tags = True
text_is_valid_uri = False
@@ -1163,9 +1175,12 @@ class ConversationTextview(gobject.GObject):
buffer_.insert_with_tags_by_name(end_iter, '\n', 'eol')
def print_conversation_line(self, text, jid, kind, name, tim,
- other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
- subject=None, old_kind=None, xhtml=None, simple=False, graphics=True):
- '''prints 'chat' type messages'''
+ other_tags_for_name=[], other_tags_for_time=[],
+ other_tags_for_text=[], subject=None, old_kind=None, xhtml=None,
+ simple=False, graphics=True):
+ """
+ Print 'chat' type messages
+ """
buffer_ = self.tv.get_buffer()
buffer_.begin_user_action()
if self.marks_queue.full():
@@ -1263,8 +1278,10 @@ class ConversationTextview(gobject.GObject):
buffer_.end_user_action()
def get_time_to_show(self, tim):
- '''Get the time, with the day before if needed and return it.
- It DOESN'T format a fuzzy time'''
+ """
+ Get the time, with the day before if needed and return it. It DOESN'T
+ format a fuzzy time
+ """
format = ''
# get difference in days since epoch (86400 = 24*3600)
# number of days since epoch for current time (in GMT) -
@@ -1317,8 +1334,10 @@ class ConversationTextview(gobject.GObject):
self.print_empty_line()
def print_real_text(self, text, text_tags=[], name=None, xhtml=None,
- graphics=True):
- '''this adds normal and special text. call this to add text'''
+ graphics=True):
+ """
+ Add normal and special text. call this to add text
+ """
if xhtml:
try:
if name and (text.startswith('/me ') or text.startswith('/me\n')):
diff --git a/src/dataforms_widget.py b/src/dataforms_widget.py
index 18195dccd..4a9681dab 100644
--- a/src/dataforms_widget.py
+++ b/src/dataforms_widget.py
@@ -38,7 +38,10 @@ import itertools
class DataFormWidget(gtk.Alignment, object):
# "public" interface
- ''' Data Form widget. Use like any other widget. '''
+ """
+ Data Form widget. Use like any other widget
+ """
+
def __init__(self, dataformnode=None):
''' Create a widget. '''
gtk.Alignment.__init__(self, xscale=1.0, yscale=1.0)
@@ -65,7 +68,9 @@ class DataFormWidget(gtk.Alignment, object):
selection.set_mode(gtk.SELECTION_MULTIPLE)
def set_data_form(self, dataform):
- ''' Set the data form (xmpp.DataForm) displayed in widget. '''
+ """
+ Set the data form (xmpp.DataForm) displayed in widget
+ """
assert isinstance(dataform, dataforms.DataForm)
self.del_data_form()
@@ -84,7 +89,9 @@ class DataFormWidget(gtk.Alignment, object):
gtkgui_helpers.label_set_autowrap(self.instructions_label)
def get_data_form(self):
- ''' Data form displayed in the widget or None if no form. '''
+ """
+ Data form displayed in the widget or None if no form
+ """
return self._data_form
def del_data_form(self):
@@ -95,8 +102,10 @@ class DataFormWidget(gtk.Alignment, object):
'Data form presented in a widget')
def get_title(self):
- ''' Get the title of data form, as a unicode object. If no
- title or no form, returns u''. Useful for setting window title. '''
+ """
+ Get the title of data form, as a unicode object. If no title or no form,
+ returns u''. Useful for setting window title
+ """
if self._data_form is not None:
if self._data_form.title is not None:
return self._data_form.title
@@ -117,9 +126,11 @@ class DataFormWidget(gtk.Alignment, object):
pass
def clean_data_form(self):
- '''Remove data about existing form. This metod is empty, because
- it is rewritten by build_*_data_form, according to type of form
- which is actually displayed.'''
+ """
+ Remove data about existing form. This metod is empty, because it is
+ rewritten by build_*_data_form, according to type of form which is
+ actually displayed
+ """
pass
def build_single_data_form(self):
@@ -138,14 +149,18 @@ class DataFormWidget(gtk.Alignment, object):
self.clean_data_form = self.clean_single_data_form
def clean_single_data_form(self):
- '''(Called as clean_data_form, read the docs of clean_data_form()).
- Remove form from widget.'''
+ """
+ Called as clean_data_form, read the docs of clean_data_form(). Remove
+ form from widget
+ """
self.singleform.destroy()
self.clean_data_form = self.empty_method # we won't call it twice
del self.singleform
def build_multiple_data_form(self):
- '''Invoked when new multiple form is to be created.'''
+ """
+ Invoked when new multiple form is to be created
+ """
assert isinstance(self._data_form, dataforms.MultipleDataForm)
self.clean_data_form()
@@ -196,13 +211,17 @@ class DataFormWidget(gtk.Alignment, object):
self.refresh_multiple_buttons()
def clean_multiple_data_form(self):
- '''(Called as clean_data_form, read the docs of clean_data_form()).
- Remove form from widget.'''
+ """
+ Called as clean_data_form, read the docs of clean_data_form(). Remove
+ form from widget
+ """
self.clean_data_form = self.empty_method # we won't call it twice
del self.multiplemodel
def refresh_multiple_buttons(self):
- ''' Checks for treeview state and makes control buttons sensitive.'''
+ """
+ Checks for treeview state and makes control buttons sensitive
+ """
selection = self.records_treeview.get_selection()
model = self.records_treeview.get_model()
count = selection.count_selected_rows()
@@ -273,9 +292,12 @@ class DataFormWidget(gtk.Alignment, object):
self.refresh_multiple_buttons()
class SingleForm(gtk.Table, object):
- ''' Widget that represent DATAFORM_SINGLE mode form. Because this is used
- not only to display single forms, but to form input windows of multiple-type
- forms, it is in another class.'''
+ """
+ Widget that represent DATAFORM_SINGLE mode form. Because this is used not
+ only to display single forms, but to form input windows of multiple-type
+ forms, it is in another class
+ """
+
def __init__(self, dataform):
assert isinstance(dataform, dataforms.SimpleDataForm)
@@ -284,9 +306,11 @@ class SingleForm(gtk.Table, object):
self.set_row_spacings(6)
def decorate_with_tooltip(widget, field):
- ''' Adds a tooltip containing field's description to a widget.
- Creates EventBox if widget doesn't have its own gdk window.
- Returns decorated widget. '''
+ """
+ Adds a tooltip containing field's description to a widget. Creates
+ EventBox if widget doesn't have its own gdk window. Returns decorated
+ widget
+ """
if field.description != '':
if widget.flags() & gtk.NO_WINDOW:
evbox = gtk.EventBox()
diff --git a/src/dialogs.py b/src/dialogs.py
index 4f2802e75..2ca3bbcc2 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -61,9 +61,14 @@ from common import dataforms
from common.exceptions import GajimGeneralException
class EditGroupsDialog:
- '''Class for the edit group dialog window'''
+ """
+ Class for the edit group dialog window
+ """
+
def __init__(self, list_):
- '''list_ is a list of (contact, account) tuples'''
+ """
+ list_ is a list of (contact, account) tuples
+ """
self.xml = gtkgui_helpers.get_glade('edit_groups_dialog.glade')
self.dialog = self.xml.get_widget('edit_groups_dialog')
self.dialog.set_transient_for(gajim.interface.roster.window)
@@ -96,7 +101,9 @@ class EditGroupsDialog:
self.dialog.destroy()
def remove_group(self, group):
- '''remove group group from all contacts and all their brothers'''
+ """
+ Remove group group from all contacts and all their brothers
+ """
for (contact, account) in self.list_:
gajim.interface.roster.remove_contact_from_groups(contact.jid, account, [group])
@@ -104,7 +111,9 @@ class EditGroupsDialog:
gajim.interface.roster.draw_group(_('General'), account)
def add_group(self, group):
- '''add group group to all contacts and all their brothers'''
+ """
+ Add group group to all contacts and all their brothers
+ """
for (contact, account) in self.list_:
gajim.interface.roster.add_contact_to_groups(contact.jid, account, [group])
@@ -199,7 +208,9 @@ class EditGroupsDialog:
column.set_attributes(renderer, active=1, inconsistent=2)
class PassphraseDialog:
- '''Class for Passphrase dialog'''
+ """
+ Class for Passphrase dialog
+ """
def __init__(self, titletext, labeltext, checkbuttontext=None,
ok_handler=None, cancel_handler=None):
self.xml = gtkgui_helpers.get_glade('passphrase_dialog.glade')
@@ -258,7 +269,10 @@ class PassphraseDialog:
self.cancel_handler()
class ChooseGPGKeyDialog:
- '''Class for GPG key dialog'''
+ """
+ Class for GPG key dialog
+ """
+
def __init__(self, title_text, prompt_text, secret_keys, on_response,
selected=None):
'''secret_keys : {keyID: userName, ...}'''
@@ -428,9 +442,9 @@ class ChangeActivityDialog:
self.subactivity = data[1]
def on_ok_button_clicked(self, widget):
- '''
+ """
Return activity and messsage (None if no activity selected)
- '''
+ """
if self.checkbutton.get_active():
self.on_response(self.activity, self.subactivity,
self.entry.get_text().decode('utf-8'))
@@ -524,10 +538,10 @@ class ChangeMoodDialog:
self.window.destroy()
class TimeoutDialog:
- '''
+ """
Class designed to be derivated to create timeout'd dialogs (dialogs that
closes automatically after a timeout)
- '''
+ """
def __init__(self, timeout, on_timeout):
self.countdown_left = timeout
self.countdown_enabled = True
@@ -540,7 +554,9 @@ class TimeoutDialog:
gobject.timeout_add_seconds(1, self.countdown)
def on_timeout():
- '''To be implemented in derivated classes'''
+ """
+ To be implemented in derivated classes
+ """
pass
def countdown(self):
@@ -638,7 +654,9 @@ class ChangeStatusMessageDialog(TimeoutDialog):
self.dialog.show_all()
def draw_activity(self):
- '''Set activity button'''
+ """
+ Set activity button
+ """
img = self.xml.get_widget('activity_image')
label = self.xml.get_widget('activity_button_label')
if 'activity' in self.pep_dict and self.pep_dict['activity'] in \
@@ -661,7 +679,9 @@ class ChangeStatusMessageDialog(TimeoutDialog):
label.set_text('')
def draw_mood(self):
- '''Set mood button'''
+ """
+ Set mood button
+ """
img = self.xml.get_widget('mood_image')
label = self.xml.get_widget('mood_button_label')
if self.pep_dict['mood'] in pep.MOODS:
@@ -803,13 +823,17 @@ class ChangeStatusMessageDialog(TimeoutDialog):
self.pep_dict['mood_text'])
class AddNewContactWindow:
- '''Class for AddNewContactWindow'''
+ """
+ Class for AddNewContactWindow
+ """
+
uid_labels = {'jabber': _('Jabber ID:'),
'aim': _('AIM Address:'),
'gadu-gadu': _('GG Number:'),
'icq': _('ICQ Number:'),
'msn': _('MSN Address:'),
'yahoo': _('Yahoo! Address:')}
+
def __init__(self, account=None, jid=None, user_nick=None, group=None):
self.account = account
if account is None:
@@ -983,11 +1007,15 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
self.window.destroy()
def on_cancel_button_clicked(self, widget):
- '''When Cancel button is clicked'''
+ """
+ When Cancel button is clicked
+ """
self.window.destroy()
def on_add_button_clicked(self, widget):
- '''When Subscribe button is clicked'''
+ """
+ When Subscribe button is clicked
+ """
jid = self.uid_entry.get_text().decode('utf-8').strip()
if not jid:
return
@@ -1111,7 +1139,10 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
self.add_button.set_sensitive(False)
class AboutDialog:
- '''Class for about dialog'''
+ """
+ Class for about dialog
+ """
+
def __init__(self):
dlg = gtk.AboutDialog()
dlg.set_transient_for(gajim.interface.roster.window)
@@ -1184,7 +1215,9 @@ class AboutDialog:
return str_[0:-1] # remove latest .
def get_path(self, filename):
- '''where can we find this Credits file ?'''
+ """
+ Where can we find this Credits file?
+ """
if os.path.isfile(os.path.join(gajim.defs.docdir, filename)):
return os.path.join(gajim.defs.docdir, filename)
elif os.path.isfile('../' + filename):
@@ -1273,14 +1306,18 @@ class HigDialog(gtk.MessageDialog):
self.destroy()
def popup(self):
- '''show dialog'''
+ """
+ Show dialog
+ """
vb = self.get_children()[0].get_children()[0] # Give focus to top vbox
vb.set_flags(gtk.CAN_FOCUS)
vb.grab_focus()
self.show_all()
class FileChooserDialog(gtk.FileChooserDialog):
- '''Non-blocking FileChooser Dialog around gtk.FileChooserDialog'''
+ """
+ Non-blocking FileChooser Dialog around gtk.FileChooserDialog
+ """
def __init__(self, title_text, action, buttons, default_response,
select_multiple = False, current_folder = None, on_response_ok = None,
on_response_cancel = None):
@@ -1332,7 +1369,10 @@ class AspellDictError:
gajim.config.set('use_speller', False)
class ConfirmationDialog(HigDialog):
- '''HIG compliant confirmation dialog.'''
+ """
+ HIG compliant confirmation dialog
+ """
+
def __init__(self, pritext, sectext='', on_response_ok=None,
on_response_cancel=None):
self.user_response_ok = on_response_ok
@@ -1359,7 +1399,10 @@ class ConfirmationDialog(HigDialog):
self.destroy()
class NonModalConfirmationDialog(HigDialog):
- '''HIG compliant non modal confirmation dialog.'''
+ """
+ HIG compliant non modal confirmation dialog
+ """
+
def __init__(self, pritext, sectext='', on_response_ok=None,
on_response_cancel=None):
self.user_response_ok = on_response_ok
@@ -1386,8 +1429,11 @@ class NonModalConfirmationDialog(HigDialog):
self.destroy()
class WarningDialog(HigDialog):
+ """
+ HIG compliant warning dialog
+ """
+
def __init__(self, pritext, sectext=''):
- '''HIG compliant warning dialog.'''
HigDialog.__init__( self, None,
gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, pritext, sectext)
self.set_modal(False)
@@ -1396,8 +1442,11 @@ class WarningDialog(HigDialog):
self.popup()
class InformationDialog(HigDialog):
+ """
+ HIG compliant info dialog
+ """
+
def __init__(self, pritext, sectext=''):
- '''HIG compliant info dialog.'''
HigDialog.__init__(self, None,
gtk.MESSAGE_INFO, gtk.BUTTONS_OK, pritext, sectext)
self.set_modal(False)
@@ -1405,16 +1454,22 @@ class InformationDialog(HigDialog):
self.popup()
class ErrorDialog(HigDialog):
+ """
+ HIG compliant error dialog
+ """
+
def __init__(self, pritext, sectext=''):
- '''HIG compliant error dialog.'''
HigDialog.__init__( self, None,
gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, pritext, sectext)
self.popup()
class YesNoDialog(HigDialog):
+ """
+ HIG compliant YesNo dialog
+ """
+
def __init__(self, pritext, sectext='', checktext='', on_response_yes=None,
- on_response_no=None):
- '''HIG compliant YesNo dialog.'''
+ on_response_no=None):
self.user_response_yes = on_response_yes
self.user_response_no = on_response_no
HigDialog.__init__( self, None,
@@ -1448,15 +1503,20 @@ class YesNoDialog(HigDialog):
self.destroy()
def is_checked(self):
- ''' Get active state of the checkbutton '''
+ """
+ Get active state of the checkbutton
+ """
if not self.checkbutton:
return False
return self.checkbutton.get_active()
class ConfirmationDialogCheck(ConfirmationDialog):
- '''HIG compliant confirmation dialog with checkbutton.'''
- def __init__(self, pritext, sectext='', checktext='',
- on_response_ok=None, on_response_cancel=None, is_modal=True):
+ """
+ HIG compliant confirmation dialog with checkbutton
+ """
+
+ def __init__(self, pritext, sectext='', checktext='', on_response_ok=None,
+ on_response_cancel=None, is_modal=True):
self.user_response_ok = on_response_ok
self.user_response_cancel = on_response_cancel
@@ -1495,11 +1555,16 @@ class ConfirmationDialogCheck(ConfirmationDialog):
self.destroy()
def is_checked(self):
- ''' Get active state of the checkbutton '''
+ """
+ Get active state of the checkbutton
+ """
return self.checkbutton.get_active()
class ConfirmationDialogDubbleCheck(ConfirmationDialog):
- '''HIG compliant confirmation dialog with 2 checkbuttons.'''
+ """
+ HIG compliant confirmation dialog with 2 checkbuttons
+ """
+
def __init__(self, pritext, sectext='', checktext1='', checktext2='',
on_response_ok=None, on_response_cancel=None, is_modal=True):
self.user_response_ok = on_response_ok
@@ -1560,7 +1625,10 @@ class ConfirmationDialogDubbleCheck(ConfirmationDialog):
return [is_checked_1, is_checked_2]
class FTOverwriteConfirmationDialog(ConfirmationDialog):
- '''HIG compliant confirmation dialog to overwrite or resume a file transfert'''
+ """
+ HIG compliant confirmation dialog to overwrite or resume a file transfert
+ """
+
def __init__(self, pritext, sectext='', propose_resume=True,
on_response=None):
HigDialog.__init__(self, None, gtk.MESSAGE_QUESTION, gtk.BUTTONS_CANCEL,
@@ -1597,7 +1665,10 @@ class FTOverwriteConfirmationDialog(ConfirmationDialog):
self.destroy()
class CommonInputDialog:
- '''Common Class for Input dialogs'''
+ """
+ Common Class for Input dialogs
+ """
+
def __init__(self, title, label_str, is_modal, ok_handler, cancel_handler):
self.dialog = self.xml.get_widget('input_dialog')
label = self.xml.get_widget('label')
@@ -1633,9 +1704,12 @@ class CommonInputDialog:
self.dialog.destroy()
class InputDialog(CommonInputDialog):
- '''Class for Input dialog'''
+ """
+ Class for Input dialog
+ """
+
def __init__(self, title, label_str, input_str=None, is_modal=True,
- ok_handler=None, cancel_handler=None):
+ ok_handler=None, cancel_handler=None):
self.xml = gtkgui_helpers.get_glade('input_dialog.glade')
CommonInputDialog.__init__(self, title, label_str, is_modal, ok_handler,
cancel_handler)
@@ -1651,9 +1725,12 @@ class InputDialog(CommonInputDialog):
return self.input_entry.get_text().decode('utf-8')
class InputDialogCheck(InputDialog):
- '''Class for Input dialog'''
+ """
+ Class for Input dialog
+ """
+
def __init__(self, title, label_str, checktext='', input_str=None,
- is_modal=True, ok_handler=None, cancel_handler=None):
+ is_modal=True, ok_handler=None, cancel_handler=None):
self.xml = gtkgui_helpers.get_glade('input_dialog.glade')
InputDialog.__init__(self, title, label_str, input_str=input_str,
is_modal=is_modal, ok_handler=ok_handler,
@@ -1683,7 +1760,9 @@ class InputDialogCheck(InputDialog):
return self.input_entry.get_text().decode('utf-8')
def is_checked(self):
- ''' Get active state of the checkbutton '''
+ """
+ Get active state of the checkbutton
+ """
try:
return self.checkbutton.get_active()
except Exception:
@@ -1691,7 +1770,10 @@ class InputDialogCheck(InputDialog):
return False
class ChangeNickDialog(InputDialogCheck):
- '''Class for changing room nickname in case of conflict'''
+ """
+ Class for changing room nickname in case of conflict
+ """
+
def __init__(self, account, room_jid, title, prompt, check_text=None):
InputDialogCheck.__init__(self, title, '', checktext=check_text,
input_str='', is_modal=True, ok_handler=None, cancel_handler=None)
@@ -1773,7 +1855,10 @@ class ChangeNickDialog(InputDialogCheck):
self.room_queue.append((account, room_jid, prompt))
class InputTextDialog(CommonInputDialog):
- '''Class for multilines Input dialog (more place than InputDialog)'''
+ """
+ Class for multilines Input dialog (more place than InputDialog)
+ """
+
def __init__(self, title, label_str, input_str=None, is_modal=True,
ok_handler=None, cancel_handler=None):
self.xml = gtkgui_helpers.get_glade('input_text_dialog.glade')
@@ -1790,7 +1875,10 @@ class InputTextDialog(CommonInputDialog):
return self.input_buffer.get_text(start_iter, end_iter).decode('utf-8')
class DubbleInputDialog:
- '''Class for Dubble Input dialog'''
+ """
+ Class for Dubble Input dialog
+ """
+
def __init__(self, title, label_str1, label_str2, input_str1=None,
input_str2=None, is_modal=True, ok_handler=None, cancel_handler=None):
self.xml = gtkgui_helpers.get_glade('dubbleinput_dialog.glade')
@@ -1876,7 +1964,9 @@ class SubscriptionRequestWindow:
self.window.destroy()
def on_authorize_button_clicked(self, widget):
- '''accept the request'''
+ """
+ Accept the request
+ """
gajim.connections[self.account].send_authorization(self.jid)
self.window.destroy()
contact = gajim.contacts.get_contact(self.account, self.jid)
@@ -1884,7 +1974,9 @@ class SubscriptionRequestWindow:
AddNewContactWindow(self.account, self.jid, self.user_nick)
def on_contact_info_activate(self, widget):
- '''ask vcard'''
+ """
+ Ask vcard
+ """
if self.jid in gajim.interface.instances[self.account]['infos']:
gajim.interface.instances[self.account]['infos'][self.jid].window.present()
else:
@@ -1896,11 +1988,15 @@ class SubscriptionRequestWindow:
get_widget('information_notebook').remove_page(0)
def on_start_chat_activate(self, widget):
- '''open chat'''
+ """
+ Open chat
+ """
gajim.interface.new_chat_from_jid(self.account, self.jid)
def on_deny_button_clicked(self, widget):
- '''refuse the request'''
+ """
+ Refuse the request
+ """
gajim.connections[self.account].refuse_authorization(self.jid)
contact = gajim.contacts.get_contact(self.account, self.jid)
if contact and _('Not in Roster') in contact.get_shown_groups():
@@ -1908,7 +2004,9 @@ class SubscriptionRequestWindow:
self.window.destroy()
def on_actions_button_clicked(self, widget):
- '''popup action menu'''
+ """
+ Popup action menu
+ """
menu = self.prepare_popup_menu()
menu.show_all()
gtkgui_helpers.popup_emoticons_under_button(menu, widget, self.window.window)
@@ -1916,11 +2014,12 @@ class SubscriptionRequestWindow:
class JoinGroupchatWindow:
def __init__(self, account=None, room_jid='', nick='', password='',
- automatic=False):
- '''automatic is a dict like {'invities': []}
- If automatic is not empty, this means room must be automaticaly configured
- and when done, invities must be automatically invited'''
-
+ automatic=False):
+ """
+ Automatic is a dict like {'invities': []}. If automatic is not empty,
+ this means room must be automaticaly configured and when done, invities
+ must be automatically invited
+ """
if account:
if room_jid != '' and room_jid in gajim.gc_connected[account] and\
gajim.gc_connected[account][room_jid]:
@@ -2007,7 +2106,9 @@ class JoinGroupchatWindow:
self.window.show_all()
def on_join_groupchat_window_destroy(self, widget):
- '''close window'''
+ """
+ Close window
+ """
if self.account and 'join_gc' in gajim.interface.instances[self.account]:
# remove us from open windows
del gajim.interface.instances[self.account]['join_gc']
@@ -2039,7 +2140,9 @@ class JoinGroupchatWindow:
self._room_jid_entry.set_text(room_jid)
def on_cancel_button_clicked(self, widget):
- '''When Cancel button is clicked'''
+ """
+ When Cancel button is clicked
+ """
self.window.destroy()
def on_bookmark_checkbutton_toggled(self, widget):
@@ -2050,7 +2153,9 @@ class JoinGroupchatWindow:
auto_join_checkbutton.set_sensitive(False)
def on_join_button_clicked(self, widget):
- '''When Join button is clicked'''
+ """
+ When Join button is clicked
+ """
if not self.account:
ErrorDialog(_('Invalid Account'),
_('You have to choose an account from which you want to join the '
@@ -2138,7 +2243,9 @@ class SynchroniseSelectAccountDialog:
self.window.destroy()
def init_accounts(self):
- '''initialize listStore with existing accounts'''
+ """
+ Initialize listStore with existing accounts
+ """
model = self.accounts_treeview.get_model()
model.clear()
for remote_account in gajim.connections:
@@ -2204,7 +2311,9 @@ class SynchroniseSelectContactsDialog:
self.window.destroy()
def init_contacts(self):
- '''initialize listStore with existing accounts'''
+ """
+ Initialize listStore with existing accounts
+ """
model = self.contacts_treeview.get_model()
model.clear()
@@ -2267,7 +2376,9 @@ class NewChatDialog(InputDialog):
self.dialog.show_all()
def new_chat_response(self, jid):
- ''' called when ok button is clicked '''
+ """
+ Called when ok button is clicked
+ """
if gajim.connections[self.account].connected <= 1:
#if offline or connecting
ErrorDialog(_('Connection not available'),
@@ -2433,10 +2544,10 @@ class PopupNotificationWindow:
self.adjust_height_and_move_popup_notification_windows()
class SingleMessageWindow:
- '''SingleMessageWindow can send or show a received
- singled message depending on action argument which can be 'send'
- or 'receive'.
- '''
+ """
+ SingleMessageWindow can send or show a received singled message depending on
+ action argument which can be 'send' or 'receive'
+ """
# Keep a reference on windows so garbage collector don't restroy them
instances = []
def __init__(self, account, to='', action='', from_whom='', subject='',
@@ -2847,9 +2958,12 @@ class XMLConsoleWindow:
TRANSLATED_ACTION = {'add': _('add'), 'modify': _('modify'),
'remove': _('remove')}
class RosterItemExchangeWindow:
- ''' Windows used when someone send you a exchange contact suggestion '''
+ """
+ Windows used when someone send you a exchange contact suggestion
+ """
+
def __init__(self, account, action, exchange_list, jid_from,
- message_body=None):
+ message_body=None):
self.account = account
self.action = action
self.exchange_list = exchange_list
@@ -3067,8 +3181,10 @@ class RosterItemExchangeWindow:
class PrivacyListWindow:
- '''Window that is used for creating NEW or EDITING already there privacy
- lists'''
+ """
+ Window that is used for creating NEW or EDITING already there privacy lists
+ """
+
def __init__(self, account, privacy_list_name, action):
'''action is 'EDIT' or 'NEW' depending on if we create a new priv list
or edit an already existing one'''
@@ -3406,9 +3522,10 @@ class PrivacyListWindow:
self.window.destroy()
class PrivacyListsWindow:
- '''Window that is the main window for Privacy Lists;
- we can list there the privacy lists and ask to create a new one
- or edit an already there one'''
+ """
+ Window that is the main window for Privacy Lists; we can list there the
+ privacy lists and ask to create a new one or edit an already there one
+ """
def __init__(self, account):
self.account = account
self.privacy_lists_save = []
@@ -3565,9 +3682,10 @@ class InvitationReceivedDialog:
class ProgressDialog:
def __init__(self, title_text, during_text, messages_queue):
- '''during text is what to show during the procedure,
- messages_queue has the message to show
- in the textview'''
+ """
+ During text is what to show during the procedure, messages_queue has the
+ message to show in the textview
+ """
self.xml = gtkgui_helpers.get_glade('progress_dialog.glade')
self.dialog = self.xml.get_widget('progress_dialog')
self.label = self.xml.get_widget('label')
@@ -3594,10 +3712,14 @@ class ProgressDialog:
class SoundChooserDialog(FileChooserDialog):
def __init__(self, path_to_snd_file='', on_response_ok=None,
- on_response_cancel=None):
- '''optionally accepts path_to_snd_file so it has that as selected'''
+ on_response_cancel=None):
+ """
+ Optionally accepts path_to_snd_file so it has that as selected
+ """
def on_ok(widget, callback):
- '''check if file exists and call callback'''
+ """
+ Check if file exists and call callback
+ """
path_to_snd_file = self.get_filename()
path_to_snd_file = gtkgui_helpers.decode_filechooser_file_paths(
(path_to_snd_file,))[0]
@@ -3633,8 +3755,10 @@ class SoundChooserDialog(FileChooserDialog):
class ImageChooserDialog(FileChooserDialog):
def __init__(self, path_to_file='', on_response_ok=None,
- on_response_cancel=None):
- '''optionally accepts path_to_snd_file so it has that as selected'''
+ on_response_cancel=None):
+ """
+ Optionally accepts path_to_snd_file so it has that as selected
+ """
def on_ok(widget, callback):
'''check if file exists and call callback'''
path_to_file = self.get_filename()
@@ -3725,8 +3849,10 @@ class AvatarChooserDialog(ImageChooserDialog):
class AddSpecialNotificationDialog:
def __init__(self, jid):
- '''jid is the jid for which we want to add special notification
- (sound and notification popups)'''
+ """
+ jid is the jid for which we want to add special notification (sound and
+ notification popups)
+ """
self.xml = gtkgui_helpers.get_glade('add_special_notification_window.glade')
self.window = self.xml.get_widget('add_special_notification_window')
self.condition_combobox = self.xml.get_widget('condition_combobox')
@@ -3846,7 +3972,9 @@ class AdvancedNotificationsWindow:
self.window.show_all()
def initiate_rule_state(self):
- '''Set values for all widgets'''
+ """
+ Set values for all widgets
+ """
if self.active_num < 0:
return
# event
@@ -4237,8 +4365,10 @@ class TransformChatToMUC:
# Keep a reference on windows so garbage collector don't restroy them
instances = []
def __init__(self, account, jids, preselected=None):
- '''This window is used to trasform a one-to-one chat to a MUC.
- We do 2 things: first select the server and then make a guests list.'''
+ """
+ This window is used to trasform a one-to-one chat to a MUC. We do 2
+ things: first select the server and then make a guests list
+ """
self.instances.append(self)
self.account = account
@@ -4389,7 +4519,9 @@ class DataFormWindow(Dialog):
self.destroy()
class ESessionInfoWindow:
- '''Class for displaying information about a XEP-0116 encrypted session'''
+ """
+ Class for displaying information about a XEP-0116 encrypted session
+ """
def __init__(self, session):
self.session = session
@@ -4468,7 +4600,9 @@ class ESessionInfoWindow:
YesNoDialog(pritext, sectext, on_response_yes=on_yes, on_response_no=on_no)
class GPGInfoWindow:
- '''Class for displaying information about a XEP-0116 encrypted session'''
+ """
+ Class for displaying information about a XEP-0116 encrypted session
+ """
def __init__(self, control):
xml = gtkgui_helpers.get_glade('esession_info_window.glade')
security_image = xml.get_widget('security_image')