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._tab_label = glade.get_widget("details_tab_label")
self._child_widget.connect("button-press-event", self.on_button_press_event)
self.label_widgets = [
(glade.get_widget("summary_name"), None, ("name",)),
(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",))
]
def on_button_press_event(self, widget, event):
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()
def update(self):
# Get the first selected torrent
selected = component.get("TorrentView").get_selected_torrents()

View file

@ -376,8 +376,6 @@ class FilesTab(Tab):
def _on_button_press_event(self, widget, event):
"""This is a callback for showing the right-click context menu."""
log.debug("on_button_press_event")
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()
# We only care about right-clicks
if event.button == 3:
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("drag-data-received", self.on_drag_data_received_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 \
self.config["enable_system_tray"]) and not \
@ -116,7 +117,7 @@ class MainWindow(component.Component):
component.resume("TorrentDetails")
except:
pass
self.window.present()
self.load_window_state()
@ -199,3 +200,6 @@ class MainWindow(component.Component):
args.append(urllib.unquote(urlparse(uri).path))
process_args(args)
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):
if self.config["ntf_tray_blink"]:
self.blink()
self.tray.blink(True)
if self.config["ntf_popup"] or self.config["ntf_email"]:
self.get_torrent_status(torrent_id)
@ -61,14 +61,6 @@ class Notification:
self.email(status)
if self.config["ntf_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):
"""popups up notification of finished torrent"""

View file

@ -43,8 +43,6 @@ class OptionsTab(Tab):
self._name = "Options"
self._child_widget = glade.get_widget("options_tab")
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_upload = glade.get_widget("spin_max_upload")
@ -79,10 +77,6 @@ class OptionsTab(Tab):
def stop(self):
pass
def on_button_press_event(self, widget, event):
from deluge.ui.gtkui.notification import Notification
Notification().stop_blink()
def update(self):
# Get the first selected torrent

View file

@ -68,8 +68,6 @@ class PeersTab(Tab):
self._child_widget = glade.get_widget("peers_tab")
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")
# 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)
@ -168,10 +166,6 @@ class PeersTab(Tab):
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):
filename = "peers_tab.state"
state = []

View file

@ -68,8 +68,6 @@ class StatisticsTab(Tab):
self._child_widget = glade.get_widget("statistics_tab")
self._tab_label = glade.get_widget("statistics_tab_label")
self._child_widget.connect("button-press-event", self.on_button_press_event)
self.label_widgets = [
(glade.get_widget("summary_pieces"), fpeer_size_second, ("num_pieces", "piece_length")),
(glade.get_widget("summary_availability"), fratio, ("distributed_copies",)),
@ -148,7 +146,3 @@ class StatisticsTab(Tab):
widget[0].set_text("")
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:
log.debug("Unable to disable system tray: %s", e)
def on_set_tray_flashing_off(self):
"""makes the tray icon stop blinking"""
if self.tray.get_blinking():
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 blink(self, value):
self.tray.set_blinking(value)
#def on_set_tray_flashing_off(self):
# """makes the tray icon stop blinking"""
# if self.tray.get_blinking():
# 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):
"""Called whenever the 'enable_system_tray' config key is modified"""
@ -255,7 +258,8 @@ class SystemTray(component.Component):
def on_tray_clicked(self, icon):
"""Called when the tray icon is left clicked."""
self.on_set_tray_flashing_off()
self.blink(False)
if self.window.active():
self.window.hide()
else:
@ -266,7 +270,8 @@ class SystemTray(component.Component):
def on_tray_popup(self, status_icon, button, activate_time):
"""Called when the tray icon is right clicked."""
self.on_set_tray_flashing_off()
self.blink(False)
if self.window.visible():
self.tray_glade.get_widget("menuitem_show_deluge").set_active(True)
else:

View file

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