popup not when new message are clickable and work now. hide some widgets for windows version.

This commit is contained in:
Nikos Kouremenos 2005-04-12 12:49:37 +00:00
parent b8830da5c6
commit 33fe77ff8a
5 changed files with 74 additions and 61 deletions

View File

@ -46,6 +46,9 @@ class Preferences_window:
def on_preferences_window_show(self, widget):
self.notebook.set_current_page(0)
if os.name == 'nt': # if windows, player must not be visible
self.xml.get_widget('soundplayer_hbox').set_property('visible', False)
self.trayicon_checkbutton.set_property('visible', False)
def on_preferences_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE
@ -62,7 +65,7 @@ class Preferences_window:
w.set_sensitive(widget.get_active())
self.plugin.save_config()
def on_tray_icon_checkbutton_toggled(self, widget):
def on_trayicon_checkbutton_toggled(self, widget):
if widget.get_active():
self.plugin.config['trayicon'] = 1
self.plugin.show_systray()
@ -632,15 +635,15 @@ class Preferences_window:
self.auto_xa_checkbutton = self.xml.get_widget('auto_xa_checkbutton')
self.auto_xa_time_spinbutton = self.xml.get_widget \
('auto_xa_time_spinbutton')
self.tray_icon_checkbutton = self.xml.get_widget('tray_icon_checkbutton')
self.trayicon_checkbutton = self.xml.get_widget('trayicon_checkbutton')
self.notebook = self.xml.get_widget('preferences_notebook')
#trayicon
if self.plugin.systray_capabilities:
st = self.plugin.config['trayicon']
self.tray_icon_checkbutton.set_active(st)
self.trayicon_checkbutton.set_active(st)
else:
self.tray_icon_checkbutton.set_sensitive(False)
self.trayicon_checkbutton.set_sensitive(False)
#Save position
st = self.plugin.config['saveposition']
@ -776,9 +779,6 @@ class Preferences_window:
self.xml.get_widget('sounds_scrolledwindow').set_sensitive(False)
self.xml.get_widget('browse_sounds_hbox').set_sensitive(False)
if os.name == 'nt': # if windows, player must not be changeable
self.xml.get_widget('soundplayer_hbox').set_sensitive(False)
#sound player
self.xml.get_widget('soundplayer_entry').set_text(\
self.plugin.config['soundplayer'])

View File

@ -121,7 +121,7 @@ class Vcard_information_window:
resources += '\n' + u.resource + ' (' + str(u.priority) + ')'
if not u.status:
u.status = ''
stats += '\n' + u.show + ' : ' + u.status
stats += '\n' + u.show + ': ' + u.status
self.xml.get_widget('resource_label').set_text(resources)
self.xml.get_widget('status_label').set_text(stats)
self.plugin.send('ASK_VCARD', self.account, self.user.jid)
@ -764,6 +764,7 @@ class New_message_dialog:
if jid.find('@') == -1: # if no @ was given
Error_dialog(_('User ID is not valid'))
return
self.window.destroy()
# use User class, new_chat expects it that way
# is it in the roster?
if self.plugin.roster.contacts[self.account].has_key(jid):
@ -779,8 +780,6 @@ class New_message_dialog:
self.plugin.windows[self.account]['chats'][jid].active_tab(jid)
self.plugin.windows[self.account]['chats'][jid].window.present()
#FIXME: PROBLEM WITH FOCUS
self.window.destroy()
class Change_password_dialog:
def __init__(self, plugin, account):
@ -818,8 +817,10 @@ class Change_password_dialog:
return message
class Popup_window:
def __init__(self, plugin, event_type, event_desc):
def __init__(self, plugin, event_type, jid, account):
self.plugin = plugin
self.account = account
self.jid = jid
xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP)
self.window = xml.get_widget('popup_window')
@ -829,7 +830,13 @@ class Popup_window:
eventbox = xml.get_widget('eventbox')
event_type_label.set_markup('<b>'+event_type+'</b>')
event_description_label.set_text(event_desc)
if self.jid in self.plugin.roster.contacts[account]:
txt = self.plugin.roster.contacts[account][self.jid][0].name
else:
txt = self.jid
event_description_label.set_text(txt)
# set colors [ http://www.w3schools.com/html/html_colornames.asp ]
self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black'))
@ -842,29 +849,27 @@ class Popup_window:
elif event_type == 'New Message':
close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue'))
eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue'))
txt = 'From ' + txt
# position the window to bottom-right of screen
window_width, window_height = self.window.get_size()
self.plugin.roster.popups_height += window_height
window_width, self.window_height = self.window.get_size()
self.plugin.roster.popups_height += self.window_height
self.window.move(gtk.gdk.screen_width() - window_width, \
gtk.gdk.screen_height() - self.plugin.roster.popups_height)
xml.signal_autoconnect(self)
close_button.connect('clicked', self.on_close_button_clicked, window_height)
self.window.show_all()
gobject.timeout_add(5000, self.on_timeout)
gobject.timeout_add(5000, self.on_timeout, window_height)
def on_close_button_clicked(self, widget):
self.adjust_height_and_move_popup_windows()
def on_close_button_clicked(self, widget, window_height):
self.adjust_height_and_move_popup_windows(window_height)
def on_timeout(self, window_height):
self.adjust_height_and_move_popup_windows(window_height)
def on_timeout(self):
self.adjust_height_and_move_popup_windows()
def adjust_height_and_move_popup_windows(self, window_height):
def adjust_height_and_move_popup_windows(self):
#remove
self.plugin.roster.popups_height -= window_height
self.plugin.roster.popups_height -= self.window_height
self.window.destroy()
if len(self.plugin.roster.popup_windows) > 0:
@ -880,4 +885,17 @@ class Popup_window:
gtk.gdk.screen_height() - self.plugin.roster.popups_height)
def on_popup_window_button_press_event(self, widget, event):
print 'IN YOUR DREAMS ONLY..'
# use User class, new_chat expects it that way
# is it in the roster?
if self.plugin.roster.contacts[self.account].has_key(self.jid):
user = self.plugin.roster.contacts[self.account][self.jid][0]
else:
user = gtkgui.User(self.jid, self.jid, ['not in the roster'], \
'not in the roster', 'not in the roster', 'none', None, '', 0, '')
self.plugin.roster.contacts[self.account][self.jid] = [user]
self.plugin.roster.add_user_to_roster(user.self.jid, self.account)
self.plugin.roster.new_chat(user, self.account)
self.plugin.windows[self.account]['chats'][self.jid].active_tab(self.jid)
self.plugin.windows[self.account]['chats'][self.jid].window.present()
self.adjust_height_and_move_popup_windows()

View File

@ -2871,7 +2871,7 @@
<property name="spacing">5</property>
<child>
<widget class="GtkCheckButton" id="tray_icon_checkbutton">
<widget class="GtkCheckButton" id="trayicon_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">If checked, Gajim will also have a trayicon</property>
<property name="can_focus">True</property>
@ -2882,7 +2882,7 @@
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_tray_icon_checkbutton_toggled" last_modification_time="Sun, 06 Mar 2005 15:13:50 GMT"/>
<signal name="toggled" handler="on_trayicon_checkbutton_toggled" last_modification_time="Tue, 12 Apr 2005 12:34:19 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
@ -6009,27 +6009,6 @@ Custom</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="nickname_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label62">
<property name="visible">True</property>
@ -6341,6 +6320,29 @@ Custom</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="nickname_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_padding">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
@ -9988,6 +9990,7 @@ send a chat message to</property>
<property name="visible">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Tue, 12 Apr 2005 12:48:32 GMT"/>
<child>
<widget class="GtkImage" id="image496">

View File

@ -412,6 +412,7 @@ class plugin:
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
not self.config['autopopup']:
#FIXME:
#DOES NOT ALWAYS WORK WHY?
#I control nkour@lagaule in jabber
# have nkour@lagaul in nkour@jabber.org
@ -419,7 +420,7 @@ class plugin:
#gajim doesn't give a shit
# WHY? same with offline
# new message works
instance = Popup_window(self, 'Contact Online', jid )
instance = Popup_window(self, 'Contact Online', jid, account)
self.roster.popup_windows.append(instance)
elif old_show > 1 and new_show < 2 and \
self.config['sound_contact_disconnected']:
@ -427,7 +428,7 @@ class plugin:
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
not self.config['autopopup']:
instance = Popup_window(self, 'Contact Offline', jid )
instance = Popup_window(self, 'Contact Offline', jid, account)
self.roster.popup_windows.append(instance)
elif self.windows[account]['gc'].has_key(ji):
@ -450,10 +451,7 @@ class plugin:
not self.queues[account].has_key(jid):
first = True
if not self.config['autopopup']:
#FIXME: check if the new msg was from contact in the roster or not
# and display the name or the jid [if not]
#if
instance = Popup_window(self, 'New Message', 'From '+ jid )
instance = Popup_window(self, 'New Message', jid, account)
self.roster.popup_windows.append(instance)
self.roster.on_message(jid, array[1], array[2], account)
if self.config['sound_first_message_received'] and first:

View File

@ -922,8 +922,7 @@ class Roster_window:
New_message_dialog(self.plugin, account)
def on_about_menuitem_activate(self, widget):
print self.get_contacts_list()
#About_dialog()
About_dialog()
def on_accounts_menuitem_activate(self, widget):
if self.plugin.windows.has_key('accounts'):
@ -1164,11 +1163,6 @@ class Roster_window:
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui'))
self.draw_roster()
def get_contacts_list(self):
for acc in self.plugin.accounts.keys():
print self.contacts[acc]
def iconCellDataFunc(self, column, renderer, model, iter, data=None):
"""When a row is added, set properties for icon renderer"""
if model.get_value(iter, 2) == 'account':