Commit 033e183c authored by sumpfralle's avatar sumpfralle

use utf-8 encoding for gtk messages (otherwise Pango warnings show up for umlauts)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@676 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 7d63cae7
......@@ -70,7 +70,7 @@ class GTKHandler(logging.Handler):
self.parent_window = parent_window
def emit(self, record):
message = self.format(record)
message = self.format(record).encode("utf-8")
import gtk
if record.levelno <= 20:
message_type = gtk.MESSAGE_INFO
......@@ -83,6 +83,12 @@ class GTKHandler(logging.Handler):
message_title = "Error"
window = gtk.MessageDialog(self.parent_window, type=message_type,
buttons=gtk.BUTTONS_OK, message_format=str(message))
try:
message_title = message_title.encode("utf-8")
except UnicodeDecodeError:
# remove all non-ascii characters
message_title = "".join([char for char in message_title
if ord(char) < 128])
window.set_title(message_title)
window.run()
window.destroy()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment