From fe1c2dba188fe73406144f4327c090786cb8ec99 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sun, 9 Feb 2014 18:37:44 +0100 Subject: automatic conversion from gtk2 to gtk3 (with manual fixes) --- usr/share/mageiawelcome/mageiawelcome.py | 2 +- usr/share/mageiawelcome/webgui.py | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/usr/share/mageiawelcome/mageiawelcome.py b/usr/share/mageiawelcome/mageiawelcome.py index bc1e0b7..5132419 100644 --- a/usr/share/mageiawelcome/mageiawelcome.py +++ b/usr/share/mageiawelcome/mageiawelcome.py @@ -9,7 +9,7 @@ import subprocess import shlex import gettext import string -import gtk +from gi.repository import Gtk from user import home diff --git a/usr/share/mageiawelcome/webgui.py b/usr/share/mageiawelcome/webgui.py index a53e131..c3819d1 100644 --- a/usr/share/mageiawelcome/webgui.py +++ b/usr/share/mageiawelcome/webgui.py @@ -3,11 +3,11 @@ import Queue import thread import urllib -import gtk -import gobject +from gi.repository import Gtk +from gi.repository import GObject try: - import webkit + from gi.repository import WebKit have_webkit = True except: have_webkit = False @@ -48,7 +48,7 @@ def asynchronous_gtk_message(fun): apply(function, args, kwargs) def fun2(*args, **kwargs): - gobject.idle_add(worker, (fun, args, kwargs)) + GObject.idle_add(worker, (fun, args, kwargs)) return fun2 @@ -62,7 +62,7 @@ def synchronous_gtk_message(fun): def fun2(*args, **kwargs): class R: result = NoResult - gobject.idle_add(worker, (R, fun, args, kwargs)) + GObject.idle_add(worker, (R, fun, args, kwargs)) while R.result is NoResult: time.sleep(0.01) return R.result @@ -70,12 +70,12 @@ def synchronous_gtk_message(fun): def launch_browser(html, quit_function=None, echo=True): - window = gtk.Window() + window = Gtk.Window() browser = implementation.create_browser() settings = browser.get_settings() settings.set_property('enable-default-context-menu', False) - box = gtk.VBox(homogeneous=False, spacing=0) + box = Gtk.VBox(homogeneous=False, spacing=0) window.add(box) @@ -85,7 +85,7 @@ def launch_browser(html, quit_function=None, echo=True): box.pack_start(browser, expand=True, fill=True, padding=0) window.set_icon_name('preferences-desktop-personal') window.set_title(_('Welcome to Mageia!')) - window.set_position(gtk.WIN_POS_CENTER) + window.set_position(Gtk.WindowPosition.CENTER) window.set_default_size(800, 500) window.set_size_request(800, 500) window.set_resizable(False) @@ -117,9 +117,9 @@ def launch_browser(html, quit_function=None, echo=True): def start_gtk_thread(): # Start GTK in its own thread: - gtk.gdk.threads_init() - gtk.gdk.threads_enter() - thread.start_new_thread(gtk.main, ()) + Gdk.threads_init() + Gdk.threads_enter() + thread.start_new_thread(Gtk.main, ()) def kill_gtk_thread(): - asynchronous_gtk_message(gtk.main_quit)() + asynchronous_gtk_message(Gtk.main_quit)() -- cgit v1.2.1