mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-14 05:26:28 +00:00
event loggin plugin and libtorrent cleanup
This commit is contained in:
parent
908430aae4
commit
692b0b507d
291
plugins/EventLogging/__init__.py
Normal file
291
plugins/EventLogging/__init__.py
Normal file
@ -0,0 +1,291 @@
|
||||
# Copyright (C) 2007 - Micah Bucy <eternalsword@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
### Initialization ###
|
||||
|
||||
plugin_name = _("Event Logging")
|
||||
plugin_author = "Micah Bucy"
|
||||
plugin_version = "0.1"
|
||||
plugin_description = _("""
|
||||
Adds a tab with log of selected events.
|
||||
|
||||
Event messages come from libtorrent alerts.
|
||||
If you want those strings translated to your locale,
|
||||
you'll have to report the issue with libtorrent, not deluge.
|
||||
""")
|
||||
|
||||
def deluge_init(deluge_path):
|
||||
global path
|
||||
path = deluge_path
|
||||
|
||||
def enable(core, interface):
|
||||
global path
|
||||
return EventLogging(path, core, interface)
|
||||
|
||||
### The Plugin ###
|
||||
import deluge
|
||||
import gtk
|
||||
from EventLogging.tab_log import LogManager
|
||||
|
||||
class EventLogging:
|
||||
|
||||
def __init__(self, path, core, interface):
|
||||
print "Loading LogEvents plugin..."
|
||||
self.manager = core
|
||||
self.parent = interface
|
||||
# Create an options file and try to load existing Values
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/event_logging.conf"
|
||||
self.config = deluge.pref.Preferences(self.config_file)
|
||||
try:
|
||||
self.config.load()
|
||||
except IOError:
|
||||
# File does not exist
|
||||
pass
|
||||
|
||||
self.glade = gtk.glade.XML(path + "/event_logging_preferences.glade")
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
self.glade.signal_autoconnect({
|
||||
'toggle_ui': self.toggle_ui
|
||||
})
|
||||
self.viewport = gtk.Viewport()
|
||||
self.scrolledWindow = gtk.ScrolledWindow()
|
||||
self.scrolledWindow.add(self.viewport)
|
||||
self.scrolledWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
|
||||
self.topWidget = self.scrolledWindow
|
||||
|
||||
self.parentNotebook = self.parent.notebook
|
||||
|
||||
self.parentNotebook.append_page(self.topWidget, gtk.Label(_("Event Log")))
|
||||
self.viewport.show()
|
||||
self.scrolledWindow.show()
|
||||
self.tab_log = LogManager(self.viewport, self.manager)
|
||||
if self.config.get("enable_finished"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_FINISHED'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_peer_error"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_PEER_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_invalid_request"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_INVALID_REQUEST'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_file_error"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_FILE_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_hash_failed_error"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_HASH_FAILED_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_peer_ban_error"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_PEER_BAN_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_fastresume_rejected_error"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_FASTRESUME_REJECTED_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_tracker_announce"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_TRACKER_ANNOUNCE'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_tracker_reply"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_TRACKER_REPLY'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_tracker_alert"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_TRACKER_ALERT'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_tracker_warning"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_TRACKER_WARNING'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_storage_moved"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_STORAGE_MOVED'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_piece_finished"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_PIECE_FINISHED'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_block_downloading"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_BLOCK_DOWNLOADING'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_block_finished"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_BLOCK_FINISHED'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_other"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_OTHER'], self.tab_log.handle_event)
|
||||
self.tab_log.prepare_log_store()
|
||||
|
||||
def unload(self):
|
||||
self.config.save(self.config_file)
|
||||
if self.config.get("enable_finished"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_FINISHED'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_peer_error"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_PEER_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_invalid_request"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_INVALID_REQUEST'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_file_error"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_FILE_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_hash_failed_error"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_HASH_FAILED_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_peer_ban_error"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_PEER_BAN_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_fastresume_rejected_error"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_FASTRESUME_REJECTED_ERROR'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_tracker_announce"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_TRACKER_ANNOUNCE'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_tracker_reply"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_TRACKER_REPLY'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_tracker_alert"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_TRACKER_ALERT'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_tracker_warning"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_TRACKER_WARNING'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_storage_moved"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_STORAGE_MOVED'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_piece_finished"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_PIECE_FINISHED'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_block_downloading"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_BLOCK_DOWNLOADING'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_block_finished"):
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_BLOCK_FINISHED'], self.tab_log.handle_event)
|
||||
if self.config.get("enable_other"):
|
||||
self.manager.connect_event(self.manager.constants['EVENT_OTHER'], self.tab_log.handle_event)
|
||||
self.tab_log.clear_log_store()
|
||||
numPages = self.parentNotebook.get_n_pages()
|
||||
for page in xrange(numPages):
|
||||
if self.parentNotebook.get_nth_page(page) == self.topWidget:
|
||||
self.parentNotebook.remove_page(page)
|
||||
break
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def toggle_ui(self, widget):
|
||||
value = widget.get_active()
|
||||
if widget == self.glade.get_widget("chk_finished"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_FINISHED'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_FINISHED'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_peer_error"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_PEER_ERROR'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_PEER_ERROR'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_invalid_request"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_INVALID_REQUEST'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_INVALID_REQUEST'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_file_error"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_FILE_ERROR'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_FILE_ERROR'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_hash_failed_error"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_HASH_FAILED_ERROR'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_HASH_FAILED_ERROR'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_peer_ban_error"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_PEER_BAN_ERROR'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_PEER_BAN_ERROR'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_fastresume_rejected_error"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_FASTRESUME_REJECTED_ERROR'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_FASTRESUME_REJECTED_ERROR'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_tracker_announce"):
|
||||
if value:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_TRACKER_ANNOUNCE'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_TRACKER_ANNOUNCE'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_tracker_reply"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_TRACKER_REPLY'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_TRACKER_REPLY'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_tracker_alert"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_TRACKER_ALERT'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_TRACKER_ALERT'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_tracker_warning"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_TRACKER_WARNING'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_TRACKER_WARNING'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_storage_moved"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_STORAGE_MOVED'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_STORAGE_MOVED'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_piece_finished"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_PIECE_FINISHED'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_PIECE_FINISHED'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_block_downloading"):
|
||||
if value:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_BLOCK_DOWNLOADING'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_BLOCK_DOWNLOADING'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_block_finished"):
|
||||
if value:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_BLOCK_FINISHED'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_BLOCK_FINISHED'], self.tab_log.handle_event)
|
||||
if widget == self.glade.get_widget("chk_other"):
|
||||
if value:
|
||||
self.manager.disconnect_event(self.manager.constants['EVENT_OTHER'], self.tab_log.handle_event)
|
||||
else:
|
||||
self.manager.connect_event(self.manager.constants['EVENT_OTHER'], self.tab_log.handle_event)
|
||||
|
||||
def configure(self):
|
||||
try:
|
||||
self.glade.get_widget("chk_finished").set_active(self.config.get("enable_finished"))
|
||||
self.glade.get_widget("chk_peer_error").set_active(self.config.get("enable_peer_error"))
|
||||
self.glade.get_widget("chk_invalid_request").set_active(self.config.get("enable_invalid_request"))
|
||||
self.glade.get_widget("chk_file_error").set_active(self.config.get("enable_file_error"))
|
||||
self.glade.get_widget("chk_hash_failed_error").set_active(self.config.get("enable_hash_failed_error"))
|
||||
self.glade.get_widget("chk_peer_ban_error").set_active(self.config.get("enable_peer_ban_error"))
|
||||
self.glade.get_widget("chk_fastresume_rejected_error").set_active(self.config.get("enable_fastresume_rejected_error"))
|
||||
self.glade.get_widget("chk_tracker_announce").set_active(self.config.get("enable_tracker_announce"))
|
||||
self.glade.get_widget("chk_tracker_reply").set_active(self.config.get("enable_tracker_reply"))
|
||||
self.glade.get_widget("chk_tracker_alert").set_active(self.config.get("enable_tracker_alert"))
|
||||
self.glade.get_widget("chk_tracker_warning").set_active(self.config.get("enable_tracker_warning"))
|
||||
self.glade.get_widget("chk_storage_moved").set_active(self.config.get("enable_storage_moved"))
|
||||
self.glade.get_widget("chk_piece_finished").set_active(self.config.get("enable_piece_finished"))
|
||||
self.glade.get_widget("chk_block_downloading").set_active(self.config.get("enable_block_downloading"))
|
||||
self.glade.get_widget("chk_block_finished").set_active(self.config.get("enable_block_finished"))
|
||||
self.glade.get_widget("chk_other").set_active(self.config.get("enable_other"))
|
||||
except:
|
||||
self.glade.get_widget("chk_finished").set_active(False)
|
||||
self.glade.get_widget("chk_peer_error").set_active(False)
|
||||
self.glade.get_widget("chk_invalid_request").set_active(False)
|
||||
self.glade.get_widget("chk_file_error").set_active(False)
|
||||
self.glade.get_widget("chk_hash_failed_error").set_active(False)
|
||||
self.glade.get_widget("chk_peer_ban_error").set_active(False)
|
||||
self.glade.get_widget("chk_fastresume_rejected_error").set_active(False)
|
||||
self.glade.get_widget("chk_tracker_announce").set_active(False)
|
||||
self.glade.get_widget("chk_tracker_reply").set_active(False)
|
||||
self.glade.get_widget("chk_tracker_alert").set_active(False)
|
||||
self.glade.get_widget("chk_tracker_warning").set_active(False)
|
||||
self.glade.get_widget("chk_storage_moved").set_active(False)
|
||||
self.glade.get_widget("chk_piece_finished").set_active(False)
|
||||
self.glade.get_widget("chk_block_downloading").set_active(False)
|
||||
self.glade.get_widget("chk_block_finished").set_active(False)
|
||||
self.glade.get_widget("chk_other").set_active(False)
|
||||
self.dialog.show()
|
||||
response = self.dialog.run()
|
||||
self.dialog.hide()
|
||||
if response:
|
||||
self.config.set("enable_finished", self.glade.get_widget("chk_finished").get_active())
|
||||
self.config.set("enable_peer_error", self.glade.get_widget("chk_peer_error").get_active())
|
||||
self.config.set("enable_invalid_request", self.glade.get_widget("chk_invalid_request").get_active())
|
||||
self.config.set("enable_file_error", self.glade.get_widget("chk_file_error").get_active())
|
||||
self.config.set("enable_hash_failed_error", self.glade.get_widget("chk_hash_failed_error").get_active())
|
||||
self.config.set("enable_peer_ban_error", self.glade.get_widget("chk_peer_ban_error").get_active())
|
||||
self.config.set("enable_fastresume_rejected_error", self.glade.get_widget("chk_fastresume_rejected_error").get_active())
|
||||
self.config.set("enable_tracker_announce", self.glade.get_widget("chk_tracker_announce").get_active())
|
||||
self.config.set("enable_tracker_reply", self.glade.get_widget("chk_tracker_reply").get_active())
|
||||
self.config.set("enable_tracker_alert", self.glade.get_widget("chk_tracker_alert").get_active())
|
||||
self.config.set("enable_tracker_warning", self.glade.get_widget("chk_tracker_warning").get_active())
|
||||
self.config.set("enable_storage_moved", self.glade.get_widget("chk_storage_moved").get_active())
|
||||
self.config.set("enable_piece_finished", self.glade.get_widget("chk_piece_finished").get_active())
|
||||
self.config.set("enable_block_downloading", self.glade.get_widget("chk_block_downloading").get_active())
|
||||
self.config.set("enable_block_finished", self.glade.get_widget("chk_block_finished").get_active())
|
||||
self.config.set("enable_other", self.glade.get_widget("chk_other").get_active())
|
306
plugins/EventLogging/event_logging_preferences.glade
Normal file
306
plugins/EventLogging/event_logging_preferences.glade
Normal file
@ -0,0 +1,306 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--*- mode: xml -*-->
|
||||
<glade-interface>
|
||||
<widget class="GtkDialog" id="dialog">
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Event Logging Preferences</property>
|
||||
<property name="default_width">400</property>
|
||||
<property name="default_height">150</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">17</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Select events to log</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_finished">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Torrent finished</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_peer_error">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Peer messages</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_invalid_request">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Invalid request</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_file_error">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">File error</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_hash_failed_error">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Hash failed error</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_peer_ban_error">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Peer ban error</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_fastresume_rejected_error">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Fastresume rejected error</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_tracker_announce">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Tracker announce</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_tracker_reply">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Tracker reply</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_tracker_alert">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Tracker alert</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="bottom_attach">11</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_tracker_warning">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Tracker warning</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">11</property>
|
||||
<property name="bottom_attach">12</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_storage_moved">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Storage moved</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">12</property>
|
||||
<property name="bottom_attach">13</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_piece_finished">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Piece finished</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">13</property>
|
||||
<property name="bottom_attach">14</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_block_downloading">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Block downloading</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">14</property>
|
||||
<property name="bottom_attach">15</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_block_finished">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Block finished</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">15</property>
|
||||
<property name="bottom_attach">16</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_other">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Other</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">16</property>
|
||||
<property name="bottom_attach">17</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="fill">False</property>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="button_cancel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="button_ok">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
|
82
plugins/EventLogging/tab_log.py
Normal file
82
plugins/EventLogging/tab_log.py
Normal file
@ -0,0 +1,82 @@
|
||||
import gtk
|
||||
|
||||
class LogManager(object):
|
||||
def __init__(self, viewport, manager):
|
||||
self.viewport = viewport
|
||||
self.vbox = None
|
||||
self.manager = manager
|
||||
|
||||
def clear_log_store(self):
|
||||
if not self.vbox is None:
|
||||
self.vbox.destroy()
|
||||
self.vbox = None
|
||||
|
||||
def prepare_log_store(self):
|
||||
self.vbox = gtk.VBox()
|
||||
self.viewport.add(self.vbox)
|
||||
self.vbox.show_all()
|
||||
|
||||
def handle_event(self, event):
|
||||
event_message = None
|
||||
if event['event_type'] is self.manager.constants['EVENT_FINISHED']:
|
||||
event_message = _("Torrent finished") + " {"+ _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_PEER_ERROR']:
|
||||
event_message = _("Peer message") + " {" + _("event message: ") + event['message'] + ", " + _("ip address: ")\
|
||||
+ event['ip'] + ", " + _("client: ") + event['client_ID'] + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_INVALID_REQUEST']:
|
||||
event_message = _("Invalid request") + " {" + _("event message: ") + event['message'] + ", " + _("client: ")\
|
||||
+ event['client_ID'] + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_FILE_ERROR']:
|
||||
event_message = _("File error") + " {" + _("event message: ") + event['message'] + ", " + _("torrent: ")\
|
||||
+ self.manager.unique_IDs[event['unique_ID']].filename + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_HASH_FAILED_ERROR']:
|
||||
event_message = _("Hash failed error") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + ", "\
|
||||
+ _("piece index: ") + str(event['piece_index']) + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_PEER_BAN_ERROR']:
|
||||
event_message = _("Peer ban error") + " {" + _("event message: ") + event['message'] + ", " + _("ip address: ")\
|
||||
+ event['ip'] + ", " + _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_FASTRESUME_REJECTED_ERROR']:
|
||||
event_message = _("Fastresume rejected error") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_TRACKER_ANNOUNCE']:
|
||||
event_message = _("Tracker announce") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_TRACKER_REPLY']:
|
||||
event_message = _("Tracker reply") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_TRACKER_ALERT']:
|
||||
event_message = _("Tracker alert") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + ", "\
|
||||
+ _("status code: ") + str(event['status_code']) + ", " + _("Times in a row: ")\
|
||||
+ str(event['times_in_row']) + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_TRACKER_WARNING']:
|
||||
event_message = _("Tracker warning") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_STORAGE_MOVED']:
|
||||
event_message = _("Storage moved") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_PIECE_FINISHED']:
|
||||
event_message = _("Piece finished") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + ", "\
|
||||
+ _("piece index: ") + str(event['piece_index']) + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_BLOCK_DOWNLOADING']:
|
||||
event_message = _("Block downloading") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + ", "\
|
||||
+ _("piece index: ") + str(event['piece_index']) + ", " + _("block index: ")\
|
||||
+ str(event['block_index']) + ", " + _("peer speed: ") + event['peer_speed'] + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_BLOCK_FINISHED']:
|
||||
event_message = _("Block finished") + " {" + _("event message: ") + event['message'] + ", "\
|
||||
+ _("torrent: ") + self.manager.unique_IDs[event['unique_ID']].filename + ", "\
|
||||
+ _("piece index: ") + str(event['piece_index']) + ", " + _("block index: ")\
|
||||
+ str(event['block_index']) + "}"
|
||||
if event['event_type'] is self.manager.constants['EVENT_OTHER']:
|
||||
event_message = _("Other") + " {" + _("event message: ") + event['message'] + "}"
|
||||
if not event_message is None:
|
||||
label = gtk.Label()
|
||||
label.set_text(event_message)
|
||||
label.set_alignment(0,0)
|
||||
label.set_selectable(True)
|
||||
self.vbox.pack_start(label, expand=False)
|
||||
label.show()
|
@ -32,3 +32,8 @@ plugins/BlocklistImport/test.py
|
||||
plugins/BlocklistImport/peerguardian.py
|
||||
plugins/TorrentPieces/__init__.py
|
||||
plugins/TorrentPieces/tab_pieces.py
|
||||
plugins/EventLogging/__init__.py
|
||||
plugins/EventLogging/tab_log.py
|
||||
plugins/EventLogging/event_logging_preferences.glade
|
||||
plugins/TorrentNotification/__init__.py
|
||||
plugins/TorrentNotification/notification_preferences.glade
|
||||
|
4
setup.py
4
setup.py
@ -152,8 +152,8 @@ if boosttype == "nomt":
|
||||
'boost_thread', 'z', 'pthread', 'ssl']
|
||||
print 'Libraries nomt'
|
||||
elif boosttype == "mt":
|
||||
librariestype = ['boost_filesystem-mt', 'boost_date_time-mt',
|
||||
'boost_thread-mt', 'z', 'pthread', 'ssl']
|
||||
librariestype = ['boost_filesystem', 'boost_date_time',
|
||||
'boost_thread', 'z', 'pthread', 'ssl']
|
||||
print 'Libraries mt'
|
||||
|
||||
def fetchCpp():
|
||||
|
Loading…
x
Reference in New Issue
Block a user