fixing dict name: gajim.interface.windows --> gajim.interface.instances

This commit is contained in:
Nikos Kouremenos 2005-11-13 15:08:47 +00:00
parent 287b40bde6
commit 082fc7aaa9
18 changed files with 270 additions and 270 deletions

View File

@ -83,7 +83,7 @@ class AdvancedConfigurationWindow:
self.xml.signal_autoconnect(self)
self.window.show_all()
gajim.interface.windows['advanced_config'] = self
gajim.interface.instances['advanced_config'] = self
def cb_value_column_data(self, col, cell, model, iter):
'''check if it's boolen or holds password stuff and if yes
@ -145,8 +145,8 @@ class AdvancedConfigurationWindow:
def on_advanced_configuration_window_destroy(self, widget):
# update ui of preferences window to get possible changes we did
gajim.interface.windows['preferences'].update_preferences_window()
del gajim.interface.windows['advanced_config']
gajim.interface.instances['preferences'].update_preferences_window()
del gajim.interface.instances['advanced_config']
def on_advanced_close_button_clicked(self, widget):
self.window.destroy()

View File

@ -273,9 +273,9 @@ class Chat:
return 'pm'
def on_window_destroy(self, widget, kind): #kind is 'chats' or 'gc'
'''clean gajim.interface.windows[self.account][kind]'''
'''clean gajim.interface.instances[self.account][kind]'''
for jid in self.xmls:
windows = gajim.interface.windows[self.account][kind]
windows = gajim.interface.instances[self.account][kind]
if kind == 'chats':
# send 'gone' chatstate to every tabbed chat tab
windows[jid].send_chatstate('gone', jid)
@ -308,10 +308,10 @@ class Chat:
'''When history menuitem is pressed: call history window'''
if jid is None:
jid = self.get_active_jid()
if gajim.interface.windows['logs'].has_key(jid):
gajim.interface.windows['logs'][jid].window.present()
if gajim.interface.instances['logs'].has_key(jid):
gajim.interface.instances['logs'][jid].window.present()
else:
gajim.interface.windows['logs'][jid] = history_window.HistoryWindow(jid,
gajim.interface.instances['logs'][jid] = history_window.HistoryWindow(jid,
self.account)
def on_chat_window_focus_in_event(self, widget, event):
@ -529,8 +529,8 @@ class Chat:
self.notebook.remove_page(self.notebook.page_num(self.childs[jid]))
if gajim.interface.windows[self.account][kind].has_key(jid):
del gajim.interface.windows[self.account][kind][jid]
if gajim.interface.instances[self.account][kind].has_key(jid):
del gajim.interface.instances[self.account][kind][jid]
del self.nb_unread[jid]
del gajim.last_message_time[self.account][jid]
del self.xmls[jid]

View File

@ -495,10 +495,10 @@ class PreferencesWindow:
[self.xml.get_widget('add_remove_emoticons_button')])
def on_add_remove_emoticons_button_clicked(self, widget):
if gajim.interface.windows.has_key('manage_emots'):
gajim.interface.windows['manage_emots'].window.present()
if gajim.interface.instances.has_key('manage_emots'):
gajim.interface.instances['manage_emots'].window.present()
else:
gajim.interface.windows['manage_emots'] = ManageEmoticonsWindow()
gajim.interface.instances['manage_emots'] = ManageEmoticonsWindow()
def on_iconset_combobox_changed(self, widget):
model = widget.get_model()
@ -533,7 +533,7 @@ class PreferencesWindow:
buf1 = {}
buf2 = {}
saved_var = {}
windows = gajim.interface.windows[acct][kind]
windows = gajim.interface.instances[acct][kind]
jids = windows.keys()
for jid in jids:
window = windows[jid]
@ -563,7 +563,7 @@ class PreferencesWindow:
buf1 = {}
buf2 = {}
saved_var = {}
windows = gajim.interface.windows[acct][kind]
windows = gajim.interface.instances[acct][kind]
jids = windows.keys()
if not 'tabbed' in jids:
continue
@ -603,7 +603,7 @@ class PreferencesWindow:
def apply_speller(self, kind):
for acct in gajim.connections:
windows = gajim.interface.windows[acct][kind]
windows = gajim.interface.instances[acct][kind]
jids = windows.keys()
for jid in jids:
if jid == 'tabbed':
@ -614,7 +614,7 @@ class PreferencesWindow:
def remove_speller(self, kind):
for acct in gajim.connections:
windows = gajim.interface.windows[acct][kind]
windows = gajim.interface.instances[acct][kind]
jids = windows.keys()
for jid in jids:
if jid == 'tabbed':
@ -639,7 +639,7 @@ class PreferencesWindow:
def update_print_time(self):
'''Update time in Opened Chat Windows'''
for a in gajim.connections:
window = gajim.interface.windows[a]['chats']
window = gajim.interface.instances[a]['chats']
if window.has_key('tabbed'):
window['tabbed'].update_print_time()
else:
@ -684,7 +684,7 @@ class PreferencesWindow:
'''Update color tags in Opened Chat Windows'''
for a in gajim.connections:
for kind in ('chats', 'gc'):
windows = gajim.interface.windows[a][kind]
windows = gajim.interface.instances[a][kind]
if windows.has_key('tabbed'):
windows['tabbed'].update_tags()
else:
@ -695,7 +695,7 @@ class PreferencesWindow:
'''Update text font in Opened Chat Windows'''
for a in gajim.connections:
for kind in ('chats', 'gc'):
windows = gajim.interface.windows[a][kind]
windows = gajim.interface.instances[a][kind]
if windows.has_key('tabbed'):
windows['tabbed'].update_font()
else:
@ -1026,10 +1026,10 @@ class PreferencesWindow:
model.set_value(iter, 1, 1)
def on_open_advanced_editor_button_clicked(self, widget, data = None):
if gajim.interface.windows.has_key('advanced_config'):
gajim.interface.windows['advanced_config'].window.present()
if gajim.interface.instances.has_key('advanced_config'):
gajim.interface.instances['advanced_config'].window.present()
else:
gajim.interface.windows['advanced_config'] = \
gajim.interface.instances['advanced_config'] = \
dialogs.AdvancedConfigurationWindow()
#---------- AccountModificationWindow class -------------#
@ -1037,12 +1037,12 @@ class AccountModificationWindow:
'''Class for account informations'''
def on_account_modification_window_destroy(self, widget):
'''close window'''
if gajim.interface.windows.has_key(self.account):
if gajim.interface.windows[self.account].has_key('account_modification'):
del gajim.interface.windows[self.account]['account_modification']
if gajim.interface.instances.has_key(self.account):
if gajim.interface.instances[self.account].has_key('account_modification'):
del gajim.interface.instances[self.account]['account_modification']
return
if gajim.interface.windows.has_key('account_modification'):
del gajim.interface.windows['account_modification']
if gajim.interface.instances.has_key('account_modification'):
del gajim.interface.instances['account_modification']
def on_cancel_button_clicked(self, widget):
self.window.destroy()
@ -1276,7 +1276,7 @@ class AccountModificationWindow:
#if we modify the name of the account
if name != self.account:
#update variables
gajim.interface.windows[name] = gajim.interface.windows[self.account]
gajim.interface.instances[name] = gajim.interface.windows[self.account]
gajim.awaiting_events[name] = gajim.awaiting_events[self.account]
gajim.nicks[name] = gajim.nicks[self.account]
gajim.allow_notifications[name] = \
@ -1297,8 +1297,8 @@ class AccountModificationWindow:
#upgrade account variable in opened windows
for kind in ('infos', 'disco', 'chats', 'gc', 'gc_config'):
for j in gajim.interface.windows[name][kind]:
gajim.interface.windows[name][kind][j].account = name
for j in gajim.interface.instances[name][kind]:
gajim.interface.instances[name][kind][j].account = name
#upgrade account in systray
if gajim.interface.systray_enabled:
@ -1306,7 +1306,7 @@ class AccountModificationWindow:
if list[0] == self.account:
list[0] = name
del gajim.interface.windows[self.account]
del gajim.interface.instances[self.account]
del gajim.awaiting_events[self.account]
del gajim.nicks[self.account]
del gajim.allow_notifications[self.account]
@ -1335,8 +1335,8 @@ class AccountModificationWindow:
else:
gajim.connections[name].password = None
#refresh accounts window
if gajim.interface.windows.has_key('accounts'):
gajim.interface.windows['accounts'].init_accounts()
if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].init_accounts()
#refresh roster
gajim.interface.roster.draw_roster()
gajim.interface.save_config()
@ -1356,7 +1356,7 @@ class AccountModificationWindow:
self.xml.get_widget('password_entry').set_text(new_password)
def on_edit_details_button_clicked(self, widget):
if not gajim.interface.windows.has_key(self.account):
if not gajim.interface.instances.has_key(self.account):
dialogs.ErrorDialog(_('No such account available'),
_('You must create your account before editing your personal information.')).get_response()
return
@ -1371,18 +1371,18 @@ _('Without a connection, you can not edit your personal information.')
return
# in infos the key jid is OUR jid so we save the vcardwindow instance there
if gajim.interface.windows[self.account]['infos'].has_key(jid):
gajim.interface.windows[self.account]['infos'][jid].window.present()
if gajim.interface.instances[self.account]['infos'].has_key(jid):
gajim.interface.instances[self.account]['infos'][jid].window.present()
else:
gajim.interface.windows[self.account]['infos'][jid] = \
gajim.interface.instances[self.account]['infos'][jid] = \
dialogs.VcardWindow(jid, self.account, True)
gajim.connections[self.account].request_vcard(jid)
def on_manage_proxies_button_clicked(self, widget):
if gajim.interface.windows.has_key('manage_proxies'):
gajim.interface.windows['manage_proxies'].window.present()
if gajim.interface.instances.has_key('manage_proxies'):
gajim.interface.instances['manage_proxies'].window.present()
else:
gajim.interface.windows['manage_proxies'] = \
gajim.interface.instances['manage_proxies'] = \
ManageProxiesWindow()
def on_gpg_choose_button_clicked(self, widget, data = None):
@ -1488,12 +1488,12 @@ class ManageProxiesWindow:
def on_manage_proxies_window_destroy(self, widget):
for account in gajim.connections:
if gajim.interface.windows[account].has_key('account_modification'):
gajim.interface.windows[account]['account_modification'].\
if gajim.interface.instances[account].has_key('account_modification'):
gajim.interface.instances[account]['account_modification'].\
update_proxy_list()
if gajim.interface.windows.has_key('account_modification'):
gajim.interface.windows['account_modification'].update_proxy_list()
del gajim.interface.windows['manage_proxies']
if gajim.interface.instances.has_key('account_modification'):
gajim.interface.instances['account_modification'].update_proxy_list()
del gajim.interface.instances['manage_proxies']
def on_add_proxy_button_clicked(self, widget):
model = self.proxies_treeview.get_model()
@ -1613,7 +1613,7 @@ class ManageProxiesWindow:
class AccountsWindow:
'''Class for accounts window: list of accounts'''
def on_accounts_window_destroy(self, widget):
del gajim.interface.windows['accounts']
del gajim.interface.instances['accounts']
def on_close_button_clicked(self, widget):
self.window.destroy()
@ -1659,10 +1659,10 @@ class AccountsWindow:
def on_new_button_clicked(self, widget):
'''When new button is clicked: open an account information window'''
if gajim.interface.windows.has_key('account_creation_wizard'):
gajim.interface.windows['account_creation_wizard'].window.present()
if gajim.interface.instances.has_key('account_creation_wizard'):
gajim.interface.instances['account_creation_wizard'].window.present()
else:
gajim.interface.windows['account_creation_wizard'] = \
gajim.interface.instances['account_creation_wizard'] = \
AccountCreationWizardWindow()
def on_remove_button_clicked(self, widget):
@ -1673,10 +1673,10 @@ class AccountsWindow:
if not iter:
return
account = model.get_value(iter, 0).decode('utf-8')
if gajim.interface.windows[account].has_key('remove_account'):
gajim.interface.windows[account]['remove_account'].window.present()
if gajim.interface.instances[account].has_key('remove_account'):
gajim.interface.instances[account]['remove_account'].window.present()
else:
gajim.interface.windows[account]['remove_account'] = \
gajim.interface.instances[account]['remove_account'] = \
RemoveAccountWindow(account)
def on_modify_button_clicked(self, widget):
@ -1696,10 +1696,10 @@ class AccountsWindow:
self.show_modification_window(account)
def show_modification_window(self, account):
if gajim.interface.windows[account].has_key('account_modification'):
gajim.interface.windows[account]['account_modification'].window.present()
if gajim.interface.instances[account].has_key('account_modification'):
gajim.interface.instances[account]['account_modification'].window.present()
else:
gajim.interface.windows[account]['account_modification'] = \
gajim.interface.instances[account]['account_modification'] = \
AccountModificationWindow(account)
class DataFormWindow:
@ -1941,7 +1941,7 @@ class ManageEmoticonsWindow:
def on_manage_emoticons_window_destroy(self, widget):
gajim.interface.init_regexp() # update regexp [emoticons included]
# remove us from open windows
del gajim.interface.windows['manage_emots']
del gajim.interface.instances['manage_emots']
def on_close_button_clicked(self, widget):
self.window.destroy()
@ -2126,7 +2126,7 @@ class GroupchatConfigWindow(DataFormWindow):
self.room_jid = room_jid
def on_data_form_window_destroy(self, widget):
del gajim.interface.windows[self.account]['gc_config'][self.room_jid]
del gajim.interface.instances[self.account]['gc_config'][self.room_jid]
def on_apply_button_clicked(self, widget):
gajim.connections[self.account].send_gc_config(self.room_jid, self.config)
@ -2138,8 +2138,8 @@ class RemoveAccountWindow:
and do removing of the account given'''
def on_remove_account_window_destroy(self, widget):
if gajim.interface.windows.has_key(self.account):
del gajim.interface.windows[self.account]['remove_account']
if gajim.interface.instances.has_key(self.account):
del gajim.interface.instances[self.account]['remove_account']
def on_cancel_button_clicked(self, widget):
self.window.destroy()
@ -2168,7 +2168,7 @@ class RemoveAccountWindow:
del gajim.connections[self.account]
gajim.config.del_per('accounts', self.account)
gajim.interface.save_config()
del gajim.interface.windows[self.account]
del gajim.interface.instances[self.account]
del gajim.awaiting_events[self.account]
del gajim.nicks[self.account]
del gajim.allow_notifications[self.account]
@ -2184,8 +2184,8 @@ class RemoveAccountWindow:
del gajim.status_before_autoaway[self.account]
del gajim.events_for_ui[self.account]
gajim.interface.roster.draw_roster()
if gajim.interface.windows.has_key('accounts'):
gajim.interface.windows['accounts'].init_accounts()
if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].init_accounts()
self.window.destroy()
#---------- ManageBookmarksWindow class -------------#
@ -2262,7 +2262,7 @@ class ManageBookmarksWindow:
return not self.check_valid_bookmark()
def on_manage_bookmarks_window_destroy(self, widget, event):
del gajim.interface.windows['manage_bookmarks']
del gajim.interface.instances['manage_bookmarks']
def on_add_bookmark_button_clicked(self,widget):
'''
@ -2487,7 +2487,7 @@ class AccountCreationWizardWindow:
self.window.show_all()
def on_wizard_window_destroy(self, widget):
del gajim.interface.windows['account_creation_wizard']
del gajim.interface.instances['account_creation_wizard']
def on_register_server_features_button_clicked(self, widget):
helpers.launch_browser_mailer('url', 'http://www.jabber.org/network/')
@ -2626,7 +2626,7 @@ _('You can set advanced account options by pressing Advanced button,or later by
self.notebook.set_current_page(3) # show finish page
def on_advanced_button_clicked(self, widget):
gajim.interface.windows[self.account]['account_modification'] = \
gajim.interface.instances[self.account]['account_modification'] = \
AccountModificationWindow(self.account)
self.window.destroy()
@ -2717,9 +2717,9 @@ _('You can set advanced account options by pressing Advanced button,or later by
gajim.config.set_per('accounts', self.account, opt, config[opt])
# update variables
gajim.interface.windows[self.account] = {'infos': {}, 'disco': {},
gajim.interface.instances[self.account] = {'infos': {}, 'disco': {},
'chats': {}, 'gc': {}, 'gc_config': {}}
gajim.interface.windows[self.account]['xml_console'] = \
gajim.interface.instances[self.account]['xml_console'] = \
dialogs.XMLConsoleWindow(self.account)
gajim.awaiting_events[self.account] = {}
gajim.connections[self.account].connected = 0
@ -2737,8 +2737,8 @@ _('You can set advanced account options by pressing Advanced button,or later by
gajim.status_before_autoaway[self.account] = ''
gajim.events_for_ui[self.account] = []
# refresh accounts window
if gajim.interface.windows.has_key('accounts'):
gajim.interface.windows['accounts'].init_accounts()
if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].init_accounts()
# refresh roster
gajim.interface.roster.draw_roster()
gajim.interface.save_config()

View File

@ -333,14 +333,14 @@ class ConversationTextview(gtk.TextView):
def on_join_group_chat_menuitem_activate(self, widget, jid):
room, server = jid.split('@')
if gajim.interface.windows[self.account].has_key('join_gc'):
instance = gajim.interface.windows[self.account]['join_gc']
if gajim.interface.instances[self.account].has_key('join_gc'):
instance = gajim.interface.instances[self.account]['join_gc']
instance.xml.get_widget('server_entry').set_text(server)
instance.xml.get_widget('room_entry').set_text(room)
gajim.interface.windows[self.account]['join_gc'].window.present()
gajim.interface.instances[self.account]['join_gc'].window.present()
else:
try:
gajim.interface.windows[self.account]['join_gc'] = \
gajim.interface.instances[self.account]['join_gc'] = \
dialogs.JoinGroupchatWindow(self.account, server, room)
except RuntimeError:
pass

View File

@ -609,13 +609,13 @@ class SubscriptionRequestWindow:
def on_contact_info_button_clicked(self, widget):
'''ask vcard'''
if gajim.interface.windows[self.account]['infos'].has_key(self.jid):
gajim.interface.windows[self.account]['infos'][self.jid].window.present()
if gajim.interface.instances[self.account]['infos'].has_key(self.jid):
gajim.interface.instances[self.account]['infos'][self.jid].window.present()
else:
gajim.interface.windows[self.account]['infos'][self.jid] = \
gajim.interface.instances[self.account]['infos'][self.jid] = \
VcardWindow(self.jid, self.account, True)
#remove the publish / retrieve buttons
vcard_xml = gajim.interface.windows[self.account]['infos'][self.jid].xml
vcard_xml = gajim.interface.instances[self.account]['infos'][self.jid].xml
hbuttonbox = vcard_xml.get_widget('information_hbuttonbox')
children = hbuttonbox.get_children()
hbuttonbox.remove(children[0])
@ -644,7 +644,7 @@ _('You can not join a group chat unless you are connected.')).get_response()
self.xml.get_widget('room_entry').set_text(room)
self.xml.get_widget('nickname_entry').set_text(nick)
self.xml.signal_autoconnect(self)
gajim.interface.windows[account]['join_gc'] = self #now add us to open windows
gajim.interface.instances[account]['join_gc'] = self #now add us to open windows
our_jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
gajim.config.get_per('accounts', self.account, 'hostname')
if len(gajim.connections) > 1:
@ -671,7 +671,7 @@ _('You can not join a group chat unless you are connected.')).get_response()
def on_join_groupchat_window_destroy(self, widget):
'''close window'''
# remove us from open windows
del gajim.interface.windows[self.account]['join_gc']
del gajim.interface.instances[self.account]['join_gc']
def on_join_groupchat_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE
@ -911,7 +911,7 @@ class PopupNotificationWindow:
if self.msg_type == 'pm': # It's a private message
gajim.interface.roster.new_chat(contact, self.account)
chats_window = gajim.interface.windows[self.account]['chats'][self.jid]
chats_window = gajim.interface.instances[self.account]['chats'][self.jid]
chats_window.set_active_tab(self.jid)
chats_window.window.present()
elif self.msg_type in ('normal', 'file-request', 'file-request-error',
@ -922,7 +922,7 @@ class PopupNotificationWindow:
else: # 'chat'
gajim.interface.roster.new_chat(contact, self.account)
chats_window = gajim.interface.windows[self.account]['chats'][self.jid]
chats_window = gajim.interface.instances[self.account]['chats'][self.jid]
chats_window.set_active_tab(self.jid)
chats_window.window.present()

View File

@ -488,7 +488,7 @@ _('Without a connection, you can not browse available services')).get_response()
# self.browser._get_agent_address() would break when no browser.
addr = get_agent_address(self.jid, self.node)
del gajim.interface.windows[self.account]['disco'][addr]
del gajim.interface.instances[self.account]['disco'][addr]
if self.browser:
self.window.hide()
@ -515,10 +515,10 @@ _('Without a connection, you can not browse available services')).get_response()
# Update the window list
if self.jid:
old_addr = get_agent_address(self.jid, self.node)
if gajim.interface.windows[self.account]['disco'].has_key(old_addr):
del gajim.interface.windows[self.account]['disco'][old_addr]
if gajim.interface.instances[self.account]['disco'].has_key(old_addr):
del gajim.interface.instances[self.account]['disco'][old_addr]
addr = get_agent_address(jid, node)
gajim.interface.windows[self.account]['disco'][addr] = self
gajim.interface.instances[self.account]['disco'][addr] = self
# We need to store these, self.browser is not always available.
self.jid = jid
self.node = node
@ -549,7 +549,7 @@ _('This type of service does not contain any items to browse.')).get_response()
def open(self, jid, node):
'''Open an agent. By default, this happens in a new window.'''
try:
win = gajim.interface.windows[self.account]['disco']\
win = gajim.interface.instances[self.account]['disco']\
[get_agent_address(jid, node)]
win.window.present()
return
@ -1388,10 +1388,10 @@ class MucBrowser(AgentBrowser):
service = services[1]
else:
room = model[iter][1].decode('utf-8')
if not gajim.interface.windows[self.account].has_key('join_gc'):
if not gajim.interface.instances[self.account].has_key('join_gc'):
dialogs.JoinGroupchatWindow(self.account, service, room)
else:
gajim.interface.windows[self.account]['join_gc'].window.present()
gajim.interface.instances[self.account]['join_gc'].window.present()
self.window.destroy(chain = True)
def update_actions(self):

View File

@ -187,7 +187,7 @@ class Interface:
title = data[1]
prompt = data[2]
proposed_nick = data[3]
w = self.windows[account]['gc']
w = self.instances[account]['gc']
if w.has_key(room_jid): # user may close the window before we are here
w[room_jid].show_change_nick_input_dialog(title, prompt, proposed_nick,
room_jid)
@ -207,7 +207,7 @@ class Interface:
id, jid_from, errmsg, errcode = array
if unicode(errcode) in ('403', '406') and id:
# show the error dialog
ft = self.windows['file_transfers']
ft = self.instances['file_transfers']
sid = id
if len(id) > 3 and id[2] == '_':
sid = id[3:]
@ -230,8 +230,8 @@ class Interface:
(jid_from, file_props))
conn.disconnect_transfer(file_props)
return
if jid_from in self.windows[account]['gc']:
self.windows[account]['gc'][jid_from].print_conversation(
if jid_from in self.instances[account]['gc']:
self.instances[account]['gc'][jid_from].print_conversation(
'Error %s: %s' % (array[2], array[1]), jid_from)
def handle_event_con_type(self, account, con_type):
@ -251,16 +251,16 @@ class Interface:
if not gajim.gc_connected.has_key(account):
return
for room_jid in gajim.gc_connected[account]:
if self.windows[account]['gc'].has_key(room_jid):
self.windows[account]['gc'][room_jid].got_disconnected(room_jid)
if self.instances[account]['gc'].has_key(room_jid):
self.instances[account]['gc'][room_jid].got_disconnected(room_jid)
else:
gobject.timeout_add(30000, self.allow_notif, account)
model[self.roster.status_message_menuitem_iter][3] = True # sensitivity for this menuitem
self.roster.on_status_changed(account, status)
if account in self.show_vcard_when_connect:
jid = gajim.get_jid_from_account(account)
if not self.windows[account]['infos'].has_key('vcard'):
self.windows[account]['infos'][jid] = \
if not self.instances[account]['infos'].has_key('vcard'):
self.instances[account]['infos'][jid] = \
dialogs.VcardWindow(jid, account, True)
gajim.connections[account].request_vcard(jid)
if self.remote and self.remote.is_enabled():
@ -359,7 +359,7 @@ class Interface:
if gajim.config.get_per('soundevents', 'contact_connected',
'enabled'):
helpers.play_sound('contact_connected')
if not self.windows[account]['chats'].has_key(jid) and \
if not self.instances[account]['chats'].has_key(jid) and \
not gajim.awaiting_events[account].has_key(jid) and \
gajim.config.get('notify_on_signin') and \
gajim.allow_notifications[account]:
@ -379,7 +379,7 @@ class Interface:
if gajim.config.get_per('soundevents', 'contact_disconnected',
'enabled'):
helpers.play_sound('contact_disconnected')
if not self.windows[account]['chats'].has_key(jid) and \
if not self.instances[account]['chats'].has_key(jid) and \
not gajim.awaiting_events[account].has_key(jid) and \
gajim.config.get('notify_on_signout'):
show_notification = False
@ -417,16 +417,16 @@ class Interface:
elif gajim.connections[account].connected in (2, 3): # we're online or chat
show_notification = True
if self.windows[account]['gc'].has_key(jid): # it's a Private Message
if self.instances[account]['gc'].has_key(jid): # it's a Private Message
nick = gajim.get_nick_from_fjid(array[0])
fjid = array[0]
if not self.windows[account]['chats'].has_key(fjid) and \
if not self.instances[account]['chats'].has_key(fjid) and \
not gajim.awaiting_events[account].has_key(fjid):
if show_notification:
notify.notify(
_('New Private Message'), fjid, account, 'pm')
self.windows[account]['gc'][jid].on_private_message(jid, nick,
self.instances[account]['gc'][jid].on_private_message(jid, nick,
array[1], array[2])
return
@ -436,8 +436,8 @@ class Interface:
# Handle chat states
contact = gajim.get_first_contact_instance_from_jid(account, jid)
if self.windows[account]['chats'].has_key(jid):
chat_win = self.windows[account]['chats'][jid]
if self.instances[account]['chats'].has_key(jid):
chat_win = self.instances[account]['chats'][jid]
if chatstate is not None: # he or she sent us reply, so he supports jep85
if contact.chatstate == 'ask': # we were jep85 disco?
contact.chatstate = 'active' # no more
@ -455,7 +455,7 @@ class Interface:
return
first = False
if not self.windows[account]['chats'].has_key(jid) and \
if not self.instances[account]['chats'].has_key(jid) and \
not gajim.awaiting_events[account].has_key(jid):
first = True
if gajim.config.get('notify_on_new_message'):
@ -490,11 +490,11 @@ class Interface:
fjid = array[0]
jids = fjid.split('/', 1)
jid = jids[0]
gcs = self.windows[account]['gc']
gcs = self.instances[account]['gc']
if jid in gcs:
if len(jids) > 1: # it's a pm
nick = jids[1]
if not self.windows[account]['chats'].has_key(fjid):
if not self.instances[account]['chats'].has_key(fjid):
gc = gcs[jid]
tv = gc.list_treeview[jid]
model = tv.get_model()
@ -506,7 +506,7 @@ class Interface:
c = Contact(jid = fjid, name = nick, groups = ['none'],
show = show, ask = 'none')
self.roster.new_chat(c, account)
self.windows[account]['chats'][fjid].print_conversation(
self.instances[account]['chats'][fjid].print_conversation(
'Error %s: %s' % (array[1], array[2]), fjid, 'status')
return
gcs[jid].print_conversation('Error %s: %s' % \
@ -613,16 +613,16 @@ class Interface:
def handle_event_acc_ok(self, account, array):
#('ACC_OK', account, (config))
if self.windows.has_key('account_creation_wizard'):
self.windows['account_creation_wizard'].acc_is_ok(array)
if self.instances.has_key('account_creation_wizard'):
self.instances['account_creation_wizard'].acc_is_ok(array)
if self.remote and self.remote.is_enabled():
self.remote.raise_signal('NewAccount', (account, array))
def handle_event_acc_not_ok(self, account, array):
#('ACC_NOT_OK', account, (reason))
if self.windows.has_key('account_creation_wizard'):
self.windows['account_creation_wizard'].acc_is_not_ok(array)
if self.instances.has_key('account_creation_wizard'):
self.instances['account_creation_wizard'].acc_is_not_ok(array)
def handle_event_quit(self, p1, p2):
self.roster.quit_gtkgui_interface()
@ -633,8 +633,8 @@ class Interface:
nick = array['NICKNAME']
if nick:
gajim.nicks[account] = nick
if self.windows[account]['infos'].has_key(array['jid']):
win = self.windows[account]['infos'][array['jid']]
if self.instances[account]['infos'].has_key(array['jid']):
win = self.instances[account]['infos'][array['jid']]
win.set_values(array)
if account in self.show_vcard_when_connect:
win.xml.get_widget('information_notebook').set_current_page(-1)
@ -649,19 +649,19 @@ class Interface:
# vcard window
win = None
if self.windows[account]['infos'].has_key(jid):
win = self.windows[account]['infos'][jid]
elif self.windows[account]['infos'].has_key(jid + '/' + resource):
win = self.windows[account]['infos'][jid + '/' + resource]
if self.instances[account]['infos'].has_key(jid):
win = self.instances[account]['infos'][jid]
elif self.instances[account]['infos'].has_key(jid + '/' + resource):
win = self.instances[account]['infos'][jid + '/' + resource]
if win:
win.set_values(vcard)
# show avatar in chat
win = None
if self.windows[account]['chats'].has_key(jid):
win = self.windows[account]['chats'][jid]
elif self.windows[account]['chats'].has_key(jid + '/' + resource):
win = self.windows[account]['chats'][jid + '/' + resource]
if self.instances[account]['chats'].has_key(jid):
win = self.instances[account]['chats'][jid]
elif self.instances[account]['chats'].has_key(jid + '/' + resource):
win = self.instances[account]['chats'][jid + '/' + resource]
if win:
# FIXME: this will be removed when we have the thread working
win.show_avatar(jid, resource)
@ -670,10 +670,10 @@ class Interface:
def handle_event_os_info(self, account, array):
win = None
if self.windows[account]['infos'].has_key(array[0]):
win = self.windows[account]['infos'][array[0]]
elif self.windows[account]['infos'].has_key(array[0] + '/' + array[1]):
win = self.windows[account]['infos'][array[0] + '/' + array[1]]
if self.instances[account]['infos'].has_key(array[0]):
win = self.instances[account]['infos'][array[0]]
elif self.instances[account]['infos'].has_key(array[0] + '/' + array[1]):
win = self.instances[account]['infos'][array[0] + '/' + array[1]]
if win:
win.set_os_info(array[1], array[2], array[3])
if self.remote and self.remote.is_enabled():
@ -686,10 +686,10 @@ class Interface:
resource = array[3]
if not resource:
resource = ''
if self.windows[account]['gc'].has_key(jid): # ji is then room_jid
if self.instances[account]['gc'].has_key(jid): # ji is then room_jid
#FIXME: upgrade the chat instances (for pm)
#FIXME: real_jid can be None
self.windows[account]['gc'][jid].chg_contact_status(jid, resource,
self.instances[account]['gc'][jid].chg_contact_status(jid, resource,
array[1], array[2], array[4], array[5], array[6], array[7],
array[8], array[9], array[10], account)
if self.remote and self.remote.is_enabled():
@ -699,7 +699,7 @@ class Interface:
# ('GC_MSG', account, (jid, msg, time))
jids = array[0].split('/', 1)
room_jid = jids[0]
if not self.windows[account]['gc'].has_key(room_jid):
if not self.instances[account]['gc'].has_key(room_jid):
return
if len(jids) == 1:
# message from server
@ -707,7 +707,7 @@ class Interface:
else:
# message from someone
nick = jids[1]
self.windows[account]['gc'][room_jid].on_message(room_jid, nick, array[1],
self.instances[account]['gc'][room_jid].on_message(room_jid, nick, array[1],
array[2])
if self.remote and self.remote.is_enabled():
self.remote.raise_signal('GCMessage', (account, array))
@ -716,18 +716,18 @@ class Interface:
#('GC_SUBJECT', account, (jid, subject))
jids = array[0].split('/', 1)
jid = jids[0]
if not self.windows[account]['gc'].has_key(jid):
if not self.instances[account]['gc'].has_key(jid):
return
self.windows[account]['gc'][jid].set_subject(jid, array[1])
self.instances[account]['gc'][jid].set_subject(jid, array[1])
if len(jids) > 1:
self.windows[account]['gc'][jid].print_conversation(
self.instances[account]['gc'][jid].print_conversation(
'%s has set the subject to %s' % (jids[1], array[1]), jid)
def handle_event_gc_config(self, account, array):
#('GC_CONFIG', account, (jid, config)) config is a dict
jid = array[0].split('/')[0]
if not self.windows[account]['gc_config'].has_key(jid):
self.windows[account]['gc_config'][jid] = \
if not self.instances[account]['gc_config'].has_key(jid):
self.instances[account]['gc_config'][jid] = \
config.GroupchatConfigWindow(account, jid, array[1])
def handle_event_gc_invitation(self, account, array):
@ -780,7 +780,7 @@ class Interface:
def handle_event_file_send_error(self, account, array):
jid = array[0]
file_props = array[1]
ft = self.windows['file_transfers']
ft = self.instances['file_transfers']
ft.set_status(file_props['type'], file_props['sid'], 'stop')
if gajim.popup_window(account):
@ -827,7 +827,7 @@ class Interface:
def handle_event_file_request_error(self, account, array):
jid = array[0]
file_props = array[1]
ft = self.windows['file_transfers']
ft = self.instances['file_transfers']
ft.set_status(file_props['type'], file_props['sid'], 'stop')
errno = file_props['error']
@ -858,7 +858,7 @@ class Interface:
contact = gajim.contacts[account][jid][0]
if gajim.popup_window(account):
self.windows['file_transfers'].show_file_request(account, contact,
self.instances['file_transfers'].show_file_request(account, contact,
file_props)
return
@ -869,11 +869,11 @@ class Interface:
jid, account, 'file-request')
def handle_event_file_progress(self, account, file_props):
self.windows['file_transfers'].set_progress(file_props['type'],
self.instances['file_transfers'].set_progress(file_props['type'],
file_props['sid'], file_props['received-len'])
def handle_event_file_rcv_completed(self, account, file_props):
ft = self.windows['file_transfers']
ft = self.instances['file_transfers']
if file_props['error'] == 0:
ft.set_progress(file_props['type'], file_props['sid'],
file_props['received-len'])
@ -912,16 +912,16 @@ class Interface:
msg_type, file_props)
def handle_event_stanza_arrived(self, account, stanza):
if not self.windows.has_key(account):
if not self.instances.has_key(account):
return
if self.windows[account].has_key('xml_console'):
self.windows[account]['xml_console'].print_stanza(stanza, 'incoming')
if self.instances[account].has_key('xml_console'):
self.instances[account]['xml_console'].print_stanza(stanza, 'incoming')
def handle_event_stanza_sent(self, account, stanza):
if not self.windows.has_key(account):
if not self.instances.has_key(account):
return
if self.windows[account].has_key('xml_console'):
self.windows[account]['xml_console'].print_stanza(stanza, 'outgoing')
if self.instances[account].has_key('xml_console'):
self.instances[account]['xml_console'].print_stanza(stanza, 'outgoing')
def handle_event_vcard_published(self, account, array):
dialogs.InformationDialog(_('vCard publication succeeded'), _('Your personal information has been published successfully.'))
@ -1259,10 +1259,10 @@ class Interface:
gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
gtk.about_dialog_set_url_hook(self.on_launch_browser_mailer, 'url')
self.windows = {'logs': {}}
self.instances = {'logs': {}}
for a in gajim.connections:
self.windows[a] = {'infos': {}, 'disco': {}, 'chats': {},
self.instances[a] = {'infos': {}, 'disco': {}, 'chats': {},
'gc': {}, 'gc_config': {}}
gajim.contacts[a] = {}
gajim.groups[a] = {}
@ -1329,11 +1329,11 @@ class Interface:
self.init_regexp()
# get instances for windows/dialogs that will show_all()/hide()
self.windows['file_transfers'] = dialogs.FileTransfersWindow()
self.windows['preferences'] = config.PreferencesWindow()
self.instances['file_transfers'] = dialogs.FileTransfersWindow()
self.instances['preferences'] = config.PreferencesWindow()
for account in gajim.connections:
self.windows[account]['xml_console'] = \
self.instances[account]['xml_console'] = \
dialogs.XMLConsoleWindow(account)
gobject.timeout_add(100, self.autoconnect)

View File

@ -100,7 +100,7 @@ class GajimThemesWindow:
gajim.config.set('roster_theme', new_config_name)
model.set_value(iter, 0, new_name)
self.current_theme = new_name
gajim.interface.windows['preferences'].update_preferences_window()
gajim.interface.instances['preferences'].update_preferences_window()
def fill_themes_treeview(self):
self.xml.get_widget('remove_button').set_sensitive(False)
@ -142,7 +142,7 @@ class GajimThemesWindow:
col = self.themes_tree.get_column(0)
path = model.get_path(iter)
self.themes_tree.set_cursor(path, col, True)
gajim.interface.windows['preferences'].update_preferences_window()
gajim.interface.instances['preferences'].update_preferences_window()
def on_remove_button_clicked(self, widget):
(model, iter) = self.themes_tree.get_selection().get_selected()
@ -156,7 +156,7 @@ class GajimThemesWindow:
self.theme_options_vbox.set_sensitive(False)
gajim.config.del_per('themes', self.current_theme)
model.remove(iter)
gajim.interface.windows['preferences'].update_preferences_window()
gajim.interface.instances['preferences'].update_preferences_window()
def set_theme_options(self, theme, option = 'account'):
self.no_update = True

View File

@ -820,12 +820,12 @@ class GroupchatWindow(chat.Chat):
server = servernick
nick = ''
#join_gc window is needed in order to provide for password entry.
if gajim.interface.windows[self.account].has_key('join_gc'):
gajim.interface.windows[self.account]['join_gc'].\
if gajim.interface.instances[self.account].has_key('join_gc'):
gajim.interface.instances[self.account]['join_gc'].\
window.present()
else:
try:
gajim.interface.windows[self.account]['join_gc'] =\
gajim.interface.instances[self.account]['join_gc'] =\
dialogs.JoinGroupchatWindow(self.account,
server = server, room = room, nick = nick)
except RuntimeError:
@ -1103,14 +1103,14 @@ current room topic.') % command, room_jid)
else:
fjid = gajim.construct_fjid(room_jid, nick)
jid = fjid
if gajim.interface.windows[self.account]['infos'].has_key(jid):
gajim.interface.windows[self.account]['infos'][jid].window.present()
if gajim.interface.instances[self.account]['infos'].has_key(jid):
gajim.interface.instances[self.account]['infos'][jid].window.present()
else:
# we copy contact because c.jid must contain the fakeJid for vcard
c2 = Contact(jid = jid, name = c.name, groups = c.groups,
show = c.show, status = c.status, sub = c.sub,
resource = c.resource, role = c.role, affiliation = c.affiliation)
gajim.interface.windows[self.account]['infos'][jid] = \
gajim.interface.instances[self.account]['infos'][jid] = \
dialogs.VcardWindow(c2, self.account, False)
def on_history(self, widget, room_jid, nick):
@ -1134,18 +1134,18 @@ current room topic.') % command, room_jid)
nick = model[iter][C_NICK].decode('utf-8')
room_jid = self.get_active_jid()
fjid = gajim.construct_fjid(room_jid, nick) # 'fake' jid
if not gajim.interface.windows[self.account]['chats'].has_key(fjid):
if not gajim.interface.instances[self.account]['chats'].has_key(fjid):
show = gajim.gc_contacts[self.account][room_jid][nick].show
u = Contact(jid = fjid, name = nick, groups = ['none'], show = show,
sub = 'none')
gajim.interface.roster.new_chat(u, self.account)
#make active here in case we need to send a message
gajim.interface.windows[self.account]['chats'][fjid].set_active_tab(fjid)
gajim.interface.instances[self.account]['chats'][fjid].set_active_tab(fjid)
if msg:
gajim.interface.windows[self.account]['chats'][fjid].send_message(msg)
gajim.interface.windows[self.account]['chats'][fjid].window.present()
gajim.interface.instances[self.account]['chats'][fjid].send_message(msg)
gajim.interface.instances[self.account]['chats'][fjid].window.present()
def on_voice_checkmenuitem_activate(self, widget, room_jid, nick):
if widget.get_active():
@ -1431,8 +1431,8 @@ current room topic.') % command, room_jid)
no_queue = False
# We print if window is opened
if gajim.interface.windows[self.account]['chats'].has_key(fjid):
chat_win = gajim.interface.windows[self.account]['chats'][fjid]
if gajim.interface.instances[self.account]['chats'].has_key(fjid):
chat_win = gajim.interface.instances[self.account]['chats'][fjid]
chat_win.print_conversation(msg, fjid, tim = tim)
return
@ -1567,7 +1567,7 @@ current room topic.') % command, room_jid)
if len(path) == 2:
nick = model[iter][C_NICK].decode('utf-8')
fjid = gajim.construct_fjid(room_jid, nick)
if not gajim.interface.windows[self.account]['chats'].has_key(fjid):
if not gajim.interface.instances[self.account]['chats'].has_key(fjid):
show = gajim.gc_contacts[self.account][room_jid][nick].show
c = gajim.gc_contacts[self.account][room_jid][nick]
j = fjid
@ -1576,8 +1576,8 @@ current room topic.') % command, room_jid)
u = Contact(jid = j, name = nick, groups = ['none'],
show = show, sub = 'none')
gajim.interface.roster.new_chat(u, self.account)
gajim.interface.windows[self.account]['chats'][fjid].set_active_tab(fjid)
gajim.interface.windows[self.account]['chats'][fjid].window.present()
gajim.interface.instances[self.account]['chats'][fjid].set_active_tab(fjid)
gajim.interface.instances[self.account]['chats'][fjid].window.present()
return True
elif event.button == 1: # left click
@ -1615,7 +1615,7 @@ current room topic.') % command, room_jid)
room_jid = self.get_active_jid()
nick = model[iter][C_NICK].decode('utf-8')
jid = gajim.construct_fjid(room_jid, nick)
if not gajim.interface.windows[self.account]['chats'].has_key(jid):
if not gajim.interface.instances[self.account]['chats'].has_key(jid):
show = gajim.gc_contacts[self.account][room_jid][nick].show
c = gajim.gc_contacts[self.account][room_jid][nick]
j = jid
@ -1625,8 +1625,8 @@ current room topic.') % command, room_jid)
sub = 'none')
gajim.interface.roster.new_chat(contact, self.account)
jid = contact.jid
gajim.interface.windows[self.account]['chats'][jid].set_active_tab(jid)
gajim.interface.windows[self.account]['chats'][jid].window.present()
gajim.interface.instances[self.account]['chats'][jid].set_active_tab(jid)
gajim.interface.instances[self.account]['chats'][jid].window.present()
def on_list_treeview_row_expanded(self, widget, iter, path):
'''When a row is expanded: change the icon of the arrow'''

View File

@ -212,9 +212,9 @@ def resize_window(window, w, h):
def one_window_opened(typ):
for account in gajim.connections:
if not gajim.interface.windows[account].has_key(typ):
if not gajim.interface.instances[account].has_key(typ):
continue
if len(gajim.interface.windows[account][typ]):
if len(gajim.interface.instances[account][typ]):
return True
return False

View File

@ -90,7 +90,7 @@ class HistoryWindow:
self.window.show_all()
def on_history_window_destroy(self, widget):
del gajim.interface.windows['logs'][self.jid]
del gajim.interface.instances['logs'][self.jid]
def on_close_button_clicked(self, widget):
self.window.destroy()

View File

@ -161,7 +161,7 @@ class SignalObject(DbusPrototype):
if connected_account:
if os.path.isfile(file_path): # is it file?
gajim.interface.windows['file_transfers'].send_file(account,
gajim.interface.instances['file_transfers'].send_file(account,
contact, file_path)
return True
return False
@ -219,7 +219,7 @@ class SignalObject(DbusPrototype):
first_connected_acct = None
for acct in accounts:
if gajim.connections[acct].connected > 1: # account is online
if gajim.interface.windows[acct]['chats'].has_key(jid):
if gajim.interface.instances[acct]['chats'].has_key(jid):
connected_account = acct
break
# jid is in roster
@ -240,7 +240,7 @@ class SignalObject(DbusPrototype):
if connected_account:
gajim.interface.roster.new_chat_from_jid(connected_account, jid)
# preserve the 'steal focus preservation'
win = gajim.interface.windows[connected_account]['chats'][jid].window
win = gajim.interface.instances[connected_account]['chats'][jid].window
if win.get_property('visible'):
win.window.focus()
return True
@ -275,7 +275,7 @@ class SignalObject(DbusPrototype):
if len(gajim.interface.systray.jids) != 0:
account = gajim.interface.systray.jids[0][0]
jid = gajim.interface.systray.jids[0][1]
acc = gajim.interface.windows[account]
acc = gajim.interface.instances[account]
jid_tab = None
if acc['gc'].has_key(jid):
jid_tab = acc['gc'][jid]

View File

@ -278,7 +278,7 @@ class RosterWindow:
model[iter][C_SECPIXBUF] = scaled_pixbuf
def join_gc_room(self, account, room_jid, nick, password):
if room_jid in gajim.interface.windows[account]['gc'] and \
if room_jid in gajim.interface.instances[account]['gc'] and \
gajim.gc_connected[account][room_jid]:
dialogs.ErrorDialog(_('You are already in room %s') %room_jid
).get_response()
@ -289,10 +289,10 @@ class RosterWindow:
).get_response()
return
room, server = room_jid.split('@')
if not room_jid in gajim.interface.windows[account]['gc']:
if not room_jid in gajim.interface.instances[account]['gc']:
self.new_room(room_jid, nick, account)
gajim.interface.windows[account]['gc'][room_jid].set_active_tab(room_jid)
gajim.interface.windows[account]['gc'][room_jid].window.present()
gajim.interface.instances[account]['gc'][room_jid].set_active_tab(room_jid)
gajim.interface.instances[account]['gc'][room_jid].window.present()
gajim.connections[account].join_gc(nick, room, server, password)
def on_bookmark_menuitem_activate(self, widget, account, bookmark):
@ -308,10 +308,10 @@ class RosterWindow:
dialogs.SingleMessageWindow(account, server, 'send')
def on_xml_console_menuitem_activate(self, widget, account):
if gajim.interface.windows[account].has_key('xml_console'):
gajim.interface.windows[account]['xml_console'].window.present()
if gajim.interface.instances[account].has_key('xml_console'):
gajim.interface.instances[account]['xml_console'].window.present()
else:
gajim.interface.windows[account]['xml_console'].window.show_all()
gajim.interface.instances[account]['xml_console'].window.show_all()
def on_set_motd_menuitem_activate(self, widget, account):
server = gajim.config.get_per('accounts', account, 'hostname')
@ -658,23 +658,23 @@ class RosterWindow:
self.add_contact_to_roster(contact.jid, account)
self.draw_contact(contact.jid, account)
# print status in chat window and update status/GPG image
if gajim.interface.windows[account]['chats'].has_key(contact.jid):
if gajim.interface.instances[account]['chats'].has_key(contact.jid):
jid = contact.jid
gajim.interface.windows[account]['chats'][jid].set_state_image(jid)
gajim.interface.instances[account]['chats'][jid].set_state_image(jid)
name = contact.name
if contact.resource != '':
name += '/' + contact.resource
uf_show = helpers.get_uf_show(show)
gajim.interface.windows[account]['chats'][jid].print_conversation(
gajim.interface.instances[account]['chats'][jid].print_conversation(
_('%s is now %s (%s)') % (name, uf_show, status), jid, 'status')
if contact == gajim.get_contact_instance_with_highest_priority(\
account, contact.jid):
gajim.interface.windows[account]['chats'][jid].draw_name_banner(contact)
gajim.interface.instances[account]['chats'][jid].draw_name_banner(contact)
def on_info(self, widget, user, account):
'''Call vcard_information_window class to display user's information'''
info = gajim.interface.windows[account]['infos']
info = gajim.interface.instances[account]['infos']
if info.has_key(user.jid):
info[user.jid].window.present()
else:
@ -842,8 +842,8 @@ class RosterWindow:
keys[user.jid] = keyID[0]
for u in gajim.contacts[account][user.jid]:
u.keyID = keyID[0]
if gajim.interface.windows[account]['chats'].has_key(user.jid):
gajim.interface.windows[account]['chats'][user.jid].draw_widgets(user)
if gajim.interface.instances[account]['chats'].has_key(user.jid):
gajim.interface.instances[account]['chats'][user.jid].draw_widgets(user)
keys_str = ''
for jid in keys:
keys_str += jid + ' ' + keys[jid] + ' '
@ -855,10 +855,10 @@ class RosterWindow:
def on_history(self, widget, contact, account):
'''When history menuitem is activated: call log window'''
if gajim.interface.windows['logs'].has_key(contact.jid):
gajim.interface.windows['logs'][contact.jid].window.present()
if gajim.interface.instances['logs'].has_key(contact.jid):
gajim.interface.instances['logs'][contact.jid].window.present()
else:
gajim.interface.windows['logs'][contact.jid] = history_window.\
gajim.interface.instances['logs'][contact.jid] = history_window.\
HistoryWindow(contact.jid, account)
def on_send_single_message_menuitem_activate(self, wiget, account,
@ -869,7 +869,7 @@ class RosterWindow:
dialogs.SingleMessageWindow(account, contact.jid, 'send')
def on_send_file_menuitem_activate(self, widget, account, contact):
gajim.interface.windows['file_transfers'].show_file_send_request(
gajim.interface.instances['file_transfers'].show_file_send_request(
account, contact)
def mk_menu_user(self, event, iter):
@ -1029,10 +1029,10 @@ class RosterWindow:
menu.show_all()
def on_edit_account(self, widget, account):
if gajim.interface.windows[account].has_key('account_modification'):
gajim.interface.windows[account]['account_modification'].window.present()
if gajim.interface.instances[account].has_key('account_modification'):
gajim.interface.instances[account]['account_modification'].window.present()
else:
gajim.interface.windows[account]['account_modification'] = \
gajim.interface.instances[account]['account_modification'] = \
config.AccountModificationWindow(account)
def get_possible_button_event(self, event):
@ -1288,13 +1288,13 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
if type in ('agent', 'contact'):
account = model[iter][C_ACCOUNT].decode('utf-8')
jid = model[iter][C_JID].decode('utf-8')
if gajim.interface.windows[account]['chats'].has_key(jid):
gajim.interface.windows[account]['chats'][jid].set_active_tab(jid)
if gajim.interface.instances[account]['chats'].has_key(jid):
gajim.interface.instances[account]['chats'][jid].set_active_tab(jid)
elif gajim.contacts[account].has_key(jid):
c = gajim.get_contact_instance_with_highest_priority(account, jid)
self.new_chat(c, account)
gajim.interface.windows[account]['chats'][jid].set_active_tab(jid)
gajim.interface.windows[account]['chats'][jid].window.present()
gajim.interface.instances[account]['chats'][jid].set_active_tab(jid)
gajim.interface.instances[account]['chats'][jid].window.present()
elif type == 'account':
account = model[iter][C_ACCOUNT]
if account != 'all':
@ -1350,7 +1350,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
for u in gajim.contacts[account][user.jid]:
self.remove_contact(u, account)
del gajim.contacts[account][u.jid]
if user.jid in gajim.interface.windows[account]['chats']:
if user.jid in gajim.interface.instances[account]['chats']:
user1 = Contact(jid = user.jid, name = user.name,
groups = [_('not in the roster')], show = 'not in the roster',
status = '', ask = 'none', keyID = user.keyID)
@ -1437,9 +1437,9 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
gajim.connections[account].gpg_passphrase(passphrase)
gajim.connections[account].change_status(status, txt, sync, auto)
for room_jid in gajim.interface.windows[account]['gc']:
for room_jid in gajim.interface.instances[account]['gc']:
if room_jid != 'tabbed':
nick = gajim.interface.windows[account]['gc'][room_jid].nicks[room_jid]
nick = gajim.interface.instances[account]['gc'][room_jid].nicks[room_jid]
gajim.connections[account].send_gc_status(nick, room_jid, status,
txt)
if status == 'online' and gajim.interface.sleeper.getState() != \
@ -1577,7 +1577,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
self.make_menu()
def new_chat(self, contact, account):
chats = gajim.interface.windows[account]['chats']
chats = gajim.interface.instances[account]['chats']
if gajim.config.get('usetabbedchat'):
if not chats.has_key('tabbed'):
chats['tabbed'] = tabbed_chat_window.TabbedChatWindow(contact,
@ -1605,22 +1605,22 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
gajim.contacts[account][jid] = [contact]
self.add_contact_to_roster(contact.jid, account)
if not gajim.interface.windows[account]['chats'].has_key(jid):
if not gajim.interface.instances[account]['chats'].has_key(jid):
self.new_chat(contact, account)
gajim.interface.windows[account]['chats'][jid].set_active_tab(jid)
gajim.interface.windows[account]['chats'][jid].window.present()
gajim.interface.instances[account]['chats'][jid].set_active_tab(jid)
gajim.interface.instances[account]['chats'][jid].window.present()
def new_room(self, jid, nick, account):
if gajim.config.get('usetabbedchat'):
if not gajim.interface.windows[account]['gc'].has_key('tabbed'):
gajim.interface.windows[account]['gc']['tabbed'] = \
if not gajim.interface.instances[account]['gc'].has_key('tabbed'):
gajim.interface.instances[account]['gc']['tabbed'] = \
groupchat_window.GroupchatWindow(jid, nick, account)
else:
gajim.interface.windows[account]['gc']['tabbed'].new_room(jid, nick)
gajim.interface.windows[account]['gc'][jid] = \
gajim.interface.windows[account]['gc']['tabbed']
gajim.interface.instances[account]['gc']['tabbed'].new_room(jid, nick)
gajim.interface.instances[account]['gc'][jid] = \
gajim.interface.instances[account]['gc']['tabbed']
else:
gajim.interface.windows[account]['gc'][jid] = \
gajim.interface.instances[account]['gc'][jid] = \
groupchat_window.GroupchatWindow(jid, nick, account)
def on_message(self, jid, msg, tim, account, encrypted = False,
@ -1666,12 +1666,12 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
return
# We print if window is opened and it's not a single message
if gajim.interface.windows[account]['chats'].has_key(jid) and \
if gajim.interface.instances[account]['chats'].has_key(jid) and \
msg_type != 'normal':
typ = ''
if msg_type == 'error':
typ = 'status'
gajim.interface.windows[account]['chats'][jid].print_conversation(msg,
gajim.interface.instances[account]['chats'][jid].print_conversation(msg,
jid, typ, tim = tim, encrypted = encrypted, subject = subject)
return
@ -1684,7 +1684,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
qs[jid].append((kind, (msg, subject, msg_type, tim, encrypted)))
self.nb_unread += 1
if popup:
if not gajim.interface.windows[account]['chats'].has_key(jid):
if not gajim.interface.instances[account]['chats'].has_key(jid):
c = gajim.get_contact_instance_with_highest_priority(account, jid)
self.new_chat(c, account)
if path:
@ -1708,10 +1708,10 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
self.tree.set_cursor(path)
def on_preferences_menuitem_activate(self, widget):
if gajim.interface.windows['preferences'].window.get_property('visible'):
gajim.interface.windows['preferences'].window.present()
if gajim.interface.instances['preferences'].window.get_property('visible'):
gajim.interface.instances['preferences'].window.present()
else:
gajim.interface.windows['preferences'].window.show_all()
gajim.interface.instances['preferences'].window.show_all()
def on_add_new_contact(self, widget, account):
dialogs.AddNewContactWindow(account)
@ -1722,12 +1722,12 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
dialogs.ErrorDialog(_('You cannot join a room while you are invisible')
).get_response()
return
if gajim.interface.windows[account].has_key('join_gc'):
gajim.interface.windows[account]['join_gc'].window.present()
if gajim.interface.instances[account].has_key('join_gc'):
gajim.interface.instances[account]['join_gc'].window.present()
else:
# c http://nkour.blogspot.com/2005/05/pythons-init-return-none-doesnt-return.html
try:
gajim.interface.windows[account]['join_gc'] = \
gajim.interface.instances[account]['join_gc'] = \
dialogs.JoinGroupchatWindow(account)
except RuntimeError:
pass
@ -1745,16 +1745,16 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
dialogs.AboutDialog()
def on_accounts_menuitem_activate(self, widget):
if gajim.interface.windows.has_key('accounts'):
gajim.interface.windows['accounts'].window.present()
if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].window.present()
else:
gajim.interface.windows['accounts'] = config.AccountsWindow()
gajim.interface.instances['accounts'] = config.AccountsWindow()
def on_file_transfers_menuitem_activate(self, widget):
if gajim.interface.windows['file_transfers'].window.get_property('visible'):
gajim.interface.windows['file_transfers'].window.present()
if gajim.interface.instances['file_transfers'].window.get_property('visible'):
gajim.interface.instances['file_transfers'].window.present()
else:
gajim.interface.windows['file_transfers'].window.show_all()
gajim.interface.instances['file_transfers'].window.show_all()
def on_manage_bookmarks_menuitem_activate(self, widget):
config.ManageBookmarksWindow()
@ -1840,7 +1840,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
gajim.interface.save_config()
for account in gajim.connections:
gajim.connections[account].quit(True)
self.close_all(gajim.interface.windows)
self.close_all(gajim.interface.instances)
if gajim.interface.systray_enabled:
gajim.interface.hide_systray()
gtk.main_quit()
@ -1862,10 +1862,10 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
if self.nb_unread > 0:
unread = True
for account in accounts:
if gajim.interface.windows[account]['chats'].has_key('tabbed'):
wins = [gajim.interface.windows[account]['chats']['tabbed']]
if gajim.interface.instances[account]['chats'].has_key('tabbed'):
wins = [gajim.interface.instances[account]['chats']['tabbed']]
else:
wins = gajim.interface.windows[account]['chats'].values()
wins = gajim.interface.instances[account]['chats'].values()
for win in wins:
unrd = 0
for jid in win.nb_unread:
@ -1898,7 +1898,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
'''If an event was handled, return True, else return False'''
typ = event[0]
data = event[1]
ft = gajim.interface.windows['file_transfers']
ft = gajim.interface.instances['file_transfers']
if typ == 'normal':
dialogs.SingleMessageWindow(account, jid,
action = 'receive', from_whom = jid, subject = data[1],
@ -1941,7 +1941,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
if first_ev:
if self.open_event(account, jid, first_ev):
return
chats = gajim.interface.windows[account]['chats']
chats = gajim.interface.instances[account]['chats']
if chats.has_key(jid):
chats[jid].set_active_tab(jid)
elif gajim.contacts[account].has_key(jid):
@ -2069,8 +2069,8 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
def on_service_disco_menuitem_activate(self, widget, account):
server_jid = gajim.config.get_per('accounts', account, 'hostname')
if gajim.interface.windows[account]['disco'].has_key(server_jid):
gajim.interface.windows[account]['disco'][server_jid].window.present()
if gajim.interface.instances[account]['disco'].has_key(server_jid):
gajim.interface.instances[account]['disco'][server_jid].window.present()
else:
try:
# Object will add itself to the window dict
@ -2124,25 +2124,25 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
gajim.interface.systray.set_img()
for account in gajim.connections:
# Update opened chat windows
for jid in gajim.interface.windows[account]['chats']:
for jid in gajim.interface.instances[account]['chats']:
if jid != 'tabbed':
gajim.interface.windows[account]['chats'][jid].set_state_image(jid)
gajim.interface.instances[account]['chats'][jid].set_state_image(jid)
# Update opened groupchat windows
for jid in gajim.interface.windows[account]['gc']:
for jid in gajim.interface.instances[account]['gc']:
if jid != 'tabbed':
gajim.interface.windows[account]['gc'][jid].update_state_images()
gajim.interface.instances[account]['gc'][jid].update_state_images()
self.update_status_combobox()
def repaint_themed_widgets(self):
'''Notify windows that contain themed widgets to repaint them'''
for account in gajim.connections:
# Update opened chat windows/tabs
for jid in gajim.interface.windows[account]['chats']:
gajim.interface.windows[account]['chats'][jid].repaint_colored_widgets()
for jid in gajim.interface.windows[account]['gc']:
gajim.interface.windows[account]['gc'][jid].repaint_colored_widgets()
for addr in gajim.interface.windows[account]['disco']:
gajim.interface.windows[account]['disco'][addr].paint_banner()
for jid in gajim.interface.instances[account]['chats']:
gajim.interface.instances[account]['chats'][jid].repaint_colored_widgets()
for jid in gajim.interface.instances[account]['gc']:
gajim.interface.instances[account]['gc'][jid].repaint_colored_widgets()
for addr in gajim.interface.instances[account]['disco']:
gajim.interface.instances[account]['disco'][addr].paint_banner()
def on_show_offline_contacts_menuitem_activate(self, widget):
'''when show offline option is changed:
@ -2615,5 +2615,5 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
gajim.config.set('show_roster_on_startup', True)
if len(gajim.connections) == 0: # if we have no account
gajim.interface.windows['wizard_window'] = \
gajim.interface.instances['wizard_window'] = \
config.AccountCreationWizardWindow()

View File

@ -95,13 +95,13 @@ class Systray:
self.set_img()
def start_chat(self, widget, account, jid):
if gajim.interface.windows[account]['chats'].has_key(jid):
gajim.interface.windows[account]['chats'][jid].window.present()
gajim.interface.windows[account]['chats'][jid].set_active_tab(jid)
if gajim.interface.instances[account]['chats'].has_key(jid):
gajim.interface.instances[account]['chats'][jid].window.present()
gajim.interface.instances[account]['chats'][jid].set_active_tab(jid)
elif gajim.contacts[account].has_key(jid):
gajim.interface.roster.new_chat(
gajim.contacts[account][jid][0], account)
gajim.interface.windows[account]['chats'][jid].set_active_tab(jid)
gajim.interface.instances[account]['chats'][jid].set_active_tab(jid)
def on_new_message_menuitem_activate(self, widget, account):
"""When new message menuitem is activated:
@ -219,10 +219,10 @@ class Systray:
win.present()
def on_preferences_menuitem_activate(self, widget):
if gajim.interface.windows['preferences'].window.get_property('visible'):
gajim.interface.windows['preferences'].window.present()
if gajim.interface.instances['preferences'].window.get_property('visible'):
gajim.interface.instances['preferences'].window.present()
else:
gajim.interface.windows['preferences'].window.show_all()
gajim.interface.instances['preferences'].window.show_all()
def on_quit_menuitem_activate(self, widget):
gajim.interface.roster.on_quit_menuitem_activate(widget)
@ -292,7 +292,7 @@ class Systray:
self.handle_event(account, jid, typ)
def handle_event(self, account, jid, typ):
wins = gajim.interface.windows[account]
wins = gajim.interface.instances[account]
w = None
if typ == 'gc':
if wins['gc'].has_key(jid):

View File

@ -269,7 +269,7 @@ class SystrayWin32(systray.Systray):
for acct in gajim.connections:
# in chat / groupchat windows
for kind in ('chats', 'gc'):
jids = gajim.interface.windows[acct][kind]
jids = gajim.interface.instances[acct][kind]
for jid in jids:
if jid != 'tabbed':
nb += jids[jid].nb_unread[jid]
@ -288,9 +288,9 @@ class SystrayWin32(systray.Systray):
for acct in gajim.connections:
# in chat / groupchat windows
for kind in ('chats', 'gc'):
for jid in gajim.interface.windows[acct][kind]:
for jid in gajim.interface.instances[acct][kind]:
if jid != 'tabbed':
nb += gajim.interface.windows[acct][kind][jid].nb_unread[jid]
nb += gajim.interface.instances[acct][kind][jid].nb_unread[jid]
if nb > 0:
text = i18n.ngettext(

View File

@ -123,7 +123,7 @@ class TabbedChatWindow(chat.Chat):
for uri in uri_splitted:
path = helpers.get_file_path_from_dnd_dropped_uri(uri)
if os.path.isfile(path): # is it file?
gajim.interface.windows['file_transfers'].send_file(self.account,
gajim.interface.instances['file_transfers'].send_file(self.account,
contact, path)
def on_avatar_eventbox_enter_notify_event(self, widget, event):
@ -388,7 +388,7 @@ class TabbedChatWindow(chat.Chat):
# Reset contact chatstates to all open tabs
for jid in self.xmls:
self.contacts[jid].chatstate = None
#clean gajim.interface.windows[self.account]['chats']
#clean gajim.interface.instances[self.account]['chats']
chat.Chat.on_window_destroy(self, widget, 'chats')
def on_tabbed_chat_window_focus_in_event(self, widget, event):
@ -402,7 +402,7 @@ class TabbedChatWindow(chat.Chat):
def on_send_file_menuitem_activate(self, widget):
jid = self.get_active_jid()
contact = gajim.get_first_contact_instance_from_jid(self.account, jid)
gajim.interface.windows['file_transfers'].show_file_send_request(
gajim.interface.instances['file_transfers'].show_file_send_request(
self.account, contact)
def on_add_to_roster_menuitem_activate(self, widget):
@ -800,7 +800,7 @@ class TabbedChatWindow(chat.Chat):
# Is it a pm ?
is_pm = False
room_jid = jid.split('/', 1)[0]
gcs = gajim.interface.windows[self.account]['gc']
gcs = gajim.interface.instances[self.account]['gc']
if gcs.has_key(room_jid):
is_pm = True
events_to_keep = []
@ -836,7 +836,7 @@ class TabbedChatWindow(chat.Chat):
typ = 'chat' # Is it a normal chat or a pm ?
# reset to status image in gc if it is a pm
room_jid = jid.split('/', 1)[0]
gcs = gajim.interface.windows[self.account]['gc']
gcs = gajim.interface.instances[self.account]['gc']
if gcs.has_key(room_jid):
gcs[room_jid].update_state_images()
typ = 'pm'

View File

@ -238,7 +238,7 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
for acct in gajim.connections:
# we count unread chat/pm messages
chat_wins = gajim.interface.windows[acct]['chats']
chat_wins = gajim.interface.instances[acct]['chats']
for jid in chat_wins:
if jid != 'tabbed':
if gajim.contacts[acct].has_key(jid):
@ -246,7 +246,7 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
else:
unread_pm += chat_wins[jid].nb_unread[jid]
# we count unread gc/pm messages
gc_wins = gajim.interface.windows[acct]['gc']
gc_wins = gajim.interface.instances[acct]['gc']
for jid in gc_wins:
if jid != 'tabbed':
pm_msgs = gc_wins[jid].get_specific_unread(jid)

View File

@ -98,7 +98,7 @@ class VcardWindow:
self.window.show_all()
def on_vcard_information_window_destroy(self, widget = None):
del gajim.interface.windows[self.account]['infos'][self.jid]
del gajim.interface.instances[self.account]['infos'][self.jid]
def on_vcard_information_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: