diff options
Diffstat (limited to 'usr/share/mageiawelcome/webgui.py')
-rw-r--r-- | usr/share/mageiawelcome/webgui.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/usr/share/mageiawelcome/webgui.py b/usr/share/mageiawelcome/webgui.py index c6888fa..57b4624 100644 --- a/usr/share/mageiawelcome/webgui.py +++ b/usr/share/mageiawelcome/webgui.py @@ -1,7 +1,7 @@ import time -import Queue -import thread -import urllib +import queue +import _thread +import urllib.request, urllib.parse, urllib.error import gi from gi.repository import Gdk @@ -47,8 +47,9 @@ if use is UseWebKit: def asynchronous_gtk_message(fun): - def worker((function, args, kwargs)): - apply(function, args, kwargs) + def worker(xxx_todo_changeme): + (function, args, kwargs) = xxx_todo_changeme + function(*args, **kwargs) def fun2(*args, **kwargs): GLib.idle_add(worker, (fun, args, kwargs)) @@ -60,8 +61,9 @@ def synchronous_gtk_message(fun): class NoResult: pass - def worker((R, function, args, kwargs)): - R.result = apply(function, args, kwargs) + def worker(xxx_todo_changeme1): + (R, function, args, kwargs) = xxx_todo_changeme1 + R.result = function(*args, **kwargs) def fun2(*args, **kwargs): class R: result = NoResult @@ -94,7 +96,7 @@ def launch_browser(html, quit_function=None, echo=True): window.set_resizable(False) window.show_all() - message_queue = Queue.Queue() + message_queue = queue.Queue() def title_changed(title): if title != 'null': message_queue.put(title) @@ -108,11 +110,11 @@ def launch_browser(html, quit_function=None, echo=True): return None else: msg = message_queue.get() - if echo: print '>>>', msg + if echo: print('>>>', msg) return msg def web_send(msg): - if echo: print '<<<', msg + if echo: print('<<<', msg) asynchronous_gtk_message(implementation.inject_javascript)(browser, msg) return browser, web_recv, web_send @@ -122,7 +124,7 @@ def start_gtk_thread(): # Start GTK in its own thread: Gdk.threads_init() Gdk.threads_enter() - thread.start_new_thread(Gtk.main, ()) + _thread.start_new_thread(Gtk.main, ()) def kill_gtk_thread(): asynchronous_gtk_message(Gtk.main_quit)() |