Some windows fixes

This commit is contained in:
Andrew Resch 2008-07-04 22:36:46 +00:00
parent fa77fad0ff
commit 1f3e930df3
1 changed files with 13 additions and 5 deletions

View File

@ -38,6 +38,7 @@ try:
except: except:
log.warning("It is suggested that you upgrade your PyGTK to 2.10 or greater.") log.warning("It is suggested that you upgrade your PyGTK to 2.10 or greater.")
import gtk, gtk.glade import gtk, gtk.glade
import gobject
import gettext import gettext
import locale import locale
import pkg_resources import pkg_resources
@ -103,13 +104,18 @@ class GtkUI:
def __init__(self, args): def __init__(self, args):
# Initialize gdk threading # Initialize gdk threading
gtk.gdk.threads_init() gtk.gdk.threads_init()
gobject.threads_init()
# Initialize gettext # Initialize gettext
locale.setlocale(locale.LC_MESSAGES, '') if deluge.common.windows_check():
locale.bindtextdomain("deluge", locale.set_localte(locale.LC_ALL, '')
else:
locale.setlocale(locale.LC_MESSAGES, '')
locale.bindtextdomain("deluge",
pkg_resources.resource_filename( pkg_resources.resource_filename(
"deluge", "i18n")) "deluge", "i18n"))
locale.textdomain("deluge") locale.textdomain("deluge")
gettext.bindtextdomain("deluge", gettext.bindtextdomain("deluge",
pkg_resources.resource_filename( pkg_resources.resource_filename(
"deluge", "i18n")) "deluge", "i18n"))
@ -132,7 +138,7 @@ class GtkUI:
from win32api import SetConsoleCtrlHandler from win32api import SetConsoleCtrlHandler
from win32con import CTRL_CLOSE_EVENT from win32con import CTRL_CLOSE_EVENT
result = 0 result = 0
def win_handler(self, ctrl_type): def win_handler(ctrl_type):
if ctrl_type == CTRL_CLOSE_EVENT: if ctrl_type == CTRL_CLOSE_EVENT:
self.shutdown() self.shutdown()
return 1 return 1
@ -181,7 +187,9 @@ class GtkUI:
# Start the gtk main loop # Start the gtk main loop
try: try:
gtk.gdk.threads_enter()
gtk.main() gtk.main()
gtk.gdk.threads_leave()
except KeyboardInterrupt: except KeyboardInterrupt:
self.shutdown() self.shutdown()
else: else: