diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 33da175c..18f06e0d 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -238,7 +238,7 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): ini = ConfigFile(self.rcfilename, self._rc_set_callback()) ini.parse() except IOError, e: - dbg (" VS_RCFile: unable to open %s (%s)" % (self.rcfilename, repr(e))) + dbg (" VS_RCFile: unable to open %s (%r)" % (self.rcfilename, e)) except ParsedWithErrors, e: # We don't really want to produce an error dialog every run if not is_init: @@ -287,24 +287,24 @@ Errors were encountered while parsing terminator_config(5) file: dialog.run() dialog.destroy() - dbg("ConfigFile settings are: %s" % repr(self.values)) + dbg("ConfigFile settings are: %r" % self.values) def _rc_set_callback(self): def callback(sections, key, value): - dbg("Setting: section=%s with %s => %s" % (repr(sections), repr(key), repr(value))) + dbg("Setting: section=%r with %r => %r" % (sections, key, value)) section = None if len(sections) > 0: section = sections[0] if section is None: if not Defaults.has_key (key): - raise ValueError("Unknown configuration option %s" % repr(key)) + raise ValueError("Unknown configuration option %r" % key) deftype = Defaults[key].__class__.__name__ if key.endswith('_color'): try: gtk.gdk.color_parse(value) self.values[key] = value except ValueError: - raise ValueError(_("Setting %s value %s not a valid colour; ignoring") % (key,repr(value))) + raise ValueError(_("Setting %r value %r not a valid colour; ignoring") % (key, value)) elif key == 'tab_position': if value.lower() in ('top', 'left', 'bottom', 'right'): self.values[key] = value.lower() @@ -325,20 +325,20 @@ Errors were encountered while parsing terminator_config(5) file: raise ValueError(_("Reading list values from terminator_config(5) is not currently supported")) elif deftype == 'dict': if type(value) != dict: - raise ValueError(_("Setting %s should be a section name") % repr(key)) + raise ValueError(_("Setting %r should be a section name") % key) self.values[key] = value else: self.values[key] = value - dbg (" VS_RCFile: Set value '%s' to %s" % (key, repr(self.values[key]))) + dbg (" VS_RCFile: Set value %r to %r" % (key, self.values[key])) elif section == 'keybindings': self.values.setdefault(section, {}) if not Defaults[section].has_key(key): - raise ValueError("Keybinding name %s is unknown" % repr(key)) + raise ValueError("Keybinding name %r is unknown" % key) else: self.values[section][key] = value else: - raise ValueError("Section name %s is unknown" % repr(section)) + raise ValueError("Section name %r is unknown" % section) return callback class TerminatorConfValuestoreGConf (TerminatorConfValuestore): diff --git a/terminatorlib/configfile.py b/terminatorlib/configfile.py index 03dcdc43..e49856c7 100644 --- a/terminatorlib/configfile.py +++ b/terminatorlib/configfile.py @@ -57,12 +57,12 @@ class ParsedWithErrors(Exception): def __str__(self): return """Errors were encountered while parsing configuration file: - %s + %r Some lines have been ignored. %s -""" % (repr(self.file), "\n".join(map(lambda error: str(error), self.errors))) +""" % (self.file, "\n".join(map(lambda error: str(error), self.errors))) class ConfigFile: @@ -127,7 +127,7 @@ class ConfigFile: self._lnum += 1 self._pos = 0 self._max = len(self._line) - dbg("Line %d: %s" % (self._lnum, repr(self._line))) + dbg("Line %d: %r" % (self._lnum, self._line)) if HandleIndents: self._find_indent() @@ -146,7 +146,7 @@ class ConfigFile: if not self._call_if_match(Barevalue, self._value, 1): raise ConfigSyntaxError(_("Setting without a value"), self) - self._call_if_match(Ignore, lambda junk: dbg("Skipping: %s" % repr(junk))) + self._call_if_match(Ignore, lambda junk: dbg("Skipping: %r" % junk)) if self._line[self._pos:] != '': raise ConfigSyntaxError(_("Unexpected token"), self) @@ -200,15 +200,15 @@ class ConfigFile: return tuple(sections) def _section(self, section): - dbg("Section %s" % repr(section)) + dbg("Section %r" % section) self._sections[len(self._indents)] = section.lower() def _setting(self, setting): - dbg("Setting %s" % repr(setting)) + dbg("Setting %r" % setting) self._currsetting = setting.lower() def _value(self, value): - dbg("Value %s" % repr(value)) + dbg("Value %r" % value) self._currvalue = value def _line_ok(self): diff --git a/terminatorlib/debugserver.py b/terminatorlib/debugserver.py index da2c9d1b..2225956c 100644 --- a/terminatorlib/debugserver.py +++ b/terminatorlib/debugserver.py @@ -26,7 +26,7 @@ class PythonConsoleServer(SocketServer.BaseRequestHandler): env = None def setup(self): dbg('debugserver: connect from %s' % str(self.client_address)) - ddbg('debugserver: env=%s' % repr(PythonConsoleServer.env)) + ddbg('debugserver: env=%r' % PythonConsoleServer.env) self.console = TerminatorConsole(PythonConsoleServer.env) def handle(self): @@ -92,7 +92,7 @@ class TerminatorConsole(code.InteractiveConsole): data = data.replace(NULL, '') bits = re.findall(DoDont, data) - ddbg("bits = %s" % repr(bits)) + ddbg("bits = %r" % bits) if bits: data = re.sub(DoDont, '\\1', data) ddbg("telnet: DO/DON'T answer") @@ -124,12 +124,12 @@ class TerminatorConsole(code.InteractiveConsole): data = data.replace(IAC + IAC, IAC) # and handle escapes if data != odata: - ddbg("debugserver: Replaced %s with %s" % (repr(odata), repr(data))) + ddbg("debugserver: Replaced %r with %r" % (odata, data)) return data def raw_input(self, prompt = None): - ddbg("debugserver: raw_input prompt = %s" % repr(prompt)) + ddbg("debugserver: raw_input prompt = %r" % prompt) if prompt: self.write(prompt) @@ -137,7 +137,7 @@ class TerminatorConsole(code.InteractiveConsole): compstate = 0 while True: data = self.server.socketio.read(1) - ddbg('raw_input: char=%s' % repr(data)) + ddbg('raw_input: char=%r' % data) if data == LF or data == '\006': buf = self.parse_telnet(buf + data) if buf != '': @@ -148,7 +148,7 @@ class TerminatorConsole(code.InteractiveConsole): buf += data def write(self, data): - ddbg("debugserver: write %s" % repr(data)) + ddbg("debugserver: write %r" % data) self.server.socketio.write(data) self.server.socketio.flush() diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 486e30af..64927d86 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -209,7 +209,7 @@ class Terminator: if self._geometry is not None: dbg("Geometry=%s" % self._geometry) if not self.window.parse_geometry(self._geometry): - err(_("Invalid geometry string %s") % repr(self._geometry)) + err(_("Invalid geometry string %r") % self._geometry) try: self.window.set_icon (self.icon_theme.load_icon (APP_NAME, 48, 0)) @@ -286,7 +286,7 @@ class Terminator: # a shell script with the interpreter name etc. c = self.gnome_client c.set_program(sys.argv[0]) - dbg("Session restart command: %s with args %s in %s" % (sys.argv[0], repr(args), self.start_cwd)) + dbg("Session restart command: %s with args %r in %s" % (sys.argv[0], args, self.start_cwd)) c.set_restart_style(gnome.ui.RESTART_IF_RUNNING) c.set_current_directory(self.start_cwd) @@ -372,7 +372,7 @@ class Terminator: mapping = self.keybindings.lookup(event) if mapping: - dbg("on_key_press: lookup found %s" % repr(mapping)) + dbg("on_key_press: lookup found %r" % mapping) if mapping == 'full_screen': self.fullscreen_toggle () return (True) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 90a6d9cd..ee55fc40 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -683,12 +683,12 @@ text/plain UnhandledKeybindings = ('close_window', 'full_screen') def on_vte_key_press (self, term, event): if not event: - dbg ('on_vte_key_press: Called on %s with no event'%term) + dbg ('on_vte_key_press: Called on %s with no event' % term) return False mapping = self.terminator.keybindings.lookup(event) if mapping and mapping not in self.UnhandledKeybindings: - dbg("on_vte_key_press: lookup found %s" % repr(mapping)) + dbg("on_vte_key_press: lookup found %r" % mapping) getattr(self, "key_" + mapping)() return True @@ -808,7 +808,7 @@ text/plain def do_search(self, widget): string = widget.get_text() - dbg("do_search: Looking for %s" % repr(string)) + dbg("do_search: Looking for %r" % string) if string == '': return @@ -833,7 +833,7 @@ text/plain return buffer = self._vte.get_text_range(self._search_row, 0, self._search_row, -1, self._search_character) - # dbg("Row %d buffer: %s" % (self._search_row, repr(buffer))) + # dbg("Row %d buffer: %r" % (self._search_row, buffer)) index = buffer.find(self._search_string) if index != -1: self._search_result_label.set_text("Found at row %d" % self._search_row)