diff --git a/deluge/ui/gtkui/details_tab.py b/deluge/ui/gtkui/details_tab.py index b0c5c185c..2fc7c6f17 100644 --- a/deluge/ui/gtkui/details_tab.py +++ b/deluge/ui/gtkui/details_tab.py @@ -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() diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index 12198908b..fb97c40bc 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -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() diff --git a/deluge/ui/gtkui/options_tab.py b/deluge/ui/gtkui/options_tab.py index f73f9a10f..194c5d825 100644 --- a/deluge/ui/gtkui/options_tab.py +++ b/deluge/ui/gtkui/options_tab.py @@ -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() diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py index f5e9aa7b5..703fa9169 100644 --- a/deluge/ui/gtkui/peers_tab.py +++ b/deluge/ui/gtkui/peers_tab.py @@ -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 = [] diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index 9a1b8a781..5bc9d43bc 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -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( diff --git a/deluge/ui/gtkui/signals.py b/deluge/ui/gtkui/signals.py index b7021619f..7df73f706 100644 --- a/deluge/ui/gtkui/signals.py +++ b/deluge/ui/gtkui/signals.py @@ -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 diff --git a/deluge/ui/gtkui/statistics_tab.py b/deluge/ui/gtkui/statistics_tab.py index 6ee6f11a1..595244aa2 100644 --- a/deluge/ui/gtkui/statistics_tab.py +++ b/deluge/ui/gtkui/statistics_tab.py @@ -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() diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py index b8c4c094f..451856ea7 100644 --- a/deluge/ui/gtkui/systemtray.py +++ b/deluge/ui/gtkui/systemtray.py @@ -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: diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index cf6f8fa3d..0f3c2bbdb 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -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()