Fixed logger bugs. Closes #6
This commit is contained in:
parent
a9947daf14
commit
a0ad4bdf54
|
@ -49,7 +49,7 @@ class FluentApp:
|
||||||
def create_logview(self, str1, str2, int1, int2):
|
def create_logview(self, str1, str2, int1, int2):
|
||||||
# Set up log view
|
# Set up log view
|
||||||
self.log_view = logger.LogView(logger.logger)
|
self.log_view = logger.LogView(logger.logger)
|
||||||
self.log_view.set_level('notice')
|
# self.log_view.set_level('notice')
|
||||||
self.log_view.show()
|
self.log_view.show()
|
||||||
return self.log_view
|
return self.log_view
|
||||||
|
|
||||||
|
|
|
@ -25,19 +25,21 @@ class Logger:
|
||||||
self.store.set_value(iter, 1, message)
|
self.store.set_value(iter, 1, message)
|
||||||
self.store.set_value(iter, 2, self.colors[level])
|
self.store.set_value(iter, 2, self.colors[level])
|
||||||
|
|
||||||
|
def level_number(self, level):
|
||||||
|
return self.levels.index(level)
|
||||||
|
|
||||||
class LogView(gtk.TreeView):
|
class LogView(gtk.TreeView):
|
||||||
|
|
||||||
def __init__(self, logger=None, level='notice'):
|
def __init__(self, logger=None, level='notice'):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.model = logger.store
|
self.model = logger.store
|
||||||
|
self.level = level
|
||||||
|
self.level_no = logger.level_number(level)
|
||||||
|
|
||||||
# Set up filter
|
# Set up filter
|
||||||
self.filter = self.model.filter_new()
|
self.filter = self.model.filter_new()
|
||||||
gtk.TreeView.__init__(self, self.filter)
|
gtk.TreeView.__init__(self, self.filter)
|
||||||
self.filter.set_visible_func(self.level_filter)
|
self.filter.set_visible_func(self.level_filter)
|
||||||
self.set_level(level)
|
|
||||||
|
|
||||||
|
|
||||||
# Set up log level column
|
# Set up log level column
|
||||||
renderer = gtk.CellRendererText()
|
renderer = gtk.CellRendererText()
|
||||||
|
@ -55,7 +57,6 @@ class LogView(gtk.TreeView):
|
||||||
self.menu = LogMenu(self.logger, self)
|
self.menu = LogMenu(self.logger, self)
|
||||||
self.connect('popup_menu', self.popup_menu)
|
self.connect('popup_menu', self.popup_menu)
|
||||||
self.connect('button_press_event', self.mouse_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
|
# Make sure tree view displays bottom entry when entered
|
||||||
def scroll_to_last(model, path, it):
|
def scroll_to_last(model, path, it):
|
||||||
|
@ -101,7 +102,9 @@ class LogLevelMenu(gtk.Menu):
|
||||||
items.append(item)
|
items.append(item)
|
||||||
self.append(item)
|
self.append(item)
|
||||||
item.show()
|
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):
|
def set_log_level(self, widget, level, *rest):
|
||||||
if widget.active:
|
if widget.active:
|
||||||
|
|
Reference in New Issue