Add "quiet" variable to shutup graphical log output
authorJack Miller <jack@codezen.org>
Wed, 20 May 2015 22:06:36 +0000 (17:06 -0500)
committerJack Miller <jack@codezen.org>
Wed, 20 May 2015 22:06:36 +0000 (17:06 -0500)
- Update autocmd plugin to use it as well.

canto_curses/config.py
canto_curses/gui.py
plugins/autocmd.py

index 16591d3..77bbcf2 100644 (file)
@@ -81,6 +81,7 @@ class CantoCursesConfig(SubThread):
             "location" : None,
             "error_msg" : "No error.",
             "info_msg" : "No info.",
+            "quiet" : False,
             "dispel_msg" : False,
             "input_prompt" : "",
             "input_do_completions" : True,
index 7374177..1124102 100644 (file)
@@ -43,6 +43,9 @@ class GraphicalLog(logging.Handler):
         self.callbacks["set_var"]("needs_refresh", True)
 
     def emit(self, record):
+        quiet = self.callbacks["get_var"]("quiet")
+        if record.levelno == logging.INFO and quiet:
+            return
         self.deferred_logs.append(record)
 
     # Call with sync_lock
index 21c67b8..3219c08 100644 (file)
@@ -36,5 +36,7 @@ class AutoCmdGui(GuiPlugin):
         on_hook("curses_start", self.do_cmds)
 
     def do_cmds(self):
+        self.gui.callbacks["set_var"]("quiet", True)
         for cmd in cmds:
             self.gui.issue_cmd(cmd)
+        self.gui.callbacks["set_var"]("quiet", False)