class name Foo_widgettype becomes FooWidgettype so we now look 100% pygtkish [sed rocks]

This commit is contained in:
Nikos Kouremenos 2005-06-10 21:14:16 +00:00
parent 58bbf6cf16
commit 3d59234f7f
9 changed files with 108 additions and 103 deletions

View File

@ -242,7 +242,7 @@ class Chat:
try:
gtkspell.Spell(message_textview)
except gobject.GError, msg:
dialogs.Error_dialog(str(msg), _('If that is not your language for which you want to highlight misspelled words, then please set your $LANG as appropriate. Eg. for French do export LANG=fr_FR or export LANG=fr_FR.UTF-8 in ~/.bash_profile or to make it global in /etc/profile.\n\nHighlighting misspelled words feature will not be used')).get_response()
dialogs.ErrorDialog(str(msg), _('If that is not your language for which you want to highlight misspelled words, then please set your $LANG as appropriate. Eg. for French do export LANG=fr_FR or export LANG=fr_FR.UTF-8 in ~/.bash_profile or to make it global in /etc/profile.\n\nHighlighting misspelled words feature will not be used')).get_response()
gajim.config.set('use_speller', False)
conversation_textview = self.xmls[jid].get_widget(

View File

@ -53,8 +53,8 @@ def mk_color_string(color):
(hex(color.blue) + '0')[2:4]
#---------- Preferences_window class -------------#
class Preferences_window:
#---------- PreferencesWindow class -------------#
class PreferencesWindow:
'''Class for Preferences window'''
def on_preferences_window_delete_event(self, widget, event):
@ -954,8 +954,8 @@ class Preferences_window:
self.plugin.windows['advanced_config'] = \
dialogs.Advanced_configuration_window(self.plugin)
#---------- Account_modification_window class -------------#
class Account_modification_window:
#---------- AccountModificationWindow class -------------#
class AccountModificationWindow:
'''Class for account informations'''
def on_account_modification_window_destroy(self, widget):
'''close window'''
@ -1079,20 +1079,20 @@ class Account_modification_window:
if gajim.connections.has_key(self.account):
if name != self.account and \
gajim.connections[self.account].connected != 0:
dialogs.Error_dialog(_('You are connected to the server'),
dialogs.ErrorDialog(_('You are connected to the server'),
_('To change the account name, it must be disconnected.')).get_response()
return
if (name == ''):
dialogs.Error_dialog(_('Invalid account name'),
dialogs.ErrorDialog(_('Invalid account name'),
_('Account names cannot be empty.')).get_response()
return
if name.find(' ') != -1:
dialogs.Error_dialog(_('Invalid account name'),
dialogs.ErrorDialog(_('Invalid account name'),
_('Account names cannot contain spaces.')).get_response()
return
jid = self.xml.get_widget('jid_entry').get_text()
if jid == '' or jid.count('@') != 1:
dialogs.Error_dialog(_('Invalid Jabber ID'),
dialogs.ErrorDialog(_('Invalid Jabber ID'),
_('A Jabber ID must be in the form "user@servername".')).get_response()
return
new_account = self.xml.get_widget('new_account_checkbutton').get_active()
@ -1100,7 +1100,7 @@ _('To change the account name, it must be disconnected.')).get_response()
'save_password_checkbutton').get_active()
config['password'] = self.xml.get_widget('password_entry').get_text()
if new_account and config['password'] == '':
dialogs.Error_dialog(_('Invalid password'),
dialogs.ErrorDialog(_('Invalid password'),
_('You must enter a password for the new account.')).get_response()
return
config['resource'] = self.xml.get_widget('resource_entry').get_text()
@ -1198,7 +1198,7 @@ _('To change the account name, it must be disconnected.')).get_response()
return
#if it's a new account
if name in gajim.connections:
dialogs.Error_dialog(_('Account name is in use'),
dialogs.ErrorDialog(_('Account name is in use'),
_('You already have an account using this name.')).get_response()
return
con = connection.Connection(name)
@ -1235,7 +1235,7 @@ _('To change the account name, it must be disconnected.')).get_response()
self.window.destroy()
def on_change_password_button_clicked(self, widget):
dialog = dialogs.Change_password_dialog(self.plugin, self.account)
dialog = dialogs.ChangePasswordDialog(self.plugin, self.account)
new_password = dialog.run()
if new_password != -1:
gajim.connections[self.account].change_password(new_password, \
@ -1251,12 +1251,12 @@ _('To change the account name, it must be disconnected.')).get_response()
def on_edit_details_button_clicked(self, widget):
if not self.plugin.windows.has_key(self.account):
dialogs.Error_dialog(_('No such account available'),
dialogs.ErrorDialog(_('No such account available'),
_('You must create your account before editing your personal information.')).get_response()
return
jid = self.xml.get_widget('jid_entry').get_text()
if gajim.connections[self.account].connected < 2:
dialogs.Error_dialog(_('You are not connected to the server'),
dialogs.ErrorDialog(_('You are not connected to the server'),
_('Without a connection, you can not edit your personal information.')).get_response()
return
if not self.plugin.windows[self.account]['infos'].has_key('vcard'):
@ -1269,12 +1269,12 @@ _('To change the account name, it must be disconnected.')).get_response()
self.plugin.windows['manage_proxies'].window.present()
else:
self.plugin.windows['manage_proxies'] = \
Manage_proxies_window(self.plugin)
ManageProxiesWindow(self.plugin)
def on_gpg_choose_button_clicked(self, widget, data = None):
secret_keys = gajim.connections[self.account].ask_gpg_secrete_keys()
if not secret_keys:
dialogs.Error_dialog(_('Failed to get secret keys'),
dialogs.ErrorDialog(_('Failed to get secret keys'),
_('There was a problem retrieving your GPG secret keys.')).get_response()
return
secret_keys['None'] = 'None'
@ -1322,8 +1322,8 @@ _('There was a problem retrieving your GPG secret keys.')).get_response()
password_entry.set_sensitive(False)
password_entry.set_text('')
#---------- Manage_proxies_window class -------------#
class Manage_proxies_window:
#---------- ManageProxiesWindow class -------------#
class ManageProxiesWindow:
def __init__(self, plugin):
self.plugin = plugin
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'manage_proxies_window', APP)
@ -1479,8 +1479,8 @@ class Manage_proxies_window:
gajim.config.set_per('proxies', proxy, 'pass', value)
#---------- Accounts_window class -------------#
class Accounts_window:
#---------- AccountsWindow class -------------#
class AccountsWindow:
'''Class for accounts window: list of accounts'''
def on_accounts_window_destroy(self, widget):
del self.plugin.windows['accounts']
@ -1535,7 +1535,7 @@ class Accounts_window:
self.plugin.windows['account_modification'].window.present()
else:
self.plugin.windows['account_modification'] = \
Account_modification_window(self.plugin, '')
AccountModificationWindow(self.plugin, '')
def on_remove_button_clicked(self, widget):
'''When delete button is clicked:
@ -1549,7 +1549,7 @@ class Accounts_window:
self.plugin.windows[account]['remove_account'].window.present()
else:
self.plugin.windows[account]['remove_account'] = \
Remove_account_window(self.plugin, account)
RemoveAccountWindow(self.plugin, account)
def on_modify_button_clicked(self, widget):
'''When modify button is clicked:
@ -1563,10 +1563,10 @@ class Accounts_window:
self.plugin.windows[account]['account_modification'].window.present()
else:
self.plugin.windows[account]['account_modification'] = \
Account_modification_window(self.plugin, account)
AccountModificationWindow(self.plugin, account)
#---------- Service_registration_window class -------------#
class Service_registration_window:
#---------- ServiceRegistrationWindow class -------------#
class ServiceRegistrationWindow:
'''Class for Service registration window:
Window that appears when we want to subscribe to a service'''
def on_cancel_button_clicked(self, widget):
@ -1632,8 +1632,8 @@ class Service_registration_window:
self.window.show_all()
#---------- Add_remove_emoticons_window class -------------#
class Add_remove_emoticons_window:
#---------- ManageEmoticonsWindow class -------------#
class ManageEmoticonsWindow:
def __init__(self, plugin):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'add_remove_emoticons_window', APP)
self.window = self.xml.get_widget('add_remove_emoticons_window')
@ -1804,8 +1804,8 @@ class Add_remove_emoticons_window:
self.on_button_remove_emoticon_clicked(widget)
#---------- Service_discovery_window class -------------#
class Service_discovery_window:
#---------- ServiceDiscoveryWindow class -------------#
class ServiceDiscoveryWindow:
'''Class for Service Discovery Window:
to know the services on a server'''
def on_service_discovery_window_destroy(self, widget):
@ -1819,7 +1819,7 @@ class Service_discovery_window:
self.account = account
self.agent_infos = {}
if gajim.connections[account].connected < 2:
dialogs.Error_dialog(_('You are not connected to the server'),
dialogs.ErrorDialog(_('You are not connected to the server'),
_('Without a connection, you can not browse available services')).get_response()
raise RuntimeError, 'You must be connected to browse services'
xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
@ -2025,7 +2025,7 @@ _('Without a connection, you can not browse available services')).get_response()
room = services[0]
service = services[1]
if not self.plugin.windows[self.account].has_key('join_gc'):
dialogs.Join_groupchat_window(self.plugin, self.account, service, room)
dialogs.JoinGroupchatWindow(self.plugin, self.account, service, room)
else:
self.plugin.windows[self.account]['join_gc'].window.present()
@ -2077,9 +2077,9 @@ _('Without a connection, you can not browse available services')).get_response()
self.browse(server_address)
self.plugin.save_config()
#---------- Groupchat_config_window class -------------#
class Groupchat_config_window:
'''Groupchat_config_window class'''
#---------- GroupchatConfigWindow class -------------#
class GroupchatConfigWindow:
'''GroupchatConfigWindow class'''
def __init__(self, plugin, account, room_jid, config):
self.plugin = plugin
self.account = account
@ -2203,8 +2203,8 @@ class Groupchat_config_window:
nbrows, nbrows + 1)
self.config_table.show_all()
#---------- Remove_account_window class -------------#
class Remove_account_window:
#---------- RemoveAccountWindow class -------------#
class RemoveAccountWindow:
'''ask for removing from gajim only or from gajim and server too
and do removing of the account given'''
@ -2228,7 +2228,7 @@ class Remove_account_window:
def on_remove_button_clicked(self, widget):
if gajim.connections[self.account].connected:
dialog = dialogs.Confirmation_dialog(
dialog = dialogs.ConfirmationDialog(
_('Account "%s" is connected to the server' % self.account),
_('If you remove it, the connection will be lost.'))
if dialog.get_response() != gtk.RESPONSE_OK:

View File

@ -38,7 +38,7 @@ gtk.glade.textdomain (APP)
GTKGUI_GLADE = 'gtkgui.glade'
class Edit_groups_dialog:
class EditGroupsDialog:
'''Class for the edit group dialog window'''
def __init__(self, user, account, plugin):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'edit_groups_dialog', APP)
@ -88,7 +88,7 @@ class Edit_groups_dialog:
model = self.list.get_model()
if model[path][1] and len(self.user.groups) == 1: # we try to remove
# the last group
Error_dialog(_("Can't remove last group"),
ErrorDialog(_("Can't remove last group"),
_('At least one contact group must be present.')).get_response()
return
model[path][1] = not model[path][1]
@ -124,7 +124,7 @@ class Edit_groups_dialog:
renderer.connect('toggled', self.group_toggled_cb)
column.set_attributes(renderer, active = 1)
class Passphrase_dialog:
class PassphraseDialog:
'''Class for Passphrase dialog'''
def run(self):
'''Wait for OK button to be pressed and return passphrase/password'''
@ -192,7 +192,7 @@ class ChooseGPGKeyDialog:
self.window.show_all()
class Change_status_message_dialog:
class ChangeStatusMessageDialog:
def __init__(self, plugin, show):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'change_status_message_dialog', APP)
self.window = self.xml.get_widget('change_status_message_dialog')
@ -242,11 +242,11 @@ class Change_status_message_dialog:
if (event.state & gtk.gdk.CONTROL_MASK):
self.window.response(gtk.RESPONSE_OK)
class Add_new_contact_window:
'''Class for Add_new_contact_window'''
class AddNewContactWindow:
'''Class for AddNewContactWindow'''
def __init__(self, plugin, account, jid = None):
if gajim.connections[account].connected < 2:
Error_dialog(_('You are not connected to the server.'), \
ErrorDialog(_('You are not connected to the server.'), \
_('Without a connection, you can not add a contact')).get_response()
return
self.plugin = plugin
@ -321,7 +321,7 @@ class Add_new_contact_window:
if not jid:
return
if jid.find('@') < 0:
Error_dialog(_("Invalid user name"),
ErrorDialog(_("Invalid user name"),
_('User names must be of the form "user@servername".')).get_response()
return
message_buffer = self.xml.get_widget('message_textview').get_buffer()
@ -376,7 +376,7 @@ class AboutDialog:
'''Class for about dialog'''
def __init__(self):
if gtk.pygtk_version < (2, 6, 0) or gtk.gtk_version < (2, 6, 0):
Information_dialog(_('Gajim - a GTK+ Jabber client'),
InformationDialog(_('Gajim - a GTK+ Jabber client'),
_('Version %s') % gajim.version).get_response()
return
@ -460,7 +460,7 @@ class HigDialog(Dialog):
self.destroy()
return response
class Confirmation_dialog(HigDialog):
class ConfirmationDialog(HigDialog):
def __init__(self, pritext, sectext=''):
"""HIG compliant confirmation dialog."""
HigDialog.__init__(
@ -468,7 +468,7 @@ class Confirmation_dialog(HigDialog):
[ [gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL], [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
)
class Warning_dialog(HigDialog):
class WarningDialog(HigDialog):
def __init__(self, pritext, sectext=''):
"""HIG compliant warning dialog."""
HigDialog.__init__(
@ -476,7 +476,7 @@ class Warning_dialog(HigDialog):
[ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
)
class Information_dialog(HigDialog):
class InformationDialog(HigDialog):
def __init__(self, pritext, sectext=''):
"""HIG compliant info dialog."""
HigDialog.__init__(
@ -484,7 +484,7 @@ class Information_dialog(HigDialog):
[ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
)
class Input_dialog:
class InputDialog:
'''Class for Input dialog'''
def __init__(self, title, label_str, input_str = None):
xml = gtk.glade.XML(GTKGUI_GLADE, 'input_dialog', APP)
@ -497,7 +497,7 @@ class Input_dialog:
self.input_entry.set_text(input_str)
self.input_entry.select_region(0, -1) # select all
class Error_dialog(HigDialog):
class ErrorDialog(HigDialog):
def __init__(self, pritext, sectext=''):
"""HIG compliant error dialog."""
HigDialog.__init__(
@ -527,7 +527,7 @@ class Subscription_request_window:
gajim.connections[self.account].send_authorization(self.jid)
self.window.destroy()
if not self.plugin.roster.contacts[self.account].has_key(self.jid):
Add_new_contact_window(self.plugin, self.account, self.jid)
AddNewContactWindow(self.plugin, self.account, self.jid)
def on_contact_info_button_clicked(self, widget):
'''ask vcard'''
@ -550,12 +550,12 @@ class Subscription_request_window:
gajim.connections[self.account].refuse_authorization(self.jid)
self.window.destroy()
class Join_groupchat_window:
class JoinGroupchatWindow:
def __init__(self, plugin, account, server = '', room = ''):
self.plugin = plugin
self.account = account
if gajim.connections[account].connected < 2:
Error_dialog(_('You are not connected to the server'),
ErrorDialog(_('You are not connected to the server'),
_('You can not join a group chat unless you are connected.')).get_response()
raise RuntimeError, 'You must be connected to join a groupchat'
@ -617,7 +617,7 @@ _('You can not join a group chat unless you are connected.')).get_response()
password = self.xml.get_widget('password_entry').get_text()
jid = '%s@%s' % (room, server)
if jid in self.plugin.windows[self.account]['gc']:
Error_dialog(_('You are already in room ' + jid)).get_response()
ErrorDialog(_('You are already in room ' + jid)).get_response()
return
if jid in self.recently_groupchat:
self.recently_groupchat.remove(jid)
@ -632,10 +632,10 @@ _('You can not join a group chat unless you are connected.')).get_response()
self.window.destroy()
class New_message_dialog:
class NewMessageDialog:
def __init__(self, plugin, account):
if gajim.connections[account].connected < 2:
Error_dialog(_('You are not connected to the server'),
ErrorDialog(_('You are not connected to the server'),
_('Without a connection, you can not send messages.')).get_response()
return
self.plugin = plugin
@ -663,7 +663,7 @@ class New_message_dialog:
'''When Chat button is clicked'''
jid = self.jid_entry.get_text()
if jid.find('@') == -1: # if no @ was given
Error_dialog(_('Invalid user ID'),
ErrorDialog(_('Invalid user ID'),
_('User ID must be of the form "username@servername".')).get_response()
return
self.window.destroy()
@ -687,10 +687,10 @@ _('User ID must be of the form "username@servername".')).get_response()
self.plugin.windows[self.account]['chats'][jid].set_active_tab(jid)
self.plugin.windows[self.account]['chats'][jid].window.present()
class Change_password_dialog:
class ChangePasswordDialog:
def __init__(self, plugin, account):
if gajim.connections[account].connected < 2:
Error_dialog(_('You are not connected to the server'),
ErrorDialog(_('You are not connected to the server'),
_('Without a connection, you can not change your password.')).get_response()
return
self.plugin = plugin
@ -710,12 +710,12 @@ _('Without a connection, you can not change your password.')).get_response()
if rep == gtk.RESPONSE_OK:
password1 = self.password1_entry.get_text()
if not password1:
Error_dialog(_('Invalid password.'), \
ErrorDialog(_('Invalid password.'), \
_('You must enter a password.')).get_response()
continue
password2 = self.password2_entry.get_text()
if password1 != password2:
Error_dialog(_("Passwords don't match."), \
ErrorDialog(_("Passwords don't match."), \
_('The passwords typed in both fields must be identical.')).get_response()
continue
message = password1

View File

@ -191,11 +191,11 @@ class Interface:
def handle_event_warning(self, unused, data):
#('WARNING', account, (title_text, section_text))
dialogs.Warning_dialog(data[0], data[1]).get_response()
dialogs.WarningDialog(data[0], data[1]).get_response()
def handle_event_error(self, unused, data):
#('ERROR', account, (title_text, section_text))
dialogs.Error_dialog(data[0], data[1]).get_response()
dialogs.ErrorDialog(data[0], data[1]).get_response()
def handle_event_error_answer(self, account, array):
#('ERROR_ANSWER', account, (jid_from. errmsg, errcode))
@ -434,12 +434,12 @@ class Interface:
'online', 'to', '', array[1], 0, keyID)
self.roster.contacts[account][jid] = [user1]
self.roster.add_user_to_roster(jid, account)
dialogs.Information_dialog(_('Authorization accepted'),
dialogs.InformationDialog(_('Authorization accepted'),
_('The contact "%s" has authorized you to see his status.')
% jid).get_response()
def handle_event_unsubscribed(self, account, jid):
dialogs.Information_dialog(_('Contact "%s" removed subscription' % jid),
dialogs.InformationDialog(_('Contact "%s" removed subscription' % jid),
_('You will always see contact "%s" as offline.')).get_response()
def handle_event_agent_info(self, account, array):
@ -451,9 +451,9 @@ class Interface:
def handle_event_register_agent_info(self, account, array):
#('AGENT_INFO', account, (agent, infos))
if array[1].has_key('instructions'):
config.Service_registration_window(array[0], array[1], self, account)
config.ServiceRegistrationWindow(array[0], array[1], self, account)
else:
dialogs.Error_dialog(_('Contact with "%s" cannot be established'\
dialogs.ErrorDialog(_('Contact with "%s" cannot be established'\
% array[0]), _('Check your connection or try again later.')).get_response()
def handle_event_agent_info_items(self, account, array):
@ -471,7 +471,7 @@ class Interface:
def handle_event_acc_ok(self, account, array):
#('ACC_OK', account, (name, config))
name = array[0]
dialogs.Information_dialog(_('Account registration successful'),
dialogs.InformationDialog(_('Account registration successful'),
_('The account "%s" has been registered with the Jabber server.') % name).get_response()
gajim.config.add_per('accounts', name)
for opt in array[1]:
@ -545,10 +545,10 @@ class Interface:
jid = array[0].split('/')[0]
if not self.windows[account]['gc_config'].has_key(jid):
self.windows[account]['gc_config'][jid] = \
config.Groupchat_config_window(self, account, jid, array[1])
config.GroupchatConfigWindow(self, account, jid, array[1])
def handle_event_bad_passphrase(self, account, array):
dialogs.Warning_dialog(_('Your GPG passphrase is incorrect'),
dialogs.WarningDialog(_('Your GPG passphrase is incorrect'),
_('You are currently connected without your GPG key.')).get_response()
def handle_event_roster_info(self, account, array):
@ -838,9 +838,9 @@ class Interface:
self.init_regexp()
# get instances for windows/dialogs that will show_all()/hide()
self.windows['preferences'] = config.Preferences_window(self)
self.windows['preferences'] = config.PreferencesWindow(self)
self.windows['add_remove_emoticons'] = \
config.Add_remove_emoticons_window(self)
config.ManageEmoticonsWindow(self)
self.windows['roster'] = self.roster
for account in gajim.connections:

View File

@ -94,7 +94,7 @@ class Groupchat_window(chat.Chat):
"""close window"""
for room_jid in self.xmls:
if time.time() - self.last_message_time[room_jid] < 2:
dialog = dialogs.Confirmation_dialog(_('You just received a new message in room "%s".'), \
dialog = dialogs.ConfirmationDialog(_('You just received a new message in room "%s".'), \
_('If you close this window, this message will be lost.') % \
room_jid.split('@')[0])
if dialog.get_response() != gtk.RESPONSE_OK:
@ -286,7 +286,7 @@ class Groupchat_window(chat.Chat):
# I don't know how this works with markup... Let's find out!
label_text = self.name_labels[room_jid].get_text() # whole text (including JID)
subject = label_text[label_text.find('\n') + 1:] # just the text after the newline *shrug*
instance = dialogs.Input_dialog('Changing the Subject',
instance = dialogs.InputDialog('Changing the Subject',
'Please specify the new subject:', subject)
response = instance.dialog.run()
instance.dialog.destroy()
@ -309,7 +309,7 @@ class Groupchat_window(chat.Chat):
for bookmark in gajim.connections[self.account].bookmarks:
if bookmark['jid'] == bm['jid']:
dialogs.Error_dialog(
dialogs.ErrorDialog(
_('Bookmark already set'),
_('The bookmark is already in your roster.')).get_response()
return
@ -319,7 +319,7 @@ class Groupchat_window(chat.Chat):
#FIXME: use join_gc_window [where user can put password] and change the
#name of the boookmark [default: fill with room's 'name']
dialogs.Information_dialog(
dialogs.InformationDialog(
_('Bookmark has been added successfully'),
_('You can find the bookmark for room "%s" in your roster.') % \
room_jid.split('@')[0]).get_response()
@ -509,7 +509,7 @@ class Groupchat_window(chat.Chat):
#self.plugin.send('ASK_OS_INFO', self.account, jid, resource)
def on_add_to_roster(self, widget, jid):
dialogs.Add_new_contact_window(self.plugin, self.account, jid)
dialogs.AddNewContactWindow(self.plugin, self.account, jid)
def on_send_pm(self, widget, model, iter):
room_jid = self.get_active_jid()
@ -593,7 +593,7 @@ class Groupchat_window(chat.Chat):
def remove_tab(self, room_jid):
if time.time() - self.last_message_time[room_jid] < 2:
dialog = dialogs.Confirmation_dialog(
dialog = dialogs.ConfirmationDialog(
_('You just received a new message in room "%s"'),
_('If you close this tab, the message will be lost.') % \
room_jid.split('@')[0])

View File

@ -463,7 +463,7 @@ class Roster_window:
def on_remove_agent(self, widget, user, account):
'''When an agent is requested to log in or off'''
window = dialogs.Confirmation_dialog(_('Transport "%s" will be removed') % user.jid, _('You will no longer be able to send and receive messages to contacts from %s.' % user.jid))
window = dialogs.ConfirmationDialog(_('Transport "%s" will be removed') % user.jid, _('You will no longer be able to send and receive messages to contacts from %s.' % user.jid))
if window.get_response() == gtk.RESPONSE_YES:
gajim.connections[account].unsubscribe_agent(user.jid + '/' \
+ user.resource)
@ -512,7 +512,7 @@ class Roster_window:
gajim.config.set_per('accounts', account, 'attached_gpg_keys', keys_str)
def on_edit_groups(self, widget, user, account):
dlg = dialogs.Edit_groups_dialog(user, account, self.plugin)
dlg = dialogs.EditGroupsDialog(user, account, self.plugin)
dlg.run()
def on_history(self, widget, user):
@ -641,7 +641,7 @@ class Roster_window:
self.plugin.windows[account]['account_modification'].window.present()
else:
self.plugin.windows[account]['account_modification'] = \
config.Account_modification_window(self.plugin, account)
config.AccountModificationWindow(self.plugin, account)
def mk_menu_account(self, event, iter):
'''Make account's popup menu'''
@ -702,7 +702,7 @@ class Roster_window:
menu.reposition()
def on_add_to_roster(self, widget, user, account):
dialogs.Add_new_contact_window(self.plugin, account, user.jid)
dialogs.AddNewContactWindow(self.plugin, account, user.jid)
def authorize(self, widget, jid, account):
'''Authorize a user'''
@ -804,7 +804,7 @@ class Roster_window:
def on_req_usub(self, widget, user, account):
'''Remove a user'''
window = dialogs.Confirmation_dialog(\
window = dialogs.ConfirmationDialog(\
_('Contact "%s" will be removed from your roster') % (user.name),
_('By removing this contact you also remove authorization. Contact "%s" will always see you as offline.') % user.name)
if window.get_response() == gtk.RESPONSE_OK:
@ -837,7 +837,7 @@ class Roster_window:
save_pass = gajim.config.get_per('accounts', account, 'savepass')
if not save_pass and gajim.connections[account].connected < 2:
passphrase = ''
w = dialogs.Passphrase_dialog(
w = dialogs.PassphraseDialog(
_('Password Required'),
_('Enter your password for account %s') % account,
_('Save password'))
@ -870,7 +870,7 @@ class Roster_window:
passphrase = self.gpg_passphrase[keyid]
save = False
else:
w = dialogs.Passphrase_dialog(
w = dialogs.PassphraseDialog(
_('Passphrase Required'),
_('Enter GPG key passphrase for account %s') % account,
_('Save passphrase'))
@ -902,7 +902,7 @@ class Roster_window:
(show == 'offline' and not gajim.config.get('ask_offline_status')):
lowered_uf_status_msg = helpers.get_uf_show(show).lower()
return _("I'm %s") % lowered_uf_status_msg
dlg = dialogs.Change_status_message_dialog(self.plugin, show)
dlg = dialogs.ChangeStatusMessageDialog(self.plugin, show)
message = dlg.run()
return message
@ -920,7 +920,7 @@ class Roster_window:
return
accounts = gajim.connections.keys()
if len(accounts) == 0:
dialogs.Error_dialog(_('No accounts created'),
dialogs.ErrorDialog(_('No accounts created'),
_('You must create Jabber account before connecting the server.')).get_response()
self.update_status_comboxbox()
return
@ -1063,20 +1063,20 @@ class Roster_window:
self.plugin.windows['preferences'].window.show_all()
def on_add_new_contact(self, widget, account):
dialogs.Add_new_contact_window(self.plugin, account)
dialogs.AddNewContactWindow(self.plugin, account)
def on_join_gc_activate(self, widget, account):
if self.plugin.windows[account].has_key('join_gc'):
self.plugin.windows[account]['join_gc'].window.present()
else:
try:
self.plugin.windows[account]['join_gc'] = dialogs.Join_groupchat_window(self.plugin, account)
self.plugin.windows[account]['join_gc'] = dialogs.JoinGroupchatWindow(self.plugin, account)
except RuntimeError:
pass
def on_new_message_menuitem_activate(self, widget, account):
dialogs.New_message_dialog(self.plugin, account)
dialogs.NewMessageDialog(self.plugin, account)
def on_about_menuitem_activate(self, widget):
dialogs.AboutDialog()
@ -1085,7 +1085,7 @@ class Roster_window:
if self.plugin.windows.has_key('accounts'):
self.plugin.windows['accounts'].window.present()
else:
self.plugin.windows['accounts'] = config.Accounts_window(self.plugin)
self.plugin.windows['accounts'] = config.AccountsWindow(self.plugin)
def on_bookmarks_menuitem_activate(self, widget):
config.ManageBookmarksWindow(self.plugin)
@ -1172,12 +1172,12 @@ class Roster_window:
recent = True
break
if unread:
dialog = dialogs.Confirmation_dialog(_('You have unread messages'), _('If you exit Gajim these messages will be lost.'))
dialog = dialogs.ConfirmationDialog(_('You have unread messages'), _('If you exit Gajim these messages will be lost.'))
if dialog.get_response() != gtk.RESPONSE_OK:
return
if recent:
dialog = dialogs.Confirmation_dialog(_('You have unread messages'), _('If you exit Gajim these messages will be lost.'))
dialog = dialogs.ConfirmationDialog(_('You have unread messages'), _('If you exit Gajim these messages will be lost.'))
if dialog.get_response() != gtk.RESPONSE_OK:
return
for acct in accounts:
@ -1285,7 +1285,7 @@ class Roster_window:
else:
try:
self.plugin.windows[account]['disco'] = \
config.Service_discovery_window(self.plugin, account)
config.ServiceDiscoveryWindow(self.plugin, account)
except RuntimeError:
pass
@ -1668,4 +1668,4 @@ class Roster_window:
self.draw_roster()
if len(gajim.connections) == 0: # if no account
self.plugin.windows['account_modification'] = \
config.Account_modification_window(self.plugin)
config.AccountModificationWindow(self.plugin)

View File

@ -110,8 +110,8 @@ class Systray:
def on_new_message_menuitem_activate(self, widget, account):
"""When new message menuitem is activated:
call the New_message_dialog class"""
dialogs.New_message_dialog(self.plugin, account)
call the NewMessageDialog class"""
dialogs.NewMessageDialog(self.plugin, account)
def make_menu(self, event):
"""create chat with and new message (sub) menus/menuitems"""

View File

@ -185,7 +185,7 @@ class Tabbed_chat_window(chat.Chat):
"""close window"""
for jid in self.users:
if time.time() - self.last_message_time[jid] < 2: # 2 seconds
dialog = dialogs.Confirmation_dialog(
dialog = dialogs.ConfirmationDialog(
_('You just received a new message from "%s"' % jid),
_('If you close the window, this message will be lost.'))
if dialog.get_response() != gtk.RESPONSE_OK:
@ -226,7 +226,7 @@ class Tabbed_chat_window(chat.Chat):
def remove_tab(self, jid):
if time.time() - self.last_message_time[jid] < 2:
dialog = dialogs.Confirmation_dialog(
dialog = dialogs.ConfirmationDialog(
_('You just received a new message from "%s"' % jid),
_('If you close this tab, the message will be lost.'))
if dialog.get_response() != gtk.RESPONSE_OK:
@ -297,7 +297,7 @@ class Tabbed_chat_window(chat.Chat):
elif (event.state & gtk.gdk.SHIFT_MASK):
return False
if gajim.connections[self.account].connected < 2: #we are not connected
dialogs.Error_dialog(_("A connection is not available"),
dialogs.ErrorDialog(_("A connection is not available"),
_("Your message can't be sent until you reconnect.")).get_response()
return True

View File

@ -23,6 +23,7 @@ import urllib
import base64
import mimetypes
import os
import dialogs
from common import gajim
from common import i18n
_ = i18n._
@ -126,6 +127,10 @@ class Vcard_window:
dialog.destroy()
if file:
filesize = os.path.getsize(file) # in bytes
if filesize > 8192:
dialogs.ErrorDialog(_('The filesize of image "%s" is too large') % file, _('The file must not be more than 8 kilobytes'))
return
fd = open(file)
data = fd.read()
pixbufloader = gtk.gdk.PixbufLoader()
@ -308,7 +313,7 @@ class Vcard_window:
def on_publish_button_clicked(self, widget):
if gajim.connections[self.account].connected < 2:
Error_dialog(_('You are not connected to the server'),
ErrorDialog(_('You are not connected to the server'),
_('Without a connection you can not publish your contact information.')).get_response()
return
vcard = self.make_vcard()
@ -336,7 +341,7 @@ class Vcard_window:
self.xml.get_widget('PHOTO_image').set_from_pixbuf(None)
gajim.connections[self.account].request_vcard(self.jid)
else:
Error_dialog(_('You are not connected to the server'),
ErrorDialog(_('You are not connected to the server'),
_('Without a connection, you can not get your contact information.')).get_response()
def change_to_vcard(self):