changeset 078ae96fbbf7 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=078ae96fbbf7 description: One more portion of doc-strings refactoring
diffstat:
src/atom_window.py | 18 +- src/config.py | 138 +++++++++++++------ src/conversation_textview.py | 75 ++++++---- src/dataforms_widget.py | 64 ++++++-- src/dialogs.py | 304 +++++++++++++++++++++++++++++++------------ 5 files changed, 417 insertions(+), 182 deletions(-)
diffs (truncated from 1400 to 300 lines):
diff -r 192a3fb88bfb -r 078ae96fbbf7 src/atom_window.py --- a/src/atom_window.py Wed Nov 25 16:29:33 2009 +0100 +++ b/src/atom_window.py Wed Nov 25 17:45:05 2009 +0200 @@ -35,7 +35,9 @@
@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 @@ 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 @@ 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 @@ 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 -r 192a3fb88bfb -r 078ae96fbbf7 src/config.py --- a/src/config.py Wed Nov 25 16:29:33 2009 +0100 +++ b/src/config.py Wed Nov 25 17:45:05 2009 +0200 @@ -63,17 +63,23 @@
#---------- 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@
#---------- 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 'zeroconf_email', email)
class FakeDataForm(gtk.Table, object): - '''Class for forms that are in XML format <entry1>value1</entry1> - infos in a table {entry1: value1, }''' + """ + Class for forms that are in XML format <entry1>value1</entry1> infos in a + table {entry1: value1} + """ + def __init__(self, infos): gtk.Table.__init__(self) self.infos = infos @@ -2418,7 +2450,9 @@ 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 @@ 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 @@ 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 @@ 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 @@
#---------- 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 @@ 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 @@ 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()