Fixed logger bugs. Closes #6

This commit is contained in:
Einar Ryeng 2006-04-26 13:29:10 +00:00
parent a9947daf14
commit a0ad4bdf54
2 changed files with 9 additions and 6 deletions

View File

@ -49,7 +49,7 @@ class FluentApp:
def create_logview(self, str1, str2, int1, int2):
# Set up log view
self.log_view = logger.LogView(logger.logger)
self.log_view.set_level('notice')
# self.log_view.set_level('notice')
self.log_view.show()
return self.log_view

View File

@ -25,19 +25,21 @@ class Logger:
self.store.set_value(iter, 1, message)
self.store.set_value(iter, 2, self.colors[level])
def level_number(self, level):
return self.levels.index(level)
class LogView(gtk.TreeView):
def __init__(self, logger=None, level='notice'):
self.logger = logger
self.model = logger.store
self.level = level
self.level_no = logger.level_number(level)
# Set up filter
self.filter = self.model.filter_new()
gtk.TreeView.__init__(self, self.filter)
self.filter.set_visible_func(self.level_filter)
self.set_level(level)
# Set up log level column
renderer = gtk.CellRendererText()
@ -55,7 +57,6 @@ class LogView(gtk.TreeView):
self.menu = LogMenu(self.logger, self)
self.connect('popup_menu', self.popup_menu)
self.connect('button_press_event', self.mouse_popup_menu)
#self.connect('button_release_event', None)
# Make sure tree view displays bottom entry when entered
def scroll_to_last(model, path, it):
@ -101,7 +102,9 @@ class LogLevelMenu(gtk.Menu):
items.append(item)
self.append(item)
item.show()
items[0].set_active(True)
item_no = logger.level_number(view.level)
items[item_no].set_active(True)
def set_log_level(self, widget, level, *rest):
if widget.active: