finish up notification - now fully works including email

This commit is contained in:
Marcos Pinto 2008-07-27 02:23:41 +00:00
parent 2ca1a61f32
commit cf42970943
9 changed files with 53 additions and 4 deletions

View File

@ -51,6 +51,8 @@ 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",)),
@ -61,6 +63,10 @@ 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,6 +376,8 @@ 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

@ -44,6 +44,8 @@ class OptionsTab(Tab):
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")
self.spin_max_connections = glade.get_widget("spin_max_connections")
@ -63,6 +65,10 @@ class OptionsTab(Tab):
"on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked
})
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
torrent_id = component.get("TorrentView").get_selected_torrents()

View File

@ -63,6 +63,8 @@ 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
self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int, str, gobject.TYPE_UINT, gtk.gdk.Pixbuf)
@ -148,6 +150,10 @@ 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

@ -426,8 +426,7 @@ class Preferences(component.Component):
self.gtkui_config["ntf_email"])
self.glade.get_widget("chk_ntf_sound").set_active(
self.gtkui_config["ntf_sound"])
self.glade.get_widget("combo_ntf_sound_path").set_filename(
self.gtkui_config["ntf_sound_path"])
self.glade.get_widget("combo_ntf_sound_path").set_filename(self.gtkui_config["ntf_sound_path"])
self.glade.get_widget("txt_ntf_email").set_text(
self.gtkui_config["ntf_email_add"])
self.glade.get_widget("txt_ntf_server").set_text(

View File

@ -75,6 +75,8 @@ class Signals(component.Component):
self.args_from_external)
self.receiver.connect_to_signal("torrent_state_changed",
self.torrent_state_changed)
self.receiver.connect_to_signal("torrent_finished",
self.torrent_finished)
def stop(self):
try:
@ -86,6 +88,12 @@ class Signals(component.Component):
"""Connects a callback to a signal"""
self.receiver.connect_to_signal(signal, callback)
def torrent_finished(self, torrent_id):
log.debug("torrent_finished signal received..")
log.debug("torrent id: %s", torrent_id)
from deluge.ui.gtkui.notification import Notification
Notification().notify(torrent_id)
def torrent_added_signal(self, torrent_id):
log.debug("torrent_added signal received..")
log.debug("torrent id: %s", torrent_id)

View File

@ -68,6 +68,8 @@ 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",)),
@ -146,3 +148,7 @@ 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,6 +235,17 @@ 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 on_enable_system_tray_set(self, key, value):
"""Called whenever the 'enable_system_tray' config key is modified"""
if value:
@ -244,6 +255,7 @@ class SystemTray(component.Component):
def on_tray_clicked(self, icon):
"""Called when the tray icon is left clicked."""
self.on_set_tray_flashing_off()
if self.window.active():
self.window.hide()
else:
@ -254,6 +266,7 @@ 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()
if self.window.visible():
self.tray_glade.get_widget("menuitem_show_deluge").set_active(True)
else:

View File

@ -446,6 +446,9 @@ 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()