warning class and changes in the code. should work. glade dialog removed
This commit is contained in:
parent
d007712e20
commit
07948af69e
4 changed files with 39 additions and 144 deletions
|
@ -99,11 +99,11 @@ class vCard_Window:
|
||||||
if self.plugin.connected[self.account]:
|
if self.plugin.connected[self.account]:
|
||||||
self.plugin.send('ASK_VCARD', self.account, self.jid)
|
self.plugin.send('ASK_VCARD', self.account, self.jid)
|
||||||
else:
|
else:
|
||||||
warning_Window(_("You must be connected to get your informations"))
|
warning_dialog(_("You must be connected to get your informations"))
|
||||||
|
|
||||||
def on_publish(self, widget):
|
def on_publish(self, widget):
|
||||||
if not self.plugin.connected[self.account]:
|
if not self.plugin.connected[self.account]:
|
||||||
warning_Window(_("You must be connected to publish your informations"))
|
warning_dialog(_("You must be connected to publish your informations"))
|
||||||
return
|
return
|
||||||
vcard = self.make_vcard()
|
vcard = self.make_vcard()
|
||||||
nick = ''
|
nick = ''
|
||||||
|
@ -914,31 +914,31 @@ class accountpreferences_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 == ''):
|
||||||
warning_Window(_('You must enter a name for this account'))
|
warning_dialog(_('You must enter a name for this account'))
|
||||||
return 0
|
return 0
|
||||||
if name.find(' ') != -1:
|
if name.find(' ') != -1:
|
||||||
warning_Window(_('Spaces are not permited in account name'))
|
warning_dialog(_('Spaces are not permited in account name'))
|
||||||
return 0
|
return 0
|
||||||
if (jid == '') or (string.count(jid, '@') != 1):
|
if (jid == '') or (string.count(jid, '@') != 1):
|
||||||
warning_Window(_('You must enter a Jabber ID for this account\nFor example : login@hostname'))
|
warning_dialog(_('You must enter a Jabber ID for this account\nFor example : login@hostname'))
|
||||||
return 0
|
return 0
|
||||||
if new_account_checkbutton.get_active() and password == '':
|
if new_account_checkbutton.get_active() and password == '':
|
||||||
warning_Window(_('You must enter a password to register a new account'))
|
warning_dialog(_('You must enter a password to register a new account'))
|
||||||
return 0
|
return 0
|
||||||
if use_proxy:
|
if use_proxy:
|
||||||
if proxyport != '':
|
if proxyport != '':
|
||||||
try:
|
try:
|
||||||
proxyport = string.atoi(proxyport)
|
proxyport = string.atoi(proxyport)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
warning_Window(_('Proxy Port must be a port number'))
|
warning_dialog(_('Proxy Port must be a port number'))
|
||||||
return 0
|
return 0
|
||||||
if proxyhost == '':
|
if proxyhost == '':
|
||||||
warning_Window(_('You must enter a proxy host to use proxy'))
|
warning_dialog(_('You must enter a proxy host to use proxy'))
|
||||||
if priority != '':
|
if priority != '':
|
||||||
try:
|
try:
|
||||||
priority = string.atoi(priority)
|
priority = string.atoi(priority)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
warning_Window(_('Priority must be a number'))
|
warning_dialog(_('Priority must be a number'))
|
||||||
return 0
|
return 0
|
||||||
(login, hostname) = string.split(jid, '@')
|
(login, hostname) = string.split(jid, '@')
|
||||||
key_name = self.xml.get_widget('gpg_name_label').get_text()
|
key_name = self.xml.get_widget('gpg_name_label').get_text()
|
||||||
|
@ -996,7 +996,7 @@ class accountpreferences_window:
|
||||||
return
|
return
|
||||||
#if it's a new account
|
#if it's a new account
|
||||||
if name in self.plugin.accounts.keys():
|
if name in self.plugin.accounts.keys():
|
||||||
warning_Window(_('An account already has this name'))
|
warning_dialog(_('An account already has this name'))
|
||||||
return
|
return
|
||||||
#if we neeed to register a new account
|
#if we neeed to register a new account
|
||||||
if new_account_checkbutton.get_active():
|
if new_account_checkbutton.get_active():
|
||||||
|
@ -1053,7 +1053,7 @@ class accountpreferences_window:
|
||||||
vCard_Window(jid, self.plugin, self.account)
|
vCard_Window(jid, self.plugin, self.account)
|
||||||
self.plugin.send('ASK_VCARD', self.account, jid)
|
self.plugin.send('ASK_VCARD', self.account, jid)
|
||||||
else:
|
else:
|
||||||
warning_Window(_('You must be connected to get your informations'))
|
warning_dialog(_('You must be connected to get your informations'))
|
||||||
|
|
||||||
def on_gpg_choose_button_clicked(self, widget, data=None):
|
def on_gpg_choose_button_clicked(self, widget, data=None):
|
||||||
w = choose_gpg_Window()
|
w = choose_gpg_Window()
|
||||||
|
@ -1167,8 +1167,8 @@ 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)
|
||||||
window = confirm_window(_("Are you sure you want to remove this account (%s) ?") % account)
|
dialog = confirm_dialog(_("Are you sure you want to remove this account (%s) ?") % account)
|
||||||
if window.wait() == gtk.RESPONSE_YES:
|
if dialog.get_response() == gtk.RESPONSE_YES:
|
||||||
if self.plugin.connected[account]:
|
if self.plugin.connected[account]:
|
||||||
self.plugin.send('STATUS', account, ('offline', 'offline'))
|
self.plugin.send('STATUS', account, ('offline', 'offline'))
|
||||||
del self.plugin.accounts[account]
|
del self.plugin.accounts[account]
|
||||||
|
@ -1388,7 +1388,7 @@ class agent_browser_window:
|
||||||
|
|
||||||
def __init__(self, plugin, account):
|
def __init__(self, plugin, account):
|
||||||
if not plugin.connected[account]:
|
if not plugin.connected[account]:
|
||||||
warning_Window(_("You must be connected to view Agents"))
|
warning_dialog(_("You must be connected to view Agents"))
|
||||||
return
|
return
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_browser_window', APP)
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_browser_window', APP)
|
||||||
self.window = xml.get_widget('agent_browser_window')
|
self.window = xml.get_widget('agent_browser_window')
|
||||||
|
@ -1439,7 +1439,7 @@ class join_gc:
|
||||||
|
|
||||||
def __init__(self, plugin, account, server='', room = ''):
|
def __init__(self, plugin, account, server='', room = ''):
|
||||||
if not plugin.connected[account]:
|
if not plugin.connected[account]:
|
||||||
warning_Window(_("You must be connected to join a group chat on this serveur"))
|
warning_dialog(_("You must be connected to join a group chat on this serveur"))
|
||||||
return
|
return
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.account = account
|
self.account = account
|
||||||
|
|
|
@ -272,7 +272,7 @@ class addContact_Window:
|
||||||
if not jid:
|
if not jid:
|
||||||
return
|
return
|
||||||
if jid.find('@') < 0:
|
if jid.find('@') < 0:
|
||||||
warning_Window(_("The contact's name must be something like login@hostname"))
|
warning_dialog(_("The contact's name must be something like login@hostname"))
|
||||||
return
|
return
|
||||||
message_buffer = self.xml.get_widget('message_textview').get_buffer()
|
message_buffer = self.xml.get_widget('message_textview').get_buffer()
|
||||||
start_iter = message_buffer.get_start_iter()
|
start_iter = message_buffer.get_start_iter()
|
||||||
|
@ -329,7 +329,7 @@ class addContact_Window:
|
||||||
|
|
||||||
def __init__(self, plugin, account, jid=None):
|
def __init__(self, plugin, account, jid=None):
|
||||||
if not plugin.connected[account]:
|
if not plugin.connected[account]:
|
||||||
warning_Window(_('You must be connected to add a contact'))
|
warning_dialog(_('You must be connected to add a contact'))
|
||||||
return
|
return
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.account = account
|
self.account = account
|
||||||
|
@ -369,17 +369,6 @@ class addContact_Window:
|
||||||
agent_combobox.set_active(jid_agents.index(jid_splited[1])+1)
|
agent_combobox.set_active(jid_agents.index(jid_splited[1])+1)
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
|
|
||||||
class warning_Window:
|
|
||||||
"""Class for warning window : print a warning message"""
|
|
||||||
def on_close(self, widget):
|
|
||||||
"""When Close button is clicked"""
|
|
||||||
widget.get_toplevel().destroy()
|
|
||||||
|
|
||||||
def __init__(self, txt):
|
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'Warning', APP)
|
|
||||||
xml.get_widget('label').set_text(txt)
|
|
||||||
xml.signal_connect('on_close_clicked', self.on_close)
|
|
||||||
|
|
||||||
class about_Window: #FIXME: (nk) pygtk2.6 has a built-in window for that
|
class about_Window: #FIXME: (nk) pygtk2.6 has a built-in window for that
|
||||||
"""Class for about window"""
|
"""Class for about window"""
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
|
@ -398,18 +387,28 @@ class about_Window: #FIXME: (nk) pygtk2.6 has a built-in window for that
|
||||||
xml.signal_connect('on_close_clicked', self.on_close)
|
xml.signal_connect('on_close_clicked', self.on_close)
|
||||||
|
|
||||||
|
|
||||||
class confirm_window:
|
class confirm_dialog:
|
||||||
"""Class for confirmation window"""
|
"""Class for confirmation dialog"""
|
||||||
def wait(self):
|
def get_response(self):
|
||||||
response = self.window.run()
|
response = self.dialog.run()
|
||||||
self.window.destroy()
|
self.dialog.destroy()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def __init__(self, label):
|
def __init__(self, label):
|
||||||
self.window = gtk.MessageDialog(None,\
|
self.dialog = gtk.MessageDialog(None,\
|
||||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,\
|
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,\
|
||||||
gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, label)
|
gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, label)
|
||||||
|
|
||||||
|
class warning_dialog:
|
||||||
|
"""Class for warning dialog"""
|
||||||
|
def __init__(self, label):
|
||||||
|
self.dialog = gtk.MessageDialog(None,\
|
||||||
|
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,\
|
||||||
|
gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, label)
|
||||||
|
|
||||||
|
response = self.dialog.run()
|
||||||
|
self.dialog.destroy()
|
||||||
|
|
||||||
class subscription_request_Window:
|
class subscription_request_Window:
|
||||||
"""Class for authorization window :
|
"""Class for authorization window :
|
||||||
window that appears when a user wants to add us to his/her roster"""
|
window that appears when a user wants to add us to his/her roster"""
|
||||||
|
|
|
@ -3305,110 +3305,6 @@ on the server as a vCard</property>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget class="GtkDialog" id="Warning">
|
|
||||||
<property name="border_width">5</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="title" translatable="yes">Warning</property>
|
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
|
||||||
<property name="modal">True</property>
|
|
||||||
<property name="resizable">True</property>
|
|
||||||
<property name="destroy_with_parent">False</property>
|
|
||||||
<property name="decorated">True</property>
|
|
||||||
<property name="skip_taskbar_hint">False</property>
|
|
||||||
<property name="skip_pager_hint">False</property>
|
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
|
||||||
<property name="has_separator">True</property>
|
|
||||||
|
|
||||||
<child internal-child="vbox">
|
|
||||||
<widget class="GtkVBox" id="dialog-vbox2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="homogeneous">False</property>
|
|
||||||
<property name="spacing">0</property>
|
|
||||||
|
|
||||||
<child internal-child="action_area">
|
|
||||||
<widget class="GtkHButtonBox" id="Message">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="layout_style">GTK_BUTTONBOX_EDGE</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkButton" id="closebutton1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_default">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="label">gtk-close</property>
|
|
||||||
<property name="use_stock">True</property>
|
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
|
||||||
<property name="focus_on_click">True</property>
|
|
||||||
<property name="response_id">-7</property>
|
|
||||||
<signal name="clicked" handler="on_close_clicked" last_modification_time="Wed, 17 Mar 2004 19:51:00 GMT"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">3</property>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="pack_type">GTK_PACK_END</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkHBox" id="hbox24">
|
|
||||||
<property name="border_width">5</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="homogeneous">False</property>
|
|
||||||
<property name="spacing">0</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImage" id="image108">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-dialog-warning</property>
|
|
||||||
<property name="icon_size">6</property>
|
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">6</property>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Message</property>
|
|
||||||
<property name="use_underline">False</property>
|
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
|
||||||
<property name="wrap">False</property>
|
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0.5</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">5</property>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
|
|
||||||
<widget class="GtkWindow" id="preferences_window">
|
<widget class="GtkWindow" id="preferences_window">
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -1890,7 +1890,7 @@ class roster_Window:
|
||||||
return
|
return
|
||||||
accounts = self.plugin.accounts.keys()
|
accounts = self.plugin.accounts.keys()
|
||||||
if len(accounts) == 0:
|
if len(accounts) == 0:
|
||||||
warning_Window(_("You must setup an account before connecting to jabber network."))
|
warning_dialog(_("You must setup an account before connecting to jabber network."))
|
||||||
self.set_cb()
|
self.set_cb()
|
||||||
return
|
return
|
||||||
status = model[active][0]
|
status = model[active][0]
|
||||||
|
@ -2699,7 +2699,7 @@ class plugin:
|
||||||
self.roster.draw_roster()
|
self.roster.draw_roster()
|
||||||
|
|
||||||
def handle_event_warning(self, unused, msg):
|
def handle_event_warning(self, unused, msg):
|
||||||
warning_Window(msg)
|
warning_dialog(msg)
|
||||||
|
|
||||||
def handle_event_status(self, account, status):
|
def handle_event_status(self, account, status):
|
||||||
#('STATUS', account, status)
|
#('STATUS', account, status)
|
||||||
|
@ -2820,10 +2820,10 @@ class plugin:
|
||||||
'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)
|
||||||
warning_Window(_("You are now authorized by %s") % jid)
|
warning_dialog(_("You are now authorized by %s") % jid)
|
||||||
|
|
||||||
def handle_event_unsubscribed(self, account, jid):
|
def handle_event_unsubscribed(self, account, jid):
|
||||||
warning_Window(_("You are now unsubscribed by %s") % jid)
|
warning_dialog(_("You are now unsubscribed by %s") % jid)
|
||||||
|
|
||||||
def handle_event_agents(self, account, agents):
|
def handle_event_agents(self, account, agents):
|
||||||
#('AGENTS', account, agents)
|
#('AGENTS', account, agents)
|
||||||
|
@ -2839,7 +2839,7 @@ class plugin:
|
||||||
def handle_event_reg_agent_info(self, account, array):
|
def handle_event_reg_agent_info(self, account, array):
|
||||||
#('REG_AGENTS_INFO', account, (agent, infos))
|
#('REG_AGENTS_INFO', account, (agent, infos))
|
||||||
if not array[1].has_key('instructions'):
|
if not array[1].has_key('instructions'):
|
||||||
warning_Window(_("error contacting %s") % array[0])
|
warning_dialog(_("error contacting %s") % array[0])
|
||||||
else:
|
else:
|
||||||
agentRegistration_Window(array[0], array[1], self, account)
|
agentRegistration_Window(array[0], array[1], self, account)
|
||||||
|
|
||||||
|
@ -2920,7 +2920,7 @@ class plugin:
|
||||||
self.systray.add_jid(jid, account)
|
self.systray.add_jid(jid, account)
|
||||||
|
|
||||||
def handle_event_bad_passphrase(self, account, array):
|
def handle_event_bad_passphrase(self, account, array):
|
||||||
warning_Window(_("Your GPG passphrase is wrong, so you are connected without your GPG key."))
|
warning_dialog(_("Your GPG passphrase is wrong, so you are connected without your GPG key."))
|
||||||
|
|
||||||
def handle_event_gpg_secrete_keys(self, account, keys):
|
def handle_event_gpg_secrete_keys(self, account, keys):
|
||||||
keys['None'] = 'None'
|
keys['None'] = 'None'
|
||||||
|
|
Loading…
Add table
Reference in a new issue