Skip to content

Commit

Permalink
#90: gtk3 + python3 compat fixes: try to import from gi.repository, a…
Browse files Browse the repository at this point in the history
…nd use list so we can sort it

git-svn-id: https://xpra.org/svn/Xpra/trunk@626 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 27, 2012
1 parent ff58b41 commit 8e0bdff
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
10 changes: 8 additions & 2 deletions src/wimpiggy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

import traceback
import sys
import gobject
try:
from gi.repository import GObject as gobject #@UnresolvedImport @UnusedImport (python3)
except:
import gobject #@Reimport

class AutoPropGObjectMixin(object):
"""Mixin for automagic property support in GObjects.
Expand Down Expand Up @@ -90,7 +93,10 @@ def gtk_main_quit_forever():
# the X server (and this process may block, may cause us to later be
# killed if the X server goes away, etc.), and we don't want to impose
# that on every user of wimpiggy.util.
import gtk
try:
from gi.repository import Gtk as gtk #@UnresolvedImport @UnusedImport (python3)
except:
import gtk #@Reimport
gtk.main_quit()
# So long as there are more nested main loops, re-register ourselves
# to be called again:
Expand Down
5 changes: 4 additions & 1 deletion src/xpra/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
# Parti is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import gobject
try:
from gi.repository import GObject as gobject #@UnresolvedImport @UnusedImport (python3)
except:
import gobject #@Reimport

from wimpiggy.util import n_arg_signal
from wimpiggy.log import Logger
Expand Down
14 changes: 9 additions & 5 deletions src/xpra/platform/client_extras_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@

import sys
import os.path
import pygtk
pygtk.require("2.0")
import gtk
import gobject
try:
from gi.repository import Gtk as gtk, GObject as gobject #@UnresolvedImport @UnusedImport (python3)
gtk.pygtk_version = (0,0)
except:
import pygtk
pygtk.require("2.0")
import gtk #@Reimport
import gobject #@Reimport
import webbrowser
import time
import datetime
Expand Down Expand Up @@ -663,7 +667,7 @@ def keysort(key):
self.layout_submenu.append(kbitem("%s - %s" % (layout, v), layout, v))
else:
#show all options to choose from:
sorted_keys = X11_LAYOUTS.keys()
sorted_keys = list(X11_LAYOUTS.keys())
sorted_keys.sort(key=keysort)
for key in sorted_keys:
country,language = key
Expand Down
5 changes: 4 additions & 1 deletion src/xpra/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

# but it works on win32, for whatever that's worth.

import gobject
try:
from gi.repository import GObject as gobject #@UnresolvedImport @UnusedImport (python3)
except:
import gobject #@Reimport
gobject.threads_init()
import os
import socket # for socket.error
Expand Down
11 changes: 7 additions & 4 deletions src/xpra/xposix/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
import sys
import os

import pygtk
pygtk.require("2.0")
import gtk
_display = gtk.gdk.get_display()
try:
from gi.repository import Gtk as gtk, Gdk as gdk #@UnresolvedImport @UnusedImport (python3)
except:
import pygtk
pygtk.require("2.0")
import gtk.gdk #@Reimport
_display = gdk.get_display()
assert _display, "cannot open the display with GTK, is DISPLAY set?"

from xpra.platform.client_extras_base import ClientExtrasBase
Expand Down

0 comments on commit 8e0bdff

Please sign in to comment.