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

@ -50,6 +50,8 @@ class DetailsTab(Tab):
self._name = "Details"
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",)),
@ -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

@ -239,7 +239,7 @@ class FilesTab(Tab):
self.listview.move_column_after(column, None)
else:
self.listview.move_column_after(column, self.listview.get_columns()[column_state.position - 1])
def update(self):
# Get the first selected torrent
torrent_id = component.get("TorrentView").get_selected_torrents()
@ -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

@ -43,6 +43,8 @@ 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")
@ -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

@ -62,6 +62,8 @@ class PeersTab(Tab):
self._name = "Peers"
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
@ -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)
@ -146,7 +154,7 @@ class Signals(component.Component):
if self.config["show_new_releases"]:
from deluge.ui.gtkui.new_release_dialog import NewReleaseDialog
NewReleaseDialog().show(value)
def args_from_external(self, value):
log.debug("args_from_external: %s", value)
import ipcinterface

View File

@ -67,6 +67,8 @@ class StatisticsTab(Tab):
self._name = "Statistics"
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")),
@ -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

@ -234,6 +234,17 @@ class SystemTray(component.Component):
del self.tray_menu
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"""
@ -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()