Skip to content

Commit

Permalink
#1568: py3k fixes
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@16275 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 10, 2017
1 parent 5b93fd5 commit f586f6f
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/xpra/client/gtk_base/mdns_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import pango
import os.path
import subprocess
from collections import OrderedDict

from xpra.gtk_common.gobject_compat import import_gtk, import_gdk, import_glib
from xpra.gtk_common.gobject_compat import import_gtk, import_gdk, import_pango, import_glib
gtk = import_gtk()
gdk = import_gdk()
pango = import_pango()
glib = import_glib()
glib.threads_init()

Expand Down Expand Up @@ -62,7 +62,8 @@ def __init__(self):
al = gtk.Alignment(xalign=1, yalign=0.5)
al.add(gtk.Label("Password:"))
hbox.add(al)
self.password_entry = gtk.Entry(max=128)
self.password_entry = gtk.Entry()
self.password_entry.set_max_length(128)
self.password_entry.set_width_chars(16)
self.password_entry.set_visibility(False)
al = gtk.Alignment(xalign=0, yalign=0.5)
Expand Down Expand Up @@ -200,16 +201,14 @@ def clicked(*args):
#on MS Windows, prefer ssh which has a GUI for accepting keys
#and entering the password:
order["ssh"] = 0
def cmp_rec(a, b):
def k(v):
text = v[-1] #the text record
mode = (text or {}).get("mode", v)
host = v[6]
host_len = len(host)
#prefer order (from mode), then shorter host string:
return "%s-%s" % (order.get(mode, mode), host_len)
return cmp(k(a), k(b))
srecs = sorted(recs, cmp=cmp_rec)
def cmp_key(v):
text = v[-1] #the text record
mode = (text or {}).get("mode", v)
host = v[6]
host_len = len(host)
#prefer order (from mode), then shorter host string:
return "%s-%s" % (order.get(mode, mode), host_len)
srecs = sorted(recs, key=cmp_key)
for rec in srecs:
uri = self.get_uri(None, *rec)
uri_menu.append_text(uri)
Expand Down

0 comments on commit f586f6f

Please sign in to comment.