timeout in popup. I will also do the rest

This commit is contained in:
Nikos Kouremenos 2005-04-04 19:27:06 +00:00
parent 6c10fe9a7b
commit 474fe3447e
3 changed files with 38 additions and 66 deletions

View File

@ -781,17 +781,30 @@ class Popup_window:
def __init__(self, plugin=None, account=None): def __init__(self, plugin=None, account=None):
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP)
self.window = self.xml.get_widget('popup_window') xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP)
self.window = xml.get_widget('popup_window')
close_button = xml.get_widget('close_button')
self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('green')) self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('green'))
# position the window to bottom-right of screen # position the window to bottom-right of screen
gtk.gdk.flush() gtk.gdk.flush()
window_width, window_height = self.window.get_size() window_width, window_height = self.window.get_size()
self.window.move(gtk.gdk.screen_width() - window_width, gtk.gdk.screen_height() - window_height) self.plugin.roster.popups_height += window_height
self.window.move(gtk.gdk.screen_width() - window_width, \
gtk.gdk.screen_height() - self.plugin.roster.popups_height)
self.xml.signal_autoconnect(self) xml.signal_autoconnect(self)
close_button.connect('clicked', self.on_close_button_clicked, window_height)
self.window.show_all() self.window.show_all()
def on_close_button_clicked(self, widget): gobject.timeout_add(5000, self.on_timeout, window_height)
self.window.hide()
def on_close_button_clicked(self, widget, window_height):
self.plugin.roster.popups_height -= window_height
widget.get_toplevel().destroy()
def on_timeout(self, window_height):
self.plugin.roster.popups_height -= window_height
self.window.destroy()

View File

@ -9877,21 +9877,6 @@ send a chat message to</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child>
<widget class="GtkImage" id="event_image">
<property name="visible">True</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">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="event_label"> <widget class="GtkLabel" id="event_label">
<property name="visible">True</property> <property name="visible">True</property>
@ -9923,7 +9908,6 @@ send a chat message to</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Mon, 04 Apr 2005 16:34:50 GMT"/>
<child> <child>
<widget class="GtkImage" id="image496"> <widget class="GtkImage" id="image496">
@ -9951,27 +9935,6 @@ send a chat message to</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkHBox" id="hbox2946">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkImage" id="status_image">
<property name="visible">True</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">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="jid_label"> <widget class="GtkLabel" id="jid_label">
<property name="visible">True</property> <property name="visible">True</property>
@ -9990,13 +9953,6 @@ send a chat message to</property>
<property name="single_line_mode">False</property> <property name="single_line_mode">False</property>
<property name="angle">0</property> <property name="angle">0</property>
</widget> </widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>
<property name="expand">True</property> <property name="expand">True</property>

View File

@ -909,7 +909,9 @@ class Roster_window:
Popup_window(self.plugin) Popup_window(self.plugin)
def on_accounts_menuitem_activate(self, widget): def on_accounts_menuitem_activate(self, widget):
if not self.plugin.windows.has_key('accounts'): if self.plugin.windows.has_key('accounts'):
self.plugin.windows['accounts'].present()
else:
self.plugin.windows['accounts'] = Accounts_window(self.plugin) self.plugin.windows['accounts'] = Accounts_window(self.plugin)
def close_all(self, dic): def close_all(self, dic):
@ -1305,6 +1307,7 @@ class Roster_window:
self.window.show_all() self.window.show_all()
self.groups = {} self.groups = {}
self.contacts = {} self.contacts = {}
self.popups_height = 0
for a in self.plugin.accounts.keys(): for a in self.plugin.accounts.keys():
self.contacts[a] = {} self.contacts[a] = {}
self.groups[a] = {} self.groups[a] = {}