From 5d1ea593d86f510a172bd9d9fd165923c84187e8 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 8 Aug 2009 01:22:31 +0100 Subject: [PATCH] migrate dbg,err to util.py --- terminatorlib/config.py | 15 +-------------- terminatorlib/configfile.py | 2 +- terminatorlib/debugserver.py | 2 +- terminatorlib/prefs_profile.py | 3 ++- terminatorlib/terminator.py | 2 +- terminatorlib/terminatorterm.py | 2 +- 6 files changed, 7 insertions(+), 19 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 41db77c7..10b321ab 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -45,20 +45,7 @@ except ImportError: gconf = None from terminatorlib import translation - -# set this to true to enable debugging output -# These should be moved somewhere better. -debug = False - -def dbg (log = ""): - """Print a message if debugging is enabled""" - if debug: - print >> sys.stderr, log - -def err (log = ""): - """Print an error message""" - print >> sys.stderr, log - +from terminatorlib.util import dbg, err from terminatorlib.configfile import ConfigFile, ParsedWithErrors DEFAULTS = { diff --git a/terminatorlib/configfile.py b/terminatorlib/configfile.py index f71f39f0..f40b9587 100644 --- a/terminatorlib/configfile.py +++ b/terminatorlib/configfile.py @@ -1,7 +1,7 @@ #!/usr/bin/python import re -from terminatorlib.config import dbg, debug +from terminatorlib.util import dbg from terminatorlib import translation def group(*choices): return '(' + '|'.join(choices) + ')' diff --git a/terminatorlib/debugserver.py b/terminatorlib/debugserver.py index bcb13d85..2621331a 100644 --- a/terminatorlib/debugserver.py +++ b/terminatorlib/debugserver.py @@ -5,7 +5,7 @@ # Use of this file is unrestricted provided this notice is retained. # If you use it, it'd be nice if you dropped me a note. Also beer. -from terminatorlib.config import dbg, err +from terminatorlib.util import dbg, err from terminatorlib.version import APP_NAME, APP_VERSION import socket diff --git a/terminatorlib/prefs_profile.py b/terminatorlib/prefs_profile.py index bd045e5b..bb991d02 100644 --- a/terminatorlib/prefs_profile.py +++ b/terminatorlib/prefs_profile.py @@ -1,6 +1,7 @@ #!/usr/bin/python -from terminatorlib.config import dbg,err,DEFAULTS,TerminatorConfValuestoreRC +from terminatorlib.util import dbg,err +from terminatorlib.config import DEFAULTS,TerminatorConfValuestoreRC from terminatorlib.keybindings import TerminatorKeybindings from terminatorlib.version import APP_NAME, APP_VERSION from terminatorlib import translation diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index ef0632e1..33a1bb73 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -25,7 +25,7 @@ import gobject, gtk, pango from terminatorlib.version import APP_NAME, APP_VERSION from terminatorlib import config -from config import dbg, err, debug +from util import dbg, err, debug from terminatorlib.keybindings import TerminatorKeybindings from terminatorlib.terminatorterm import TerminatorTerm diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index c5d604ad..2f544a6f 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -26,7 +26,7 @@ from terminatorlib.version import * # import our configuration loader from terminatorlib import config -from terminatorlib.config import dbg, err, debug +from terminatorlib.util import dbg, err, debug #import encoding list from terminatorlib.encoding import TerminatorEncoding