finally fix logging - micah

This commit is contained in:
Marcos Pinto 2007-08-02 23:47:43 +00:00
parent 6ef4323969
commit aa3d1e7569
2 changed files with 91 additions and 90 deletions

View File

@ -64,7 +64,7 @@ class EventLogging:
except IOError:
# File does not exist
pass
self.dialog_initialize = True
self.glade = gtk.glade.XML(path + "/event_logging_preferences.glade")
self.dialog = self.glade.get_widget("dialog")
self.glade.signal_autoconnect({
@ -120,7 +120,6 @@ class EventLogging:
self.tab_log.enable_log_files()
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"):
@ -159,11 +158,13 @@ class EventLogging:
if self.parentNotebook.get_nth_page(page) == self.topWidget:
self.parentNotebook.remove_page(page)
break
self.config.save(self.config_file)
def update(self):
pass
def toggle_ui(self, widget):
if not self.dialog_initialize:
value = widget.get_active()
if widget == self.glade.get_widget("chk_finished"):
if value:
@ -252,6 +253,7 @@ class EventLogging:
self.tab_log.disable_log_files()
def configure(self):
self.dialog_initialize = True
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"))
@ -288,6 +290,7 @@ class EventLogging:
self.glade.get_widget("chk_block_finished").set_active(False)
self.glade.get_widget("chk_other").set_active(False)
self.glade.get_widget("chk_log_files").set_active(False)
self.dialog_initialize = False
self.dialog.show()
response = self.dialog.run()
self.dialog.hide()

View File

@ -181,8 +181,6 @@ class LogManager(object):
logfile = open(log, "a")
logfile.write(time.asctime(time.localtime()) + ", " +event_message + '\n')
logfile.close()
if self.vbox is None:
self.prepare_log_store()
if not event_message is None:
label = gtk.Label()
label.set_text(event_message)