keep namespace when we call a class :

* from xx import yy -> import xx
 * yy() -> xx.yy()
This commit is contained in:
Yann Leboulanger 2005-04-14 17:07:55 +00:00
parent 26df968343
commit 60f2ef8adc
9 changed files with 113 additions and 111 deletions

View File

@ -23,9 +23,7 @@ import pango
import gobject
import time
from dialogs import *
from history_window import *
from common import gajim
from common import i18n
_ = i18n._

View File

@ -505,7 +505,7 @@ class connection:
self.connection.sendPresence(ptype, prio, status, msg, signed)
self.dispatch('STATUS', status)
def send_message(jid, msg, keyID):
def send_message(self, jid, msg, keyID):
if not self.connection:
return
msgtxt = msg

View File

@ -22,6 +22,7 @@ import gtk.glade
import gobject
import os
import common.sleepy
from common import gajim
from common import connection
from common import i18n
_ = i18n._
@ -29,7 +30,7 @@ APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
from dialogs import *
import dialogs
import gtkgui
GTKGUI_GLADE='gtkgui.glade'
@ -374,9 +375,9 @@ class Preferences_window:
def on_play_sounds_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'sounds_on',\
[self.xml.get_widget('soundplayer_hbox'),\
self.xml.get_widget('sounds_scrolledwindow'),\
self.xml.get_widget('browse_sounds_hbox')])
[self.xml.get_widget('soundplayer_hbox'),\
self.xml.get_widget('sounds_scrolledwindow'),\
self.xml.get_widget('browse_sounds_hbox')])
def on_soundplayer_entry_changed(self, widget):
gajim.config.set('soundplayer', widget.get_text())
@ -592,12 +593,12 @@ class Preferences_window:
dialog.set_default_response(gtk.RESPONSE_OK)
filter = gtk.FileFilter()
filter.set_name(_('All files'))
filter.add_pattern("*")
filter.add_pattern('*')
dialog.add_filter(filter)
filter = gtk.FileFilter()
filter.set_name(_('Wav Sounds'))
filter.add_pattern("*.wav")
filter.add_pattern('*.wav')
dialog.add_filter(filter)
dialog.set_filter(filter)
@ -988,7 +989,7 @@ class Account_modification_window:
if gajim.connections.has_key(self.account):
if name != self.account and gajim.connections[self.account].connected \
!= 0:
Error_dialog(_('You must be offline to change the account\'s name'))
dialogs.Error_dialog(_('You must be offline to change the account\'s name'))
return
jid = self.xml.get_widget('jid_entry').get_text()
autoconnect = 0
@ -1015,29 +1016,29 @@ class Account_modification_window:
proxyhost = self.xml.get_widget('proxyhost_entry').get_text()
proxyport = self.xml.get_widget('proxyport_entry').get_text()
if (name == ''):
Error_dialog(_('You must enter a name for this account'))
dialogs.Error_dialog(_('You must enter a name for this account'))
return
if name.find(' ') != -1:
Error_dialog(_('Spaces are not permited in account name'))
dialogs.Error_dialog(_('Spaces are not permited in account name'))
return
if (jid == '') or (jid.count('@') != 1):
Error_dialog(_('You must enter a Jabber ID for this account\nFor example: someone@someserver.org'))
dialogs.Error_dialog(_('You must enter a Jabber ID for this account\nFor example: someone@someserver.org'))
return
if new_account_checkbutton.get_active() and password == '':
Error_dialog(_('You must enter a password to register a new account'))
dialogs.Error_dialog(_('You must enter a password to register a new account'))
return
if use_proxy:
if proxyport != '':
try:
proxyport = int(proxyport)
except ValueError:
Error_dialog(_('Proxy Port must be a port number'))
dialogs.Error_dialog(_('Proxy Port must be a port number'))
return
else:
Error_dialog(_('You must enter a proxy port to use proxy'))
dialogs.Error_dialog(_('You must enter a proxy port to use proxy'))
return
if proxyhost == '':
Error_dialog(_('You must enter a proxy host to use proxy'))
dialogs.Error_dialog(_('You must enter a proxy host to use proxy'))
return
(login, hostname) = jid.split('@')
@ -1120,7 +1121,7 @@ class Account_modification_window:
return
#if it's a new account
if name in gajim.connections:
Error_dialog(_('An account already has this name'))
dialogs.Error_dialog(_('An account already has this name'))
return
gajim.config.add_per('accounts', name)
gajim.connections[name] = connection.connection(name)
@ -1168,7 +1169,7 @@ class Account_modification_window:
self.window.destroy()
def on_change_password_button_clicked(self, widget):
dialog = Change_password_dialog(self.plugin, self.account)
dialog = dialogs.Change_password_dialog(self.plugin, self.account)
new_password = dialog.run()
if new_password != -1:
gajim.connections[self.account].change_password(new_password, \
@ -1231,24 +1232,24 @@ class Account_modification_window:
def on_edit_details_button_clicked(self, widget):
if not self.plugin.windows.has_key(self.account):
Error_dialog(_('You must first create your account before editing your information'))
dialogs.Error_dialog(_('You must first create your account before editing your information'))
return
jid = self.xml.get_widget('jid_entry').get_text()
if gajim.connections[self.account].connected < 2:
Error_dialog(_('You must be connected to edit your information'))
dialogs.Error_dialog(_('You must be connected to edit your information'))
return
if not self.plugin.windows[self.account]['infos'].has_key('vcard'):
self.plugin.windows[self.account]['infos'][jid] = \
vcard_information_window(jid, self.plugin, self.account, True)
dialogs.Vcard_information_window(jid, self.plugin, self.account, True)
gajim.connections[self.account].request_vcard(jid)
def on_gpg_choose_button_clicked(self, widget, data=None):
secret_keys = gajim.connections[self.account].ask_gpg_secrete_keys()
if not secret_keys:
Error_dialog(_('error contacting %s') % service)
dialogs.Error_dialog(_('error contacting %s') % service)
return
secret_keys['None'] = 'None'
w = choose_gpg_key_dialog(secret_keys)
w = dialogs.choose_gpg_key_dialog(secret_keys)
keyID = w.run()
if keyID == -1:
return
@ -1347,7 +1348,7 @@ class Accounts_window:
"""When new button is clicked : open an account information window"""
if not self.plugin.windows.has_key('account_modification_window'):
self.plugin.windows['account_modification'] = \
Account_modification_window(self.plugin, {}) #find out what's wrong
Account_modification_window(self.plugin, {})
else:
self.plugin.windows['account_modification'].window.present()
@ -1357,7 +1358,7 @@ class Accounts_window:
sel = self.accounts_treeview.get_selection()
(model, iter) = sel.get_selected()
account = model.get_value(iter, 0)
dialog = Confirmation_dialog(_('Are you sure you want to remove account (%s) ?') % account)
dialog = dialogs.Confirmation_dialog(_('Are you sure you want to remove account (%s) ?') % account)
if dialog.get_response() == gtk.RESPONSE_YES:
if gajim.connections[account].connected:
gajim.connections[account].change_status('offline', 'offline')
@ -1819,7 +1820,7 @@ class Service_discovery_window:
room = services[0]
service = services[1]
if not self.plugin.windows[self.account].has_key('join_gc'):
Join_groupchat_window(self.plugin, self.account, service, room)
dialog.Join_groupchat_window(self.plugin, self.account, service, room)
else:
self.plugin.windows[self.account]['join_gc'].window.present()
@ -1832,7 +1833,7 @@ class Service_discovery_window:
service = model.get_value(iter, 1)
infos = gajim.connections[self.account].ask_register_agent_info(service)
if not infos.has_key('instructions'):
Error_dialog(_('error contacting %s') % service)
dialog.Error_dialog(_('error contacting %s') % service)
else:
Service_registration_window(service, infos, self.plugin, self.account)
self.window.destroy()
@ -1871,7 +1872,7 @@ class Service_discovery_window:
def __init__(self, plugin, account):
if gajim.connections[account].connected < 2:
Error_dialog(_('You must be connected to browse services'))
dialog.Error_dialog(_('You must be connected to browse services'))
return
xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
self.window = xml.get_widget('service_discovery_window')

View File

@ -23,8 +23,8 @@ import pango
import gobject
import time
from common import gajim
from dialogs import *
from chat import *
import dialogs
import chat
from gtkgui import CellRendererImage
from common import i18n
@ -36,16 +36,15 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE='gtkgui.glade'
class Groupchat_window(Chat):
class Groupchat_window(chat.Chat):
"""Class for Groupchat window"""
def __init__(self, room_jid, nick, plugin, account):
Chat.__init__(self, plugin, account, 'groupchat_window')
chat.Chat.__init__(self, plugin, account, 'groupchat_window')
self.nicks = {}
self.list_treeview = {}
self.subjects = {}
self.new_group(room_jid, nick)
self.show_title()
print "self.xml.get_widget('message_textview') is", self.xml.get_widget('message_textview'), "!!"
self.xml.signal_connect('on_groupchat_window_destroy', \
self.on_groupchat_window_destroy)
self.xml.signal_connect('on_groupchat_window_delete_event', \
@ -65,7 +64,7 @@ class Groupchat_window(Chat):
"""close window"""
for room_jid in self.xmls:
if time.time() - self.last_message_time[room_jid] < 2:
dialog = Confirmation_dialog(_('You received a message in the room %s in the last two seconds.\nDo you still want to close this window?') % \
dialog = dialogs.Confirmation_dialog(_('You received a message in the room %s in the last two seconds.\nDo you still want to close this window?') % \
room_jid.split('@')[0])
if dialog.get_response() != gtk.RESPONSE_YES:
return True #stop the propagation of the event
@ -74,14 +73,14 @@ class Groupchat_window(Chat):
for room_jid in self.xmls:
gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \
room_jid, 'offline', 'offline')
Chat.on_window_destroy(self, widget, 'gc')
chat.Chat.on_window_destroy(self, widget, 'gc')
def on_groupchat_window_focus_in_event(self, widget, event):
"""When window get focus"""
Chat.on_chat_window_focus_in_event(self, widget, event)
chat.Chat.on_chat_window_focus_in_event(self, widget, event)
def on_chat_notebook_key_press_event(self, widget, event):
Chat.on_chat_notebook_key_press_event(self, widget, event)
chat.Chat.on_chat_notebook_key_press_event(self, widget, event)
def on_chat_notebook_switch_page(self, notebook, page, page_num):
new_child = notebook.get_nth_page(page_num)
@ -92,7 +91,7 @@ class Groupchat_window(Chat):
break
self.xml.get_widget('subject_entry').set_text(\
self.subjects[new_jid])
Chat.on_chat_notebook_switch_page(self, notebook, page, page_num)
chat.Chat.on_chat_notebook_switch_page(self, notebook, page, page_num)
def get_role_iter(self, room_jid, role):
model = self.list_treeview[room_jid].get_model()
@ -310,7 +309,7 @@ class Groupchat_window(Chat):
text.lower().split():
other_tags_for_name.append('bold')
Chat.print_conversation_line(self, text, room_jid, kind, contact, tim, \
chat.Chat.print_conversation_line(self, text, room_jid, kind, contact, tim, \
other_tags_for_name)
def kick(self, widget, room_jid, nick):
@ -369,7 +368,8 @@ class Groupchat_window(Chat):
"""Call vcard_information_window class to display user's information"""
if not self.plugin.windows[self.account]['infos'].has_key(jid):
self.plugin.windows[self.account]['infos'][jid] = \
Vcard_information_window(jid, self.plugin, self.account, True)
dialogs.Vcard_information_window(jid, self.plugin, self.account, \
True)
gajim.connections[self.account].request_vcard(jid)
#FIXME: maybe use roster.on_info above?
@ -442,12 +442,12 @@ class Groupchat_window(Chat):
def remove_tab(self, room_jid):
if time.time() - self.last_message_time[room_jid] < 2:
dialog = Confirmation_dialog(_('You received a message in the room %s in the last two seconds.\nDo you still want to close this tab?') % \
dialog = dialogs.Confirmation_dialog(_('You received a message in the room %s in the last two seconds.\nDo you still want to close this tab?') % \
room_jid.split('@')[0])
if dialog.get_response() != gtk.RESPONSE_YES:
return
Chat.remove_tab(self, room_jid, 'gc')
chat.Chat.remove_tab(self, room_jid, 'gc')
if len(self.xmls) > 0:
gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \
room_jid, 'offline', 'offline')
@ -459,7 +459,7 @@ class Groupchat_window(Chat):
self.names[room_jid] = room_jid.split('@')[0]
self.xmls[room_jid] = gtk.glade.XML(GTKGUI_GLADE, 'gc_vbox', APP)
self.childs[room_jid] = self.xmls[room_jid].get_widget('gc_vbox')
Chat.new_tab(self, room_jid)
chat.Chat.new_tab(self, room_jid)
self.nicks[room_jid] = nick
self.subjects[room_jid] = ''
self.list_treeview[room_jid] = self.xmls[room_jid].\

View File

@ -162,13 +162,10 @@ class User:
self.keyID = args[9]
else: raise TypeError, _('bad arguments')
from tabbed_chat_window import *
from groupchat_window import *
from history_window import *
from roster_window import *
from systray import *
from dialogs import *
from config import *
import roster_window
import systray
import dialogs
import config
GTKGUI_GLADE='gtkgui.glade'
@ -232,10 +229,10 @@ class interface:
self.roster.draw_roster()
def handle_event_warning(self, unused, msg):
Warning_dialog(msg)
dialogs.Warning_dialog(msg)
def handle_event_error(self, unused, msg):
Error_dialog(msg)
dialogs.Error_dialog(msg)
def handle_event_status(self, account, status): # OUR status
#('STATUS', account, status)
@ -328,7 +325,8 @@ class interface:
#gajim doesn't give a shit
# WHY? same with offline
# new message works
instance = Popup_window(self, 'Contact Online', jid, account)
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
account)
self.roster.popup_windows.append(instance)
elif old_show > 1 and new_show < 2 and gajim.config.get( \
'sound_contact_disconnected'):
@ -336,7 +334,8 @@ class interface:
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and not gajim.config.get( \
'autopopup'):
instance = Popup_window(self, 'Contact Offline', jid, account)
instance = dialogs.Popup_window(self, 'Contact Offline', jid, \
account)
self.roster.popup_windows.append(instance)
elif self.windows[account]['gc'].has_key(ji):
@ -359,7 +358,7 @@ class interface:
not self.queues[account].has_key(jid):
first = True
if not gajim.config.get('autopopup'):
instance = Popup_window(self, 'New Message', jid, account)
instance = dialogs.Popup_window(self, 'New Message', jid, account)
self.roster.popup_windows.append(instance)
self.roster.on_message(jid, array[1], array[2], account)
if gajim.config.get('sound_first_message_received') and first:
@ -382,7 +381,7 @@ class interface:
def handle_event_subscribe(self, account, array):
#('SUBSCRIBE', account, (jid, text))
subscription_request_window(self, array[0], array[1], account)
dialogs.subscription_request_window(self, array[0], array[1], account)
def handle_event_subscribed(self, account, array):
#('SUBSCRIBED', account, (jid, resource))
@ -402,10 +401,10 @@ class interface:
'online', 'to', '', array[1], 0, '')
self.roster.contacts[account][jid] = [user1]
self.roster.add_user_to_roster(jid, account)
Information_dialog(_("You are now authorized by %s") % jid)
dialogs.Information_dialog(_('You are now authorized by %s') % jid)
def handle_event_unsubscribed(self, account, jid):
Information_dialog(_("You are now unsubscribed by %s") % jid)
dialogs.Information_dialog(_('You are now unsubscribed by %s') % jid)
def handle_event_agent_info(self, account, array):
#('AGENT_INFO', account, (agent, identities, features, items))
@ -445,8 +444,9 @@ class interface:
self.nicks[name] = array[1]
self.roster.groups[name] = {}
self.roster.contacts[name] = {}
self.roster.newly_added[name] = []
self.roster.to_be_removed[name] = []
self.sleeper_state[name] = 0
#FIXME: add missing to_be_deleted for ex
if self.windows.has_key('accounts'):
self.windows['accounts'].init_accounts()
self.roster.draw_roster()
@ -498,7 +498,7 @@ class interface:
'%s has set the subject to %s' % (jids[1], array[1]), jid)
def handle_event_bad_passphrase(self, account, array):
Warning_dialog(_("Your GPG passphrase is wrong, so you are connected without your GPG key."))
dialogs.Warning_dialog(_('Your GPG passphrase is wrong, so you are connected without your GPG key.'))
def handle_event_roster_info(self, account, array):
#('ROSTER_INFO', account, (jid, name, sub, ask, groups))
@ -682,7 +682,7 @@ class interface:
def process_connections(self):
for account in gajim.connections:
if gajim.connections[account].connected:
gajim.connections[account].connection.process(1)
gajim.connections[account].connection.process(0.01)
return True
def __init__(self):
@ -712,7 +712,7 @@ class interface:
break
if pix:
gtk.window_set_default_icon(pix)
self.roster = Roster_window(self)
self.roster = roster_window.Roster_window(self)
self.sleeper = common.sleepy.Sleepy( \
gajim.config.get('autoawaytime')*60, \
gajim.config.get('autoxatime')*60)
@ -726,19 +726,19 @@ class interface:
self.systray_capabilities = False
else:
self.systray_capabilities = True
self.systray = Systray(self)
self.systray = systray.Systray(self)
else:
self.systray_capabilities = True
self.systray = Systray(self)
self.systray = systray.Systray(self)
if self.systray_capabilities:
self.show_systray()
self.init_regexp()
# get instances for windows/dialogs that will show_all()/hide()
self.windows['preferences'] = Preferences_window(self)
self.windows['preferences'] = config.Preferences_window(self)
self.windows['add_remove_emoticons_window'] = \
Add_remove_emoticons_window(self)
config.Add_remove_emoticons_window(self)
self.windows['roster'] = self.roster
for account in gajim.connections:
@ -746,7 +746,7 @@ class interface:
gobject.timeout_add(100, self.autoconnect)
gobject.timeout_add(500, self.read_sleepy)
gobject.timeout_add(50, self.process_connections)
gobject.timeout_add(200, self.process_connections)
if __name__ == '__main__':
try: # Import Psyco if available

View File

@ -31,7 +31,7 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE='gtkgui.glade'
class history_window:
class History_window:
"""Class for bowser agent window:
to know the agents on the selected server"""
def on_history_window_destroy(self, widget):

View File

@ -26,12 +26,12 @@ import Queue
import common.sleepy
from common import gajim
from tabbed_chat_window import *
from groupchat_window import *
from history_window import *
import tabbed_chat_window
import groupchat_window
import history_window
from gtkgui import CellRendererImage, User
import dialogs
from config import *
import config
from common import i18n
@ -404,7 +404,7 @@ class Roster_window:
self.plugin.windows[account]['infos'][user.jid].window.present()
else:
self.plugin.windows[account]['infos'][user.jid] = \
Vcard_information_window(user, self.plugin, account)
dialogs.Vcard_information_window(user, self.plugin, account)
def on_agent_logging(self, widget, jid, state, account):
"""When an agent is requested to log in or off"""
@ -412,7 +412,7 @@ class Roster_window:
def on_remove_agent(self, widget, jid, account):
"""When an agent is requested to log in or off"""
window = Confirmation_dialog(_('Are you sure you want to remove the agent %s from your roster?') % jid)
window = dialogs.Confirmation_dialog(_('Are you sure you want to remove the agent %s from your roster?') % jid)
if window.get_response() == gtk.RESPONSE_YES:
gajim.connections[account].unsubscribe_agent(jid)
for u in self.contacts[account][jid]:
@ -425,14 +425,14 @@ class Roster_window:
self.tree.set_cursor(path, self.tree.get_column(0), True)
def on_edit_groups(self, widget, user, account):
dlg = Edit_groups_dialog(user, account, self.plugin)
dlg = dialogs.Edit_groups_dialog(user, account, self.plugin)
dlg.run()
def on_history(self, widget, user):
"""When history button is pressed : call log window"""
if not self.plugin.windows['logs'].has_key(user.jid):
self.plugin.windows['logs'][user.jid] = history_window(self.plugin, \
user.jid)
self.plugin.windows['logs'][user.jid] = history_window.\
History_window(self.plugin, user.jid)
def mk_menu_user(self, event, iter):
"""Make user's popup menu"""
@ -537,7 +537,7 @@ class Roster_window:
infos['jid'] = self.plugin.accounts[account]["name"] + \
'@' + self.plugin.accounts[account]["hostname"]
self.plugin.windows['account_modification'] = \
Account_modification_window(self.plugin, infos)
config.Account_modification_window(self.plugin, infos)
def mk_menu_account(self, event, iter):
"""Make account's popup menu"""
@ -683,7 +683,7 @@ class Roster_window:
def on_req_usub(self, widget, user, account):
"""Remove a user"""
window = Confirmation_dialog(_("Are you sure you want to remove %s (%s) from your roster?") % (user.name, user.jid))
window = dialogs.Confirmation_dialog(_("Are you sure you want to remove %s (%s) from your roster?") % (user.name, user.jid))
if window.get_response() == gtk.RESPONSE_YES:
gajim.connections[account].unsubscribe(user.jid)
for u in self.contacts[account][user.jid]:
@ -759,7 +759,8 @@ class Roster_window:
if (status == 'online' and not gajim.config.get('ask_online_status')) or \
(status == 'offline' and not gajim.config.get('ask_offline_status')):
return status
dlg = Change_status_message_dialog(self.plugin, status, autoconnect)
dlg = dialogs.Change_status_message_dialog(self.plugin, status, \
autoconnect)
message = dlg.run()
return message
@ -777,7 +778,7 @@ class Roster_window:
return
accounts = gajim.connections.keys()
if len(accounts) == 0:
Error_dialog(_('You must create an account before connecting to jabber network.'))
dialogs.Error_dialog(_('You must create an account before connecting to jabber network.'))
self.update_status_comboxbox()
return
status = model[active][2]
@ -839,7 +840,7 @@ class Roster_window:
if gajim.config.get('usetabbedchat'):
if not self.plugin.windows[account]['chats'].has_key('tabbed'):
self.plugin.windows[account]['chats']['tabbed'] = \
Tabbed_chat_window(user, self.plugin, account)
tabbed_chat_window.Tabbed_chat_window(user, self.plugin, account)
else:
self.plugin.windows[account]['chats']['tabbed'].new_user(user)
@ -849,13 +850,14 @@ class Roster_window:
else:
self.plugin.windows[account]['chats'][user.jid] = \
Tabbed_chat_window(user, self.plugin, account)
tabbed_chat_window.Tabbed_chat_window(user, self.plugin, account)
def new_group(self, jid, nick, account):
if gajim.config.get('usetabbedchat'):
if not self.plugin.windows[account]['gc'].has_key('tabbed'):
self.plugin.windows[account]['gc']['tabbed'] = \
Groupchat_window(jid, nick, self.plugin, account)
groupchat_window.Groupchat_window(jid, nick, self.plugin, \
account)
else:
self.plugin.windows[account]['gc']['tabbed'].new_group(jid, nick)
self.plugin.windows[account]['gc'][jid] = \
@ -864,7 +866,7 @@ class Roster_window:
self.plugin.windows[account]['gc']['tabbed'].active_tab(jid)
else:
self.plugin.windows[account]['gc'][jid] = \
Groupchat_window(jid, nick, self.plugin, account)
groupchat_window.Groupchat_window(jid, nick, self.plugin, account)
def on_message(self, jid, msg, tim, account):
"""when we receive a message"""
@ -919,25 +921,25 @@ class Roster_window:
self.plugin.windows['preferences'].window.show_all()
def on_add_new_contact(self, widget, account):
Add_new_contact_window(self.plugin, account)
dialogs.Add_new_contact_window(self.plugin, account)
def on_join_gc_activate(self, widget, account):
if not self.plugin.windows[account].has_key('join_gc'):
Join_groupchat_window(self.plugin, account)
dialogs.Join_groupchat_window(self.plugin, account)
else:
self.plugin.windows[account]['join_gc'].window.present()
def on_new_message_menuitem_activate(self, widget, account):
New_message_dialog(self.plugin, account)
dialogs.New_message_dialog(self.plugin, account)
def on_about_menuitem_activate(self, widget):
About_dialog()
dialogs.About_dialog()
def on_accounts_menuitem_activate(self, widget):
if self.plugin.windows.has_key('accounts'):
self.plugin.windows['accounts'].present()
else:
self.plugin.windows['accounts'] = Accounts_window(self.plugin)
self.plugin.windows['accounts'] = config.Accounts_window(self.plugin)
def close_all(self, dic):
"""close all the windows in the given dictionary"""
@ -1107,7 +1109,7 @@ class Roster_window:
self.plugin.windows[account]['disco'].present()
else:
self.plugin.windows[account]['disco'] = \
Service_discovery_window(self.plugin, account)
config.Service_discovery_window(self.plugin, account)
def mkpixbufs(self):
"""initialise pixbufs array"""
@ -1425,4 +1427,4 @@ class Roster_window:
self.draw_roster()
if len(gajim.connections) == 0: # if no account
self.plugin.windows['account_modification'] = \
Account_modification_window(self.plugin, {})
config.Account_modification_window(self.plugin, {})

View File

@ -19,7 +19,7 @@
import gtk
import gtk.glade
from dialogs import *
import dialogs
from common import i18n
@ -99,7 +99,7 @@ class Systray:
def on_new_message_menuitem_activate(self, widget, account):
"""When new message menuitem is activated:
call the New_message_dialog class"""
New_message_dialog(self.plugin, account)
dialogs.New_message_dialog(self.plugin, account)
def make_menu(self, event):
"""create chat with and new message (sub) menus/menuitems"""

View File

@ -24,9 +24,9 @@ import gobject
import time
from common import gajim
from dialogs import *
from history_window import *
from chat import *
import dialogs
import history_window
import chat
from common import i18n
@ -37,10 +37,10 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE='gtkgui.glade'
class Tabbed_chat_window(Chat):
class Tabbed_chat_window(chat.Chat):
"""Class for tabbed chat window"""
def __init__(self, user, plugin, account):
Chat.__init__(self, plugin, account, 'tabbed_chat_window')
chat.Chat.__init__(self, plugin, account, 'tabbed_chat_window')
self.users = {}
self.new_user(user)
self.show_title()
@ -90,19 +90,19 @@ class Tabbed_chat_window(Chat):
"""close window"""
for jid in self.users:
if time.time() - self.last_message_time[jid] < 2: # 2 seconds
dialog = Confirmation_dialog(_('You received a message from %s in the last two seconds.\nDo you still want to close this window ?') % jid)
dialog = dialogs.Confirmation_dialog(_('You received a message from %s in the last two seconds.\nDo you still want to close this window ?') % jid)
if dialog.get_response() != gtk.RESPONSE_YES:
return True #stop the propagation of the event
def on_tabbed_chat_window_destroy(self, widget):
#clean self.plugin.windows[self.account]['chats']
Chat.on_window_destroy(self, widget, 'chats')
chat.Chat.on_window_destroy(self, widget, 'chats')
def on_tabbed_chat_window_focus_in_event(self, widget, event):
Chat.on_chat_window_focus_in_event(self, widget, event)
chat.Chat.on_chat_window_focus_in_event(self, widget, event)
def on_chat_notebook_key_press_event(self, widget, event):
Chat.on_chat_notebook_key_press_event(self, widget, event)
chat.Chat.on_chat_notebook_key_press_event(self, widget, event)
def on_clear_button_clicked(self, widget):
"""When clear button is pressed :
@ -117,15 +117,16 @@ class Tabbed_chat_window(Chat):
"""When history button is pressed : call history window"""
jid = self.get_active_jid()
if not self.plugin.windows['logs'].has_key(jid):
self.plugin.windows['logs'][jid] = history_window(self.plugin, jid)
self.plugin.windows['logs'][jid] = history_window.\
History_window(self.plugin, jid)
def remove_tab(self, jid):
if time.time() - self.last_message_time[jid] < 2:
dialog = Confirmation_dialog(_('You received a message from %s in the last two seconds.\nDo you still want to close this tab?') % jid)
dialog = dialogs.Confirmation_dialog(_('You received a message from %s in the last two seconds.\nDo you still want to close this tab?') % jid)
if dialog.get_response() != gtk.RESPONSE_YES:
return
Chat.remove_tab(self, jid, 'chats')
chat.Chat.remove_tab(self, jid, 'chats')
if len(self.xmls) > 0:
del self.users[jid]
@ -133,7 +134,7 @@ class Tabbed_chat_window(Chat):
self.names[user.jid] = user.name
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chats_vbox', APP)
self.childs[user.jid] = self.xmls[user.jid].get_widget('chats_vbox')
Chat.new_tab(self, user.jid)
chat.Chat.new_tab(self, user.jid)
self.users[user.jid] = user
self.redraw_tab(user.jid)
@ -177,7 +178,7 @@ class Tabbed_chat_window(Chat):
if (event.state & gtk.gdk.SHIFT_MASK):
return False
if gajim.connections[self.account].connected < 2: #we are not connected
Error_dialog(_('You are not connected, so you cannot send a message'))
dialogs.Error_dialog(_('You are not connected, so you cannot send a message'))
return True
message_buffer = widget.get_buffer()
start_iter = message_buffer.get_start_iter()
@ -235,4 +236,4 @@ class Tabbed_chat_window(Chat):
kind = 'incoming'
name = user.name
Chat.print_conversation_line(self, text, jid, kind, name, tim)
chat.Chat.print_conversation_line(self, text, jid, kind, name, tim)