turnicate - micah

This commit is contained in:
Marcos Pinto 2007-08-04 08:35:31 +00:00
parent 09558b82e4
commit 9ac7eed49b
2 changed files with 11 additions and 2 deletions

View File

@ -18,7 +18,7 @@
plugin_name = _("Event Logging")
plugin_author = "Micah Bucy"
plugin_version = "0.1"
plugin_version = "0.2"
plugin_description = _("""
Adds a tab with log of selected events.
@ -35,6 +35,10 @@ saved to logs named after the events
(eg peer_messages.log).
Event messages in the log files also include a timestamp.
The user is responsible to cleanout the logs.
As of v0.2
Events are now truncated in display. Log files are not.
New events are now displayed at the top.
""")
def deluge_init(deluge_path):

View File

@ -14,6 +14,7 @@ class LogManager(object):
self.logdir = os.path.join(CONFIG_DIR, 'logs')
if not os.path.isdir(self.logdir):
os.mkdir(self.logdir)
self.labels = []
def clear_log_store(self):
if not self.vbox is None:
@ -183,8 +184,12 @@ class LogManager(object):
logfile.close()
if not event_message is None:
label = gtk.Label()
self.labels.append(label)
label.set_text(event_message)
label.set_alignment(0,0)
label.set_selectable(True)
self.vbox.pack_start(label, expand=False)
self.vbox.pack_end(label, expand=False)
if len(self.labels)>100:
remove_label = self.labels.pop(0)
remove_label.destroy()
label.show()