From 832872f5475518a2bad67e177ce1c6cd6b6287cd Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Wed, 2 Mar 2005 18:38:27 +0000 Subject: [PATCH] commit before massively user --> User --- plugins/gtkgui/dialogs.py | 64 ++++++++++++++++++------------------- plugins/gtkgui/gtkgui.glade | 9 ++++-- plugins/gtkgui/gtkgui.py | 12 ++----- 3 files changed, 40 insertions(+), 45 deletions(-) diff --git a/plugins/gtkgui/dialogs.py b/plugins/gtkgui/dialogs.py index a26c1945c..ba85db734 100644 --- a/plugins/gtkgui/dialogs.py +++ b/plugins/gtkgui/dialogs.py @@ -454,11 +454,11 @@ class add_contact_window: agent_combobox.set_active(jid_agents.index(jid_splited[1])+1) self.xml.signal_autoconnect(self) -class about_window: #FIXME: (nk) pygtk2.6 has a built-in window for that +class about_window: #FIXME REWRITE: (nk) pygtk2.6 has a built-in window for that """Class for about window""" def delete_event(self, widget): """close window""" - del self.plugin.windows['about'] + del self.plugin.windows['about'] # remove us from open windows def on_close(self, widget): """When Close button is clicked""" @@ -467,13 +467,13 @@ class about_window: #FIXME: (nk) pygtk2.6 has a built-in window for that def __init__(self, plugin): xml = gtk.glade.XML(GTKGUI_GLADE, 'about_window', APP) self.window = xml.get_widget('about_window') - logo_image = xml.get_widget('logo_image') - logo_image.set_from_file('plugins/gtkgui/pixmaps/logo.png') + xml.get_widget('logo_image').set_from_file('plugins/gtkgui/pixmaps/logo.png') self.plugin = plugin xml.signal_connect('gtk_widget_destroy', self.delete_event) xml.signal_connect('on_close_clicked', self.on_close) - + + self.plugin.windows['about'] = self # add us to open windows class confirm_dialog: """Class for confirmation dialog""" @@ -529,7 +529,7 @@ class subscription_request_window: class join_groupchat_window: def on_join_groupchat_window_destroy(self, widget): """close window""" - del self.plugin.windows['join_gc'] + del self.plugin.windows['join_gc'] # remove us from open windows def on_close_button_clicked(self, widget): """When Cancel button is clicked""" @@ -562,43 +562,41 @@ class join_groupchat_window: self.xml.get_widget('nickname_entry').\ set_text(self.plugin.nicks[self.account]) self.xml.signal_autoconnect(self) + self.plugin.windows['join_gc'] = self # now add us to open windows class new_message_window: #FIXME: NOT READY - def delete_event(self, widget): + def on_delete_event(self, widget): """close window""" - del self.plugin.windows['join_gc'] + del self.plugin.windows['new_msg'] - def on_close(self, widget): + def on_cancel_button_clicked(self, widget): """When Cancel button is clicked""" widget.get_toplevel().destroy() - def on_join(self, widget): - """When Join button is clicked""" - nick = self.xml.get_widget('entry_nick').get_text() - room = self.xml.get_widget('entry_room').get_text() - server = self.xml.get_widget('entry_server').get_text() - passw = self.xml.get_widget('entry_pass').get_text() - jid = '%s@%s' % (room, server) - self.plugin.windows[self.account]['gc'][jid] = gtkgui.gc(jid, nick, \ - self.plugin, self.account) - #TODO: verify entries - self.plugin.send('GC_JOIN', self.account, (nick, room, server, passw)) + def on_chat_button_clicked(self, widget): + """When Chat button is clicked""" + print 'chat btn clicked' + userid = self.xml.get_widget('userid_comboboxentry').child.get_text() + #FIXME: if the user doesn't give jid, but name look in the roster + #DO IT WITH AUTOCOMPLETE + #SO USER ID SHOULD BECOME JID and sent to new_chat() + jid = userid + + user = gtkgui.user(jid, name .....) + + # use User class, new_chat expects that + user().jid = jid + + self.plugin.roster.new_chat(jid, self.account) widget.get_toplevel().destroy() - def __init__(self, plugin, account, server='', room = ''): - #FIXME: - return True - + def __init__(self, plugin, account): if not plugin.connected[account]: - warning_dialog(_("You must be connected to join a group chat on this server")) + warning_dialog(_('You must be connected to send a message to a contact')) return self.plugin = plugin self.account = account - self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Join_gc', APP) - self.window = self.xml.get_widget('Join_gc') - self.xml.get_widget('entry_server').set_text(server) - self.xml.get_widget('entry_room').set_text(room) - self.xml.get_widget('entry_nick').set_text(self.plugin.nicks[self.account]) - self.xml.signal_connect('gtk_widget_destroy', self.delete_event) - self.xml.signal_connect('on_cancel_clicked', self.on_close) - self.xml.signal_connect('on_join_clicked', self.on_join) + self.xml = gtk.glade.XML(GTKGUI_GLADE, 'new_message_window', APP) + self.window = self.xml.get_widget('new_message_window') + self.xml.signal_autoconnect(self) + self.plugin.windows['new_message'] = self # now add us to open windows diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index b94ead304..4feab5779 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -8241,6 +8241,7 @@ Custom False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST + @@ -8301,7 +8302,7 @@ send a chat message to - + True @@ -8315,10 +8316,10 @@ send a chat message to True GTK_BUTTONBOX_END - 0 + 5 - + True True True @@ -8326,6 +8327,7 @@ send a chat message to True GTK_RELIEF_NORMAL True + @@ -8336,6 +8338,7 @@ send a chat message to True GTK_RELIEF_NORMAL True + diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index f82312f38..0ddee9339 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -2028,22 +2028,17 @@ class roster_window: def on_join_gc(self, widget, account): """When Join Groupchat is selected : call the join_gc class""" - if not self.plugin.windows.has_key('join_gc'): - self.plugin.windows['join_gc'] = \ - join_groupchat_window(self.plugin, account) + join_groupchat_window(self.plugin, account) def on_new_message_menuitem_activate(self, widget, account): """When New Message is activated: call the new_message_window class""" - if not self.plugin.windows.has_key('new_message'): - self.plugin.windows['new_message'] = \ - new_message_window(self.plugin, account) + new_message_window(self.plugin, account) def on_about_menuitem_activate(self, widget): """When about is selected : call the about class""" - if not self.plugin.windows.has_key('about'): - self.plugin.windows['about'] = about_window(self.plugin) + about_window(self.plugin) def on_accounts_menuitem_activate(self, widget): """When accounts is seleted : @@ -2366,7 +2361,6 @@ class roster_window: self.window.set_title(start + " Gajim") def __init__(self, plugin): - # FIXME : handle no file ... self.xml = gtk.glade.XML(GTKGUI_GLADE, 'gajim_window', APP) self.window = self.xml.get_widget('gajim_window') self.tree = self.xml.get_widget('roster_treeview')