keep namespace when we call a class :
* from xx import yy -> import xx * yy() -> xx.yy()
This commit is contained in:
parent
26df968343
commit
60f2ef8adc
|
@ -23,9 +23,7 @@ import pango
|
||||||
import gobject
|
import gobject
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from dialogs import *
|
from common import gajim
|
||||||
from history_window import *
|
|
||||||
|
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
|
|
|
@ -505,7 +505,7 @@ class connection:
|
||||||
self.connection.sendPresence(ptype, prio, status, msg, signed)
|
self.connection.sendPresence(ptype, prio, status, msg, signed)
|
||||||
self.dispatch('STATUS', status)
|
self.dispatch('STATUS', status)
|
||||||
|
|
||||||
def send_message(jid, msg, keyID):
|
def send_message(self, jid, msg, keyID):
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
return
|
return
|
||||||
msgtxt = msg
|
msgtxt = msg
|
||||||
|
|
|
@ -22,6 +22,7 @@ import gtk.glade
|
||||||
import gobject
|
import gobject
|
||||||
import os
|
import os
|
||||||
import common.sleepy
|
import common.sleepy
|
||||||
|
from common import gajim
|
||||||
from common import connection
|
from common import connection
|
||||||
from common import i18n
|
from common import i18n
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
|
@ -29,7 +30,7 @@ APP = i18n.APP
|
||||||
gtk.glade.bindtextdomain (APP, i18n.DIR)
|
gtk.glade.bindtextdomain (APP, i18n.DIR)
|
||||||
gtk.glade.textdomain (APP)
|
gtk.glade.textdomain (APP)
|
||||||
|
|
||||||
from dialogs import *
|
import dialogs
|
||||||
import gtkgui
|
import gtkgui
|
||||||
|
|
||||||
GTKGUI_GLADE='gtkgui.glade'
|
GTKGUI_GLADE='gtkgui.glade'
|
||||||
|
@ -592,12 +593,12 @@ class Preferences_window:
|
||||||
dialog.set_default_response(gtk.RESPONSE_OK)
|
dialog.set_default_response(gtk.RESPONSE_OK)
|
||||||
filter = gtk.FileFilter()
|
filter = gtk.FileFilter()
|
||||||
filter.set_name(_('All files'))
|
filter.set_name(_('All files'))
|
||||||
filter.add_pattern("*")
|
filter.add_pattern('*')
|
||||||
dialog.add_filter(filter)
|
dialog.add_filter(filter)
|
||||||
|
|
||||||
filter = gtk.FileFilter()
|
filter = gtk.FileFilter()
|
||||||
filter.set_name(_('Wav Sounds'))
|
filter.set_name(_('Wav Sounds'))
|
||||||
filter.add_pattern("*.wav")
|
filter.add_pattern('*.wav')
|
||||||
dialog.add_filter(filter)
|
dialog.add_filter(filter)
|
||||||
dialog.set_filter(filter)
|
dialog.set_filter(filter)
|
||||||
|
|
||||||
|
@ -988,7 +989,7 @@ class Account_modification_window:
|
||||||
if gajim.connections.has_key(self.account):
|
if gajim.connections.has_key(self.account):
|
||||||
if name != self.account and gajim.connections[self.account].connected \
|
if name != self.account and gajim.connections[self.account].connected \
|
||||||
!= 0:
|
!= 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
|
return
|
||||||
jid = self.xml.get_widget('jid_entry').get_text()
|
jid = self.xml.get_widget('jid_entry').get_text()
|
||||||
autoconnect = 0
|
autoconnect = 0
|
||||||
|
@ -1015,29 +1016,29 @@ class Account_modification_window:
|
||||||
proxyhost = self.xml.get_widget('proxyhost_entry').get_text()
|
proxyhost = self.xml.get_widget('proxyhost_entry').get_text()
|
||||||
proxyport = self.xml.get_widget('proxyport_entry').get_text()
|
proxyport = self.xml.get_widget('proxyport_entry').get_text()
|
||||||
if (name == ''):
|
if (name == ''):
|
||||||
Error_dialog(_('You must enter a name for this account'))
|
dialogs.Error_dialog(_('You must enter a name for this account'))
|
||||||
return
|
return
|
||||||
if name.find(' ') != -1:
|
if name.find(' ') != -1:
|
||||||
Error_dialog(_('Spaces are not permited in account name'))
|
dialogs.Error_dialog(_('Spaces are not permited in account name'))
|
||||||
return
|
return
|
||||||
if (jid == '') or (jid.count('@') != 1):
|
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
|
return
|
||||||
if new_account_checkbutton.get_active() and password == '':
|
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
|
return
|
||||||
if use_proxy:
|
if use_proxy:
|
||||||
if proxyport != '':
|
if proxyport != '':
|
||||||
try:
|
try:
|
||||||
proxyport = int(proxyport)
|
proxyport = int(proxyport)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
Error_dialog(_('Proxy Port must be a port number'))
|
dialogs.Error_dialog(_('Proxy Port must be a port number'))
|
||||||
return
|
return
|
||||||
else:
|
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
|
return
|
||||||
if proxyhost == '':
|
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
|
return
|
||||||
|
|
||||||
(login, hostname) = jid.split('@')
|
(login, hostname) = jid.split('@')
|
||||||
|
@ -1120,7 +1121,7 @@ class Account_modification_window:
|
||||||
return
|
return
|
||||||
#if it's a new account
|
#if it's a new account
|
||||||
if name in gajim.connections:
|
if name in gajim.connections:
|
||||||
Error_dialog(_('An account already has this name'))
|
dialogs.Error_dialog(_('An account already has this name'))
|
||||||
return
|
return
|
||||||
gajim.config.add_per('accounts', name)
|
gajim.config.add_per('accounts', name)
|
||||||
gajim.connections[name] = connection.connection(name)
|
gajim.connections[name] = connection.connection(name)
|
||||||
|
@ -1168,7 +1169,7 @@ class Account_modification_window:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_change_password_button_clicked(self, widget):
|
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()
|
new_password = dialog.run()
|
||||||
if new_password != -1:
|
if new_password != -1:
|
||||||
gajim.connections[self.account].change_password(new_password, \
|
gajim.connections[self.account].change_password(new_password, \
|
||||||
|
@ -1231,24 +1232,24 @@ class Account_modification_window:
|
||||||
|
|
||||||
def on_edit_details_button_clicked(self, widget):
|
def on_edit_details_button_clicked(self, widget):
|
||||||
if not self.plugin.windows.has_key(self.account):
|
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
|
return
|
||||||
jid = self.xml.get_widget('jid_entry').get_text()
|
jid = self.xml.get_widget('jid_entry').get_text()
|
||||||
if gajim.connections[self.account].connected < 2:
|
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
|
return
|
||||||
if not self.plugin.windows[self.account]['infos'].has_key('vcard'):
|
if not self.plugin.windows[self.account]['infos'].has_key('vcard'):
|
||||||
self.plugin.windows[self.account]['infos'][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)
|
gajim.connections[self.account].request_vcard(jid)
|
||||||
|
|
||||||
def on_gpg_choose_button_clicked(self, widget, data=None):
|
def on_gpg_choose_button_clicked(self, widget, data=None):
|
||||||
secret_keys = gajim.connections[self.account].ask_gpg_secrete_keys()
|
secret_keys = gajim.connections[self.account].ask_gpg_secrete_keys()
|
||||||
if not secret_keys:
|
if not secret_keys:
|
||||||
Error_dialog(_('error contacting %s') % service)
|
dialogs.Error_dialog(_('error contacting %s') % service)
|
||||||
return
|
return
|
||||||
secret_keys['None'] = 'None'
|
secret_keys['None'] = 'None'
|
||||||
w = choose_gpg_key_dialog(secret_keys)
|
w = dialogs.choose_gpg_key_dialog(secret_keys)
|
||||||
keyID = w.run()
|
keyID = w.run()
|
||||||
if keyID == -1:
|
if keyID == -1:
|
||||||
return
|
return
|
||||||
|
@ -1347,7 +1348,7 @@ class Accounts_window:
|
||||||
"""When new button is clicked : open an account information window"""
|
"""When new button is clicked : open an account information window"""
|
||||||
if not self.plugin.windows.has_key('account_modification_window'):
|
if not self.plugin.windows.has_key('account_modification_window'):
|
||||||
self.plugin.windows['account_modification'] = \
|
self.plugin.windows['account_modification'] = \
|
||||||
Account_modification_window(self.plugin, {}) #find out what's wrong
|
Account_modification_window(self.plugin, {})
|
||||||
else:
|
else:
|
||||||
self.plugin.windows['account_modification'].window.present()
|
self.plugin.windows['account_modification'].window.present()
|
||||||
|
|
||||||
|
@ -1357,7 +1358,7 @@ class Accounts_window:
|
||||||
sel = self.accounts_treeview.get_selection()
|
sel = self.accounts_treeview.get_selection()
|
||||||
(model, iter) = sel.get_selected()
|
(model, iter) = sel.get_selected()
|
||||||
account = model.get_value(iter, 0)
|
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 dialog.get_response() == gtk.RESPONSE_YES:
|
||||||
if gajim.connections[account].connected:
|
if gajim.connections[account].connected:
|
||||||
gajim.connections[account].change_status('offline', 'offline')
|
gajim.connections[account].change_status('offline', 'offline')
|
||||||
|
@ -1819,7 +1820,7 @@ class Service_discovery_window:
|
||||||
room = services[0]
|
room = services[0]
|
||||||
service = services[1]
|
service = services[1]
|
||||||
if not self.plugin.windows[self.account].has_key('join_gc'):
|
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:
|
else:
|
||||||
self.plugin.windows[self.account]['join_gc'].window.present()
|
self.plugin.windows[self.account]['join_gc'].window.present()
|
||||||
|
|
||||||
|
@ -1832,7 +1833,7 @@ class Service_discovery_window:
|
||||||
service = model.get_value(iter, 1)
|
service = model.get_value(iter, 1)
|
||||||
infos = gajim.connections[self.account].ask_register_agent_info(service)
|
infos = gajim.connections[self.account].ask_register_agent_info(service)
|
||||||
if not infos.has_key('instructions'):
|
if not infos.has_key('instructions'):
|
||||||
Error_dialog(_('error contacting %s') % service)
|
dialog.Error_dialog(_('error contacting %s') % service)
|
||||||
else:
|
else:
|
||||||
Service_registration_window(service, infos, self.plugin, self.account)
|
Service_registration_window(service, infos, self.plugin, self.account)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
@ -1871,7 +1872,7 @@ class Service_discovery_window:
|
||||||
|
|
||||||
def __init__(self, plugin, account):
|
def __init__(self, plugin, account):
|
||||||
if gajim.connections[account].connected < 2:
|
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
|
return
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
|
||||||
self.window = xml.get_widget('service_discovery_window')
|
self.window = xml.get_widget('service_discovery_window')
|
||||||
|
|
|
@ -23,8 +23,8 @@ import pango
|
||||||
import gobject
|
import gobject
|
||||||
import time
|
import time
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from dialogs import *
|
import dialogs
|
||||||
from chat import *
|
import chat
|
||||||
from gtkgui import CellRendererImage
|
from gtkgui import CellRendererImage
|
||||||
|
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
@ -36,16 +36,15 @@ gtk.glade.textdomain(APP)
|
||||||
|
|
||||||
GTKGUI_GLADE='gtkgui.glade'
|
GTKGUI_GLADE='gtkgui.glade'
|
||||||
|
|
||||||
class Groupchat_window(Chat):
|
class Groupchat_window(chat.Chat):
|
||||||
"""Class for Groupchat window"""
|
"""Class for Groupchat window"""
|
||||||
def __init__(self, room_jid, nick, plugin, account):
|
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.nicks = {}
|
||||||
self.list_treeview = {}
|
self.list_treeview = {}
|
||||||
self.subjects = {}
|
self.subjects = {}
|
||||||
self.new_group(room_jid, nick)
|
self.new_group(room_jid, nick)
|
||||||
self.show_title()
|
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.xml.signal_connect('on_groupchat_window_destroy', \
|
||||||
self.on_groupchat_window_destroy)
|
self.on_groupchat_window_destroy)
|
||||||
self.xml.signal_connect('on_groupchat_window_delete_event', \
|
self.xml.signal_connect('on_groupchat_window_delete_event', \
|
||||||
|
@ -65,7 +64,7 @@ class Groupchat_window(Chat):
|
||||||
"""close window"""
|
"""close window"""
|
||||||
for room_jid in self.xmls:
|
for room_jid in self.xmls:
|
||||||
if time.time() - self.last_message_time[room_jid] < 2:
|
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])
|
room_jid.split('@')[0])
|
||||||
if dialog.get_response() != gtk.RESPONSE_YES:
|
if dialog.get_response() != gtk.RESPONSE_YES:
|
||||||
return True #stop the propagation of the event
|
return True #stop the propagation of the event
|
||||||
|
@ -74,14 +73,14 @@ class Groupchat_window(Chat):
|
||||||
for room_jid in self.xmls:
|
for room_jid in self.xmls:
|
||||||
gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \
|
gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \
|
||||||
room_jid, 'offline', 'offline')
|
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):
|
def on_groupchat_window_focus_in_event(self, widget, event):
|
||||||
"""When window get focus"""
|
"""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):
|
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):
|
def on_chat_notebook_switch_page(self, notebook, page, page_num):
|
||||||
new_child = notebook.get_nth_page(page_num)
|
new_child = notebook.get_nth_page(page_num)
|
||||||
|
@ -92,7 +91,7 @@ class Groupchat_window(Chat):
|
||||||
break
|
break
|
||||||
self.xml.get_widget('subject_entry').set_text(\
|
self.xml.get_widget('subject_entry').set_text(\
|
||||||
self.subjects[new_jid])
|
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):
|
def get_role_iter(self, room_jid, role):
|
||||||
model = self.list_treeview[room_jid].get_model()
|
model = self.list_treeview[room_jid].get_model()
|
||||||
|
@ -310,7 +309,7 @@ class Groupchat_window(Chat):
|
||||||
text.lower().split():
|
text.lower().split():
|
||||||
other_tags_for_name.append('bold')
|
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)
|
other_tags_for_name)
|
||||||
|
|
||||||
def kick(self, widget, room_jid, nick):
|
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"""
|
"""Call vcard_information_window class to display user's information"""
|
||||||
if not self.plugin.windows[self.account]['infos'].has_key(jid):
|
if not self.plugin.windows[self.account]['infos'].has_key(jid):
|
||||||
self.plugin.windows[self.account]['infos'][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)
|
gajim.connections[self.account].request_vcard(jid)
|
||||||
#FIXME: maybe use roster.on_info above?
|
#FIXME: maybe use roster.on_info above?
|
||||||
|
|
||||||
|
@ -442,12 +442,12 @@ class Groupchat_window(Chat):
|
||||||
|
|
||||||
def remove_tab(self, room_jid):
|
def remove_tab(self, room_jid):
|
||||||
if time.time() - self.last_message_time[room_jid] < 2:
|
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])
|
room_jid.split('@')[0])
|
||||||
if dialog.get_response() != gtk.RESPONSE_YES:
|
if dialog.get_response() != gtk.RESPONSE_YES:
|
||||||
return
|
return
|
||||||
|
|
||||||
Chat.remove_tab(self, room_jid, 'gc')
|
chat.Chat.remove_tab(self, room_jid, 'gc')
|
||||||
if len(self.xmls) > 0:
|
if len(self.xmls) > 0:
|
||||||
gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \
|
gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \
|
||||||
room_jid, 'offline', 'offline')
|
room_jid, 'offline', 'offline')
|
||||||
|
@ -459,7 +459,7 @@ class Groupchat_window(Chat):
|
||||||
self.names[room_jid] = room_jid.split('@')[0]
|
self.names[room_jid] = room_jid.split('@')[0]
|
||||||
self.xmls[room_jid] = gtk.glade.XML(GTKGUI_GLADE, 'gc_vbox', APP)
|
self.xmls[room_jid] = gtk.glade.XML(GTKGUI_GLADE, 'gc_vbox', APP)
|
||||||
self.childs[room_jid] = self.xmls[room_jid].get_widget('gc_vbox')
|
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.nicks[room_jid] = nick
|
||||||
self.subjects[room_jid] = ''
|
self.subjects[room_jid] = ''
|
||||||
self.list_treeview[room_jid] = self.xmls[room_jid].\
|
self.list_treeview[room_jid] = self.xmls[room_jid].\
|
||||||
|
|
|
@ -162,13 +162,10 @@ class User:
|
||||||
self.keyID = args[9]
|
self.keyID = args[9]
|
||||||
else: raise TypeError, _('bad arguments')
|
else: raise TypeError, _('bad arguments')
|
||||||
|
|
||||||
from tabbed_chat_window import *
|
import roster_window
|
||||||
from groupchat_window import *
|
import systray
|
||||||
from history_window import *
|
import dialogs
|
||||||
from roster_window import *
|
import config
|
||||||
from systray import *
|
|
||||||
from dialogs import *
|
|
||||||
from config import *
|
|
||||||
|
|
||||||
GTKGUI_GLADE='gtkgui.glade'
|
GTKGUI_GLADE='gtkgui.glade'
|
||||||
|
|
||||||
|
@ -232,10 +229,10 @@ class interface:
|
||||||
self.roster.draw_roster()
|
self.roster.draw_roster()
|
||||||
|
|
||||||
def handle_event_warning(self, unused, msg):
|
def handle_event_warning(self, unused, msg):
|
||||||
Warning_dialog(msg)
|
dialogs.Warning_dialog(msg)
|
||||||
|
|
||||||
def handle_event_error(self, unused, msg):
|
def handle_event_error(self, unused, msg):
|
||||||
Error_dialog(msg)
|
dialogs.Error_dialog(msg)
|
||||||
|
|
||||||
def handle_event_status(self, account, status): # OUR status
|
def handle_event_status(self, account, status): # OUR status
|
||||||
#('STATUS', account, status)
|
#('STATUS', account, status)
|
||||||
|
@ -328,7 +325,8 @@ class interface:
|
||||||
#gajim doesn't give a shit
|
#gajim doesn't give a shit
|
||||||
# WHY? same with offline
|
# WHY? same with offline
|
||||||
# new message works
|
# 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)
|
self.roster.popup_windows.append(instance)
|
||||||
elif old_show > 1 and new_show < 2 and gajim.config.get( \
|
elif old_show > 1 and new_show < 2 and gajim.config.get( \
|
||||||
'sound_contact_disconnected'):
|
'sound_contact_disconnected'):
|
||||||
|
@ -336,7 +334,8 @@ class interface:
|
||||||
if not self.windows[account]['chats'].has_key(jid) and \
|
if not self.windows[account]['chats'].has_key(jid) and \
|
||||||
not self.queues[account].has_key(jid) and not gajim.config.get( \
|
not self.queues[account].has_key(jid) and not gajim.config.get( \
|
||||||
'autopopup'):
|
'autopopup'):
|
||||||
instance = Popup_window(self, 'Contact Offline', jid, account)
|
instance = dialogs.Popup_window(self, 'Contact Offline', jid, \
|
||||||
|
account)
|
||||||
self.roster.popup_windows.append(instance)
|
self.roster.popup_windows.append(instance)
|
||||||
|
|
||||||
elif self.windows[account]['gc'].has_key(ji):
|
elif self.windows[account]['gc'].has_key(ji):
|
||||||
|
@ -359,7 +358,7 @@ class interface:
|
||||||
not self.queues[account].has_key(jid):
|
not self.queues[account].has_key(jid):
|
||||||
first = True
|
first = True
|
||||||
if not gajim.config.get('autopopup'):
|
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.popup_windows.append(instance)
|
||||||
self.roster.on_message(jid, array[1], array[2], account)
|
self.roster.on_message(jid, array[1], array[2], account)
|
||||||
if gajim.config.get('sound_first_message_received') and first:
|
if gajim.config.get('sound_first_message_received') and first:
|
||||||
|
@ -382,7 +381,7 @@ class interface:
|
||||||
|
|
||||||
def handle_event_subscribe(self, account, array):
|
def handle_event_subscribe(self, account, array):
|
||||||
#('SUBSCRIBE', account, (jid, text))
|
#('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):
|
def handle_event_subscribed(self, account, array):
|
||||||
#('SUBSCRIBED', account, (jid, resource))
|
#('SUBSCRIBED', account, (jid, resource))
|
||||||
|
@ -402,10 +401,10 @@ class interface:
|
||||||
'online', 'to', '', array[1], 0, '')
|
'online', 'to', '', array[1], 0, '')
|
||||||
self.roster.contacts[account][jid] = [user1]
|
self.roster.contacts[account][jid] = [user1]
|
||||||
self.roster.add_user_to_roster(jid, account)
|
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):
|
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):
|
def handle_event_agent_info(self, account, array):
|
||||||
#('AGENT_INFO', account, (agent, identities, features, items))
|
#('AGENT_INFO', account, (agent, identities, features, items))
|
||||||
|
@ -445,8 +444,9 @@ class interface:
|
||||||
self.nicks[name] = array[1]
|
self.nicks[name] = array[1]
|
||||||
self.roster.groups[name] = {}
|
self.roster.groups[name] = {}
|
||||||
self.roster.contacts[name] = {}
|
self.roster.contacts[name] = {}
|
||||||
|
self.roster.newly_added[name] = []
|
||||||
|
self.roster.to_be_removed[name] = []
|
||||||
self.sleeper_state[name] = 0
|
self.sleeper_state[name] = 0
|
||||||
#FIXME: add missing to_be_deleted for ex
|
|
||||||
if self.windows.has_key('accounts'):
|
if self.windows.has_key('accounts'):
|
||||||
self.windows['accounts'].init_accounts()
|
self.windows['accounts'].init_accounts()
|
||||||
self.roster.draw_roster()
|
self.roster.draw_roster()
|
||||||
|
@ -498,7 +498,7 @@ class interface:
|
||||||
'%s has set the subject to %s' % (jids[1], array[1]), jid)
|
'%s has set the subject to %s' % (jids[1], array[1]), jid)
|
||||||
|
|
||||||
def handle_event_bad_passphrase(self, account, array):
|
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):
|
def handle_event_roster_info(self, account, array):
|
||||||
#('ROSTER_INFO', account, (jid, name, sub, ask, groups))
|
#('ROSTER_INFO', account, (jid, name, sub, ask, groups))
|
||||||
|
@ -682,7 +682,7 @@ class interface:
|
||||||
def process_connections(self):
|
def process_connections(self):
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
if gajim.connections[account].connected:
|
if gajim.connections[account].connected:
|
||||||
gajim.connections[account].connection.process(1)
|
gajim.connections[account].connection.process(0.01)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -712,7 +712,7 @@ class interface:
|
||||||
break
|
break
|
||||||
if pix:
|
if pix:
|
||||||
gtk.window_set_default_icon(pix)
|
gtk.window_set_default_icon(pix)
|
||||||
self.roster = Roster_window(self)
|
self.roster = roster_window.Roster_window(self)
|
||||||
self.sleeper = common.sleepy.Sleepy( \
|
self.sleeper = common.sleepy.Sleepy( \
|
||||||
gajim.config.get('autoawaytime')*60, \
|
gajim.config.get('autoawaytime')*60, \
|
||||||
gajim.config.get('autoxatime')*60)
|
gajim.config.get('autoxatime')*60)
|
||||||
|
@ -726,19 +726,19 @@ class interface:
|
||||||
self.systray_capabilities = False
|
self.systray_capabilities = False
|
||||||
else:
|
else:
|
||||||
self.systray_capabilities = True
|
self.systray_capabilities = True
|
||||||
self.systray = Systray(self)
|
self.systray = systray.Systray(self)
|
||||||
else:
|
else:
|
||||||
self.systray_capabilities = True
|
self.systray_capabilities = True
|
||||||
self.systray = Systray(self)
|
self.systray = systray.Systray(self)
|
||||||
if self.systray_capabilities:
|
if self.systray_capabilities:
|
||||||
self.show_systray()
|
self.show_systray()
|
||||||
|
|
||||||
self.init_regexp()
|
self.init_regexp()
|
||||||
|
|
||||||
# get instances for windows/dialogs that will show_all()/hide()
|
# 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'] = \
|
self.windows['add_remove_emoticons_window'] = \
|
||||||
Add_remove_emoticons_window(self)
|
config.Add_remove_emoticons_window(self)
|
||||||
self.windows['roster'] = self.roster
|
self.windows['roster'] = self.roster
|
||||||
|
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
|
@ -746,7 +746,7 @@ class interface:
|
||||||
|
|
||||||
gobject.timeout_add(100, self.autoconnect)
|
gobject.timeout_add(100, self.autoconnect)
|
||||||
gobject.timeout_add(500, self.read_sleepy)
|
gobject.timeout_add(500, self.read_sleepy)
|
||||||
gobject.timeout_add(50, self.process_connections)
|
gobject.timeout_add(200, self.process_connections)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try: # Import Psyco if available
|
try: # Import Psyco if available
|
||||||
|
|
|
@ -31,7 +31,7 @@ gtk.glade.textdomain(APP)
|
||||||
|
|
||||||
GTKGUI_GLADE='gtkgui.glade'
|
GTKGUI_GLADE='gtkgui.glade'
|
||||||
|
|
||||||
class history_window:
|
class History_window:
|
||||||
"""Class for bowser agent window:
|
"""Class for bowser agent window:
|
||||||
to know the agents on the selected server"""
|
to know the agents on the selected server"""
|
||||||
def on_history_window_destroy(self, widget):
|
def on_history_window_destroy(self, widget):
|
||||||
|
|
|
@ -26,12 +26,12 @@ import Queue
|
||||||
import common.sleepy
|
import common.sleepy
|
||||||
|
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from tabbed_chat_window import *
|
import tabbed_chat_window
|
||||||
from groupchat_window import *
|
import groupchat_window
|
||||||
from history_window import *
|
import history_window
|
||||||
from gtkgui import CellRendererImage, User
|
from gtkgui import CellRendererImage, User
|
||||||
import dialogs
|
import dialogs
|
||||||
from config import *
|
import config
|
||||||
|
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ class Roster_window:
|
||||||
self.plugin.windows[account]['infos'][user.jid].window.present()
|
self.plugin.windows[account]['infos'][user.jid].window.present()
|
||||||
else:
|
else:
|
||||||
self.plugin.windows[account]['infos'][user.jid] = \
|
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):
|
def on_agent_logging(self, widget, jid, state, account):
|
||||||
"""When an agent is requested to log in or off"""
|
"""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):
|
def on_remove_agent(self, widget, jid, account):
|
||||||
"""When an agent is requested to log in or off"""
|
"""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:
|
if window.get_response() == gtk.RESPONSE_YES:
|
||||||
gajim.connections[account].unsubscribe_agent(jid)
|
gajim.connections[account].unsubscribe_agent(jid)
|
||||||
for u in self.contacts[account][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)
|
self.tree.set_cursor(path, self.tree.get_column(0), True)
|
||||||
|
|
||||||
def on_edit_groups(self, widget, user, account):
|
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()
|
dlg.run()
|
||||||
|
|
||||||
def on_history(self, widget, user):
|
def on_history(self, widget, user):
|
||||||
"""When history button is pressed : call log window"""
|
"""When history button is pressed : call log window"""
|
||||||
if not self.plugin.windows['logs'].has_key(user.jid):
|
if not self.plugin.windows['logs'].has_key(user.jid):
|
||||||
self.plugin.windows['logs'][user.jid] = history_window(self.plugin, \
|
self.plugin.windows['logs'][user.jid] = history_window.\
|
||||||
user.jid)
|
History_window(self.plugin, user.jid)
|
||||||
|
|
||||||
def mk_menu_user(self, event, iter):
|
def mk_menu_user(self, event, iter):
|
||||||
"""Make user's popup menu"""
|
"""Make user's popup menu"""
|
||||||
|
@ -537,7 +537,7 @@ class Roster_window:
|
||||||
infos['jid'] = self.plugin.accounts[account]["name"] + \
|
infos['jid'] = self.plugin.accounts[account]["name"] + \
|
||||||
'@' + self.plugin.accounts[account]["hostname"]
|
'@' + self.plugin.accounts[account]["hostname"]
|
||||||
self.plugin.windows['account_modification'] = \
|
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):
|
def mk_menu_account(self, event, iter):
|
||||||
"""Make account's popup menu"""
|
"""Make account's popup menu"""
|
||||||
|
@ -683,7 +683,7 @@ class Roster_window:
|
||||||
|
|
||||||
def on_req_usub(self, widget, user, account):
|
def on_req_usub(self, widget, user, account):
|
||||||
"""Remove a user"""
|
"""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:
|
if window.get_response() == gtk.RESPONSE_YES:
|
||||||
gajim.connections[account].unsubscribe(user.jid)
|
gajim.connections[account].unsubscribe(user.jid)
|
||||||
for u in self.contacts[account][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 \
|
if (status == 'online' and not gajim.config.get('ask_online_status')) or \
|
||||||
(status == 'offline' and not gajim.config.get('ask_offline_status')):
|
(status == 'offline' and not gajim.config.get('ask_offline_status')):
|
||||||
return 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()
|
message = dlg.run()
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
@ -777,7 +778,7 @@ class Roster_window:
|
||||||
return
|
return
|
||||||
accounts = gajim.connections.keys()
|
accounts = gajim.connections.keys()
|
||||||
if len(accounts) == 0:
|
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()
|
self.update_status_comboxbox()
|
||||||
return
|
return
|
||||||
status = model[active][2]
|
status = model[active][2]
|
||||||
|
@ -839,7 +840,7 @@ class Roster_window:
|
||||||
if gajim.config.get('usetabbedchat'):
|
if gajim.config.get('usetabbedchat'):
|
||||||
if not self.plugin.windows[account]['chats'].has_key('tabbed'):
|
if not self.plugin.windows[account]['chats'].has_key('tabbed'):
|
||||||
self.plugin.windows[account]['chats']['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:
|
else:
|
||||||
self.plugin.windows[account]['chats']['tabbed'].new_user(user)
|
self.plugin.windows[account]['chats']['tabbed'].new_user(user)
|
||||||
|
|
||||||
|
@ -849,13 +850,14 @@ class Roster_window:
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.plugin.windows[account]['chats'][user.jid] = \
|
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):
|
def new_group(self, jid, nick, account):
|
||||||
if gajim.config.get('usetabbedchat'):
|
if gajim.config.get('usetabbedchat'):
|
||||||
if not self.plugin.windows[account]['gc'].has_key('tabbed'):
|
if not self.plugin.windows[account]['gc'].has_key('tabbed'):
|
||||||
self.plugin.windows[account]['gc']['tabbed'] = \
|
self.plugin.windows[account]['gc']['tabbed'] = \
|
||||||
Groupchat_window(jid, nick, self.plugin, account)
|
groupchat_window.Groupchat_window(jid, nick, self.plugin, \
|
||||||
|
account)
|
||||||
else:
|
else:
|
||||||
self.plugin.windows[account]['gc']['tabbed'].new_group(jid, nick)
|
self.plugin.windows[account]['gc']['tabbed'].new_group(jid, nick)
|
||||||
self.plugin.windows[account]['gc'][jid] = \
|
self.plugin.windows[account]['gc'][jid] = \
|
||||||
|
@ -864,7 +866,7 @@ class Roster_window:
|
||||||
self.plugin.windows[account]['gc']['tabbed'].active_tab(jid)
|
self.plugin.windows[account]['gc']['tabbed'].active_tab(jid)
|
||||||
else:
|
else:
|
||||||
self.plugin.windows[account]['gc'][jid] = \
|
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):
|
def on_message(self, jid, msg, tim, account):
|
||||||
"""when we receive a message"""
|
"""when we receive a message"""
|
||||||
|
@ -919,25 +921,25 @@ class Roster_window:
|
||||||
self.plugin.windows['preferences'].window.show_all()
|
self.plugin.windows['preferences'].window.show_all()
|
||||||
|
|
||||||
def on_add_new_contact(self, widget, account):
|
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):
|
def on_join_gc_activate(self, widget, account):
|
||||||
if not self.plugin.windows[account].has_key('join_gc'):
|
if not self.plugin.windows[account].has_key('join_gc'):
|
||||||
Join_groupchat_window(self.plugin, account)
|
dialogs.Join_groupchat_window(self.plugin, account)
|
||||||
else:
|
else:
|
||||||
self.plugin.windows[account]['join_gc'].window.present()
|
self.plugin.windows[account]['join_gc'].window.present()
|
||||||
|
|
||||||
def on_new_message_menuitem_activate(self, widget, account):
|
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):
|
def on_about_menuitem_activate(self, widget):
|
||||||
About_dialog()
|
dialogs.About_dialog()
|
||||||
|
|
||||||
def on_accounts_menuitem_activate(self, widget):
|
def on_accounts_menuitem_activate(self, widget):
|
||||||
if self.plugin.windows.has_key('accounts'):
|
if self.plugin.windows.has_key('accounts'):
|
||||||
self.plugin.windows['accounts'].present()
|
self.plugin.windows['accounts'].present()
|
||||||
else:
|
else:
|
||||||
self.plugin.windows['accounts'] = Accounts_window(self.plugin)
|
self.plugin.windows['accounts'] = config.Accounts_window(self.plugin)
|
||||||
|
|
||||||
def close_all(self, dic):
|
def close_all(self, dic):
|
||||||
"""close all the windows in the given dictionary"""
|
"""close all the windows in the given dictionary"""
|
||||||
|
@ -1107,7 +1109,7 @@ class Roster_window:
|
||||||
self.plugin.windows[account]['disco'].present()
|
self.plugin.windows[account]['disco'].present()
|
||||||
else:
|
else:
|
||||||
self.plugin.windows[account]['disco'] = \
|
self.plugin.windows[account]['disco'] = \
|
||||||
Service_discovery_window(self.plugin, account)
|
config.Service_discovery_window(self.plugin, account)
|
||||||
|
|
||||||
def mkpixbufs(self):
|
def mkpixbufs(self):
|
||||||
"""initialise pixbufs array"""
|
"""initialise pixbufs array"""
|
||||||
|
@ -1425,4 +1427,4 @@ class Roster_window:
|
||||||
self.draw_roster()
|
self.draw_roster()
|
||||||
if len(gajim.connections) == 0: # if no account
|
if len(gajim.connections) == 0: # if no account
|
||||||
self.plugin.windows['account_modification'] = \
|
self.plugin.windows['account_modification'] = \
|
||||||
Account_modification_window(self.plugin, {})
|
config.Account_modification_window(self.plugin, {})
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
import gtk.glade
|
import gtk.glade
|
||||||
from dialogs import *
|
import dialogs
|
||||||
|
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class Systray:
|
||||||
def on_new_message_menuitem_activate(self, widget, account):
|
def on_new_message_menuitem_activate(self, widget, account):
|
||||||
"""When new message menuitem is activated:
|
"""When new message menuitem is activated:
|
||||||
call the New_message_dialog class"""
|
call the New_message_dialog class"""
|
||||||
New_message_dialog(self.plugin, account)
|
dialogs.New_message_dialog(self.plugin, account)
|
||||||
|
|
||||||
def make_menu(self, event):
|
def make_menu(self, event):
|
||||||
"""create chat with and new message (sub) menus/menuitems"""
|
"""create chat with and new message (sub) menus/menuitems"""
|
||||||
|
|
|
@ -24,9 +24,9 @@ import gobject
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from dialogs import *
|
import dialogs
|
||||||
from history_window import *
|
import history_window
|
||||||
from chat import *
|
import chat
|
||||||
|
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ gtk.glade.textdomain(APP)
|
||||||
|
|
||||||
GTKGUI_GLADE='gtkgui.glade'
|
GTKGUI_GLADE='gtkgui.glade'
|
||||||
|
|
||||||
class Tabbed_chat_window(Chat):
|
class Tabbed_chat_window(chat.Chat):
|
||||||
"""Class for tabbed chat window"""
|
"""Class for tabbed chat window"""
|
||||||
def __init__(self, user, plugin, account):
|
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.users = {}
|
||||||
self.new_user(user)
|
self.new_user(user)
|
||||||
self.show_title()
|
self.show_title()
|
||||||
|
@ -90,19 +90,19 @@ class Tabbed_chat_window(Chat):
|
||||||
"""close window"""
|
"""close window"""
|
||||||
for jid in self.users:
|
for jid in self.users:
|
||||||
if time.time() - self.last_message_time[jid] < 2: # 2 seconds
|
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:
|
if dialog.get_response() != gtk.RESPONSE_YES:
|
||||||
return True #stop the propagation of the event
|
return True #stop the propagation of the event
|
||||||
|
|
||||||
def on_tabbed_chat_window_destroy(self, widget):
|
def on_tabbed_chat_window_destroy(self, widget):
|
||||||
#clean self.plugin.windows[self.account]['chats']
|
#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):
|
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):
|
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):
|
def on_clear_button_clicked(self, widget):
|
||||||
"""When clear button is pressed :
|
"""When clear button is pressed :
|
||||||
|
@ -117,15 +117,16 @@ class Tabbed_chat_window(Chat):
|
||||||
"""When history button is pressed : call history window"""
|
"""When history button is pressed : call history window"""
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
if not self.plugin.windows['logs'].has_key(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):
|
def remove_tab(self, jid):
|
||||||
if time.time() - self.last_message_time[jid] < 2:
|
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:
|
if dialog.get_response() != gtk.RESPONSE_YES:
|
||||||
return
|
return
|
||||||
|
|
||||||
Chat.remove_tab(self, jid, 'chats')
|
chat.Chat.remove_tab(self, jid, 'chats')
|
||||||
if len(self.xmls) > 0:
|
if len(self.xmls) > 0:
|
||||||
del self.users[jid]
|
del self.users[jid]
|
||||||
|
|
||||||
|
@ -133,7 +134,7 @@ class Tabbed_chat_window(Chat):
|
||||||
self.names[user.jid] = user.name
|
self.names[user.jid] = user.name
|
||||||
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chats_vbox', APP)
|
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chats_vbox', APP)
|
||||||
self.childs[user.jid] = self.xmls[user.jid].get_widget('chats_vbox')
|
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.users[user.jid] = user
|
||||||
|
|
||||||
self.redraw_tab(user.jid)
|
self.redraw_tab(user.jid)
|
||||||
|
@ -177,7 +178,7 @@ class Tabbed_chat_window(Chat):
|
||||||
if (event.state & gtk.gdk.SHIFT_MASK):
|
if (event.state & gtk.gdk.SHIFT_MASK):
|
||||||
return False
|
return False
|
||||||
if gajim.connections[self.account].connected < 2: #we are not connected
|
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
|
return True
|
||||||
message_buffer = widget.get_buffer()
|
message_buffer = widget.get_buffer()
|
||||||
start_iter = message_buffer.get_start_iter()
|
start_iter = message_buffer.get_start_iter()
|
||||||
|
@ -235,4 +236,4 @@ class Tabbed_chat_window(Chat):
|
||||||
kind = 'incoming'
|
kind = 'incoming'
|
||||||
name = user.name
|
name = user.name
|
||||||
|
|
||||||
Chat.print_conversation_line(self, text, jid, kind, name, tim)
|
chat.Chat.print_conversation_line(self, text, jid, kind, name, tim)
|
||||||
|
|
Loading…
Reference in New Issue