Fix Notification stop icon blinking when window is exposed.

This commit is contained in:
Andrew Resch 2008-08-15 18:35:29 +00:00
commit 00ed73f453
9 changed files with 23 additions and 51 deletions

View file

@ -51,8 +51,6 @@ class DetailsTab(Tab):
self._child_widget = glade.get_widget("details_tab") self._child_widget = glade.get_widget("details_tab")
self._tab_label = glade.get_widget("details_tab_label") self._tab_label = glade.get_widget("details_tab_label")
self._child_widget.connect("button-press-event", self.on_button_press_event)
self.label_widgets = [ self.label_widgets = [
(glade.get_widget("summary_name"), None, ("name",)), (glade.get_widget("summary_name"), None, ("name",)),
(glade.get_widget("summary_total_size"), deluge.common.fsize, ("total_size",)), (glade.get_widget("summary_total_size"), deluge.common.fsize, ("total_size",)),
@ -63,10 +61,6 @@ class DetailsTab(Tab):
(glade.get_widget("summary_hash"), str, ("hash",)) (glade.get_widget("summary_hash"), str, ("hash",))
] ]
def on_button_press_event(self, widget, event):
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()
def update(self): def update(self):
# Get the first selected torrent # Get the first selected torrent
selected = component.get("TorrentView").get_selected_torrents() selected = component.get("TorrentView").get_selected_torrents()

View file

@ -376,8 +376,6 @@ class FilesTab(Tab):
def _on_button_press_event(self, widget, event): def _on_button_press_event(self, widget, event):
"""This is a callback for showing the right-click context menu.""" """This is a callback for showing the right-click context menu."""
log.debug("on_button_press_event") log.debug("on_button_press_event")
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()
# We only care about right-clicks # We only care about right-clicks
if event.button == 3: if event.button == 3:
x, y = event.get_coords() x, y = event.get_coords()

View file

@ -77,6 +77,7 @@ class MainWindow(component.Component):
self.window.connect("delete-event", self.on_window_delete_event) self.window.connect("delete-event", self.on_window_delete_event)
self.window.connect("drag-data-received", self.on_drag_data_received_event) self.window.connect("drag-data-received", self.on_drag_data_received_event)
self.vpaned.connect("notify::position", self.on_vpaned_position_event) self.vpaned.connect("notify::position", self.on_vpaned_position_event)
self.window.connect("expose-event", self.on_expose_event)
if not(self.config["start_in_tray"] and \ if not(self.config["start_in_tray"] and \
self.config["enable_system_tray"]) and not \ self.config["enable_system_tray"]) and not \
@ -199,3 +200,6 @@ class MainWindow(component.Component):
args.append(urllib.unquote(urlparse(uri).path)) args.append(urllib.unquote(urlparse(uri).path))
process_args(args) process_args(args)
drag_context.finish(True, True) drag_context.finish(True, True)
def on_expose_event(self, widget, event):
component.get("SystemTray").blink(False)

View file

@ -44,7 +44,7 @@ class Notification:
def notify(self, torrent_id): def notify(self, torrent_id):
if self.config["ntf_tray_blink"]: if self.config["ntf_tray_blink"]:
self.blink() self.tray.blink(True)
if self.config["ntf_popup"] or self.config["ntf_email"]: if self.config["ntf_popup"] or self.config["ntf_email"]:
self.get_torrent_status(torrent_id) self.get_torrent_status(torrent_id)
@ -62,14 +62,6 @@ class Notification:
if self.config["ntf_sound"]: if self.config["ntf_sound"]:
self.sound() self.sound()
def blink(self):
"""blinks the tray icon"""
self.tray.on_set_tray_flashing_on()
def stop_blink(self):
"""stops blinking the tray icon"""
self.tray.on_set_tray_flashing_off()
def popup(self, status): def popup(self, status):
"""popups up notification of finished torrent""" """popups up notification of finished torrent"""
if not deluge.common.windows_check(): if not deluge.common.windows_check():

View file

@ -44,8 +44,6 @@ class OptionsTab(Tab):
self._child_widget = glade.get_widget("options_tab") self._child_widget = glade.get_widget("options_tab")
self._tab_label = glade.get_widget("options_tab_label") self._tab_label = glade.get_widget("options_tab_label")
self._child_widget.connect("button-press-event", self.on_button_press_event)
self.spin_max_download = glade.get_widget("spin_max_download") self.spin_max_download = glade.get_widget("spin_max_download")
self.spin_max_upload = glade.get_widget("spin_max_upload") self.spin_max_upload = glade.get_widget("spin_max_upload")
self.spin_max_connections = glade.get_widget("spin_max_connections") self.spin_max_connections = glade.get_widget("spin_max_connections")
@ -80,10 +78,6 @@ class OptionsTab(Tab):
def stop(self): def stop(self):
pass pass
def on_button_press_event(self, widget, event):
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()
def update(self): def update(self):
# Get the first selected torrent # Get the first selected torrent
torrent_id = component.get("TorrentView").get_selected_torrents() torrent_id = component.get("TorrentView").get_selected_torrents()

View file

@ -68,8 +68,6 @@ class PeersTab(Tab):
self._child_widget = glade.get_widget("peers_tab") self._child_widget = glade.get_widget("peers_tab")
self._tab_label = glade.get_widget("peers_tab_label") self._tab_label = glade.get_widget("peers_tab_label")
self._child_widget.connect("button-press-event", self.on_button_press_event)
self.listview = glade.get_widget("peers_listview") self.listview = glade.get_widget("peers_listview")
# country pixbuf, ip, client, downspeed, upspeed, country code, int_ip, seed/peer icon, progress # country pixbuf, ip, client, downspeed, upspeed, country code, int_ip, seed/peer icon, progress
self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int, str, gobject.TYPE_UINT, gtk.gdk.Pixbuf, float) self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int, str, gobject.TYPE_UINT, gtk.gdk.Pixbuf, float)
@ -168,10 +166,6 @@ class PeersTab(Tab):
self.torrent_id = None self.torrent_id = None
def on_button_press_event(self, widget, event):
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()
def save_state(self): def save_state(self):
filename = "peers_tab.state" filename = "peers_tab.state"
state = [] state = []

View file

@ -68,8 +68,6 @@ class StatisticsTab(Tab):
self._child_widget = glade.get_widget("statistics_tab") self._child_widget = glade.get_widget("statistics_tab")
self._tab_label = glade.get_widget("statistics_tab_label") self._tab_label = glade.get_widget("statistics_tab_label")
self._child_widget.connect("button-press-event", self.on_button_press_event)
self.label_widgets = [ self.label_widgets = [
(glade.get_widget("summary_pieces"), fpeer_size_second, ("num_pieces", "piece_length")), (glade.get_widget("summary_pieces"), fpeer_size_second, ("num_pieces", "piece_length")),
(glade.get_widget("summary_availability"), fratio, ("distributed_copies",)), (glade.get_widget("summary_availability"), fratio, ("distributed_copies",)),
@ -148,7 +146,3 @@ class StatisticsTab(Tab):
widget[0].set_text("") widget[0].set_text("")
component.get("MainWindow").main_glade.get_widget("progressbar").set_fraction(0.0) component.get("MainWindow").main_glade.get_widget("progressbar").set_fraction(0.0)
def on_button_press_event(self, widget, event):
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()

View file

@ -235,16 +235,19 @@ class SystemTray(component.Component):
except Exception, e: except Exception, e:
log.debug("Unable to disable system tray: %s", e) log.debug("Unable to disable system tray: %s", e)
def on_set_tray_flashing_off(self): def blink(self, value):
"""makes the tray icon stop blinking""" self.tray.set_blinking(value)
if self.tray.get_blinking():
log.debug("stop blinking the tray icon..")
self.tray.set_blinking(False)
def on_set_tray_flashing_on(self): #def on_set_tray_flashing_off(self):
"""makes the tray icon blink""" # """makes the tray icon stop blinking"""
log.debug("start blinking the tray icon..") # if self.tray.get_blinking():
self.tray.set_blinking(True) # log.debug("stop blinking the tray icon..")
# self.tray.set_blinking(False)
#
#def on_set_tray_flashing_on(self):
# """makes the tray icon blink"""
# log.debug("start blinking the tray icon..")
# self.tray.set_blinking(True)
def on_enable_system_tray_set(self, key, value): def on_enable_system_tray_set(self, key, value):
"""Called whenever the 'enable_system_tray' config key is modified""" """Called whenever the 'enable_system_tray' config key is modified"""
@ -255,7 +258,8 @@ class SystemTray(component.Component):
def on_tray_clicked(self, icon): def on_tray_clicked(self, icon):
"""Called when the tray icon is left clicked.""" """Called when the tray icon is left clicked."""
self.on_set_tray_flashing_off() self.blink(False)
if self.window.active(): if self.window.active():
self.window.hide() self.window.hide()
else: else:
@ -266,7 +270,8 @@ class SystemTray(component.Component):
def on_tray_popup(self, status_icon, button, activate_time): def on_tray_popup(self, status_icon, button, activate_time):
"""Called when the tray icon is right clicked.""" """Called when the tray icon is right clicked."""
self.on_set_tray_flashing_off() self.blink(False)
if self.window.visible(): if self.window.visible():
self.tray_glade.get_widget("menuitem_show_deluge").set_active(True) self.tray_glade.get_widget("menuitem_show_deluge").set_active(True)
else: else:

View file

@ -428,9 +428,6 @@ class TorrentView(listview.ListView, component.Component):
def on_button_press_event(self, widget, event): def on_button_press_event(self, widget, event):
"""This is a callback for showing the right-click context menu.""" """This is a callback for showing the right-click context menu."""
log.debug("on_button_press_event") log.debug("on_button_press_event")
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()
# We only care about right-clicks # We only care about right-clicks
if event.button == 3: if event.button == 3:
x, y = event.get_coords() x, y = event.get_coords()