From e021fff1ef2be1327b3edc2bb43332753a1fff16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 23 Jun 2008 22:02:44 +0200 Subject: Moved GtkThread to gui.utils --- portato/gui/utils.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'portato/gui/utils.py') diff --git a/portato/gui/utils.py b/portato/gui/utils.py index 0a2930b..6e04814 100644 --- a/portato/gui/utils.py +++ b/portato/gui/utils.py @@ -14,19 +14,38 @@ from __future__ import absolute_import, with_statement # some stuff needed import re +import sys import logging +import gettext from collections import defaultdict -from threading import RLock +from threading import Thread, RLock from functools import wraps # some backend things from ..backend import flags, system, set_system from ..helper import debug, info, set_log_level -from ..constants import USE_CATAPULT +from ..constants import USE_CATAPULT, APP, LOCALE_DIR # parser from ..config_parser import ConfigParser +class GtkThread (Thread): + def run(self): + # for some reason, I have to install this for each thread ... + gettext.install(APP, LOCALE_DIR, unicode = True) + try: + Thread.run(self) + except SystemExit: + raise # let normal thread handle it + except: + type, val, tb = sys.exc_info() + try: + sys.excepthook(type, val, tb, thread = self.getName()) + except TypeError: + raise type, val, tb # let normal thread handle it + finally: + del type, val, tb + class Config (ConfigParser): def __init__ (self, cfgFile): -- cgit v1.2.3