Python 3 port:
/!\ this is a huge commit /!\ starting from this commit, SàT is needs Python 3.6+ /!\ SàT maybe be instable or some feature may not work anymore, this will improve with time This patch port backend, bridge and frontends to Python 3. Roughly this has been done this way: - 2to3 tools has been applied (with python 3.7) - all references to python2 have been replaced with python3 (notably shebangs) - fixed files not handled by 2to3 (notably the shell script) - several manual fixes - fixed issues reported by Python 3 that where not handled in Python 2 - replaced "async" with "async_" when needed (it's a reserved word from Python 3.7) - replaced zope's "implements" with @implementer decorator - temporary hack to handle data pickled in database, as str or bytes may be returned, to be checked later - fixed hash comparison for password - removed some code which is not needed anymore with Python 3 - deactivated some code which needs to be checked (notably certificate validation) - tested with jp, fixed reported issues until some basic commands worked - ported Primitivus (after porting dependencies like urwid satext) - more manual fixes
This commit is contained in:
parent
d21a6a660f
commit
fbfe96c505
4 changed files with 6336 additions and 6398 deletions
|
|
@ -23,154 +23,154 @@ log = getLogger(__name__)
|
|||
|
||||
|
||||
CSS_COLORS = {
|
||||
u"black": u"000000",
|
||||
u"silver": u"c0c0c0",
|
||||
u"gray": u"808080",
|
||||
u"white": u"ffffff",
|
||||
u"maroon": u"800000",
|
||||
u"red": u"ff0000",
|
||||
u"purple": u"800080",
|
||||
u"fuchsia": u"ff00ff",
|
||||
u"green": u"008000",
|
||||
u"lime": u"00ff00",
|
||||
u"olive": u"808000",
|
||||
u"yellow": u"ffff00",
|
||||
u"navy": u"000080",
|
||||
u"blue": u"0000ff",
|
||||
u"teal": u"008080",
|
||||
u"aqua": u"00ffff",
|
||||
u"orange": u"ffa500",
|
||||
u"aliceblue": u"f0f8ff",
|
||||
u"antiquewhite": u"faebd7",
|
||||
u"aquamarine": u"7fffd4",
|
||||
u"azure": u"f0ffff",
|
||||
u"beige": u"f5f5dc",
|
||||
u"bisque": u"ffe4c4",
|
||||
u"blanchedalmond": u"ffebcd",
|
||||
u"blueviolet": u"8a2be2",
|
||||
u"brown": u"a52a2a",
|
||||
u"burlywood": u"deb887",
|
||||
u"cadetblue": u"5f9ea0",
|
||||
u"chartreuse": u"7fff00",
|
||||
u"chocolate": u"d2691e",
|
||||
u"coral": u"ff7f50",
|
||||
u"cornflowerblue": u"6495ed",
|
||||
u"cornsilk": u"fff8dc",
|
||||
u"crimson": u"dc143c",
|
||||
u"darkblue": u"00008b",
|
||||
u"darkcyan": u"008b8b",
|
||||
u"darkgoldenrod": u"b8860b",
|
||||
u"darkgray": u"a9a9a9",
|
||||
u"darkgreen": u"006400",
|
||||
u"darkgrey": u"a9a9a9",
|
||||
u"darkkhaki": u"bdb76b",
|
||||
u"darkmagenta": u"8b008b",
|
||||
u"darkolivegreen": u"556b2f",
|
||||
u"darkorange": u"ff8c00",
|
||||
u"darkorchid": u"9932cc",
|
||||
u"darkred": u"8b0000",
|
||||
u"darksalmon": u"e9967a",
|
||||
u"darkseagreen": u"8fbc8f",
|
||||
u"darkslateblue": u"483d8b",
|
||||
u"darkslategray": u"2f4f4f",
|
||||
u"darkslategrey": u"2f4f4f",
|
||||
u"darkturquoise": u"00ced1",
|
||||
u"darkviolet": u"9400d3",
|
||||
u"deeppink": u"ff1493",
|
||||
u"deepskyblue": u"00bfff",
|
||||
u"dimgray": u"696969",
|
||||
u"dimgrey": u"696969",
|
||||
u"dodgerblue": u"1e90ff",
|
||||
u"firebrick": u"b22222",
|
||||
u"floralwhite": u"fffaf0",
|
||||
u"forestgreen": u"228b22",
|
||||
u"gainsboro": u"dcdcdc",
|
||||
u"ghostwhite": u"f8f8ff",
|
||||
u"gold": u"ffd700",
|
||||
u"goldenrod": u"daa520",
|
||||
u"greenyellow": u"adff2f",
|
||||
u"grey": u"808080",
|
||||
u"honeydew": u"f0fff0",
|
||||
u"hotpink": u"ff69b4",
|
||||
u"indianred": u"cd5c5c",
|
||||
u"indigo": u"4b0082",
|
||||
u"ivory": u"fffff0",
|
||||
u"khaki": u"f0e68c",
|
||||
u"lavender": u"e6e6fa",
|
||||
u"lavenderblush": u"fff0f5",
|
||||
u"lawngreen": u"7cfc00",
|
||||
u"lemonchiffon": u"fffacd",
|
||||
u"lightblue": u"add8e6",
|
||||
u"lightcoral": u"f08080",
|
||||
u"lightcyan": u"e0ffff",
|
||||
u"lightgoldenrodyellow": u"fafad2",
|
||||
u"lightgray": u"d3d3d3",
|
||||
u"lightgreen": u"90ee90",
|
||||
u"lightgrey": u"d3d3d3",
|
||||
u"lightpink": u"ffb6c1",
|
||||
u"lightsalmon": u"ffa07a",
|
||||
u"lightseagreen": u"20b2aa",
|
||||
u"lightskyblue": u"87cefa",
|
||||
u"lightslategray": u"778899",
|
||||
u"lightslategrey": u"778899",
|
||||
u"lightsteelblue": u"b0c4de",
|
||||
u"lightyellow": u"ffffe0",
|
||||
u"limegreen": u"32cd32",
|
||||
u"linen": u"faf0e6",
|
||||
u"mediumaquamarine": u"66cdaa",
|
||||
u"mediumblue": u"0000cd",
|
||||
u"mediumorchid": u"ba55d3",
|
||||
u"mediumpurple": u"9370db",
|
||||
u"mediumseagreen": u"3cb371",
|
||||
u"mediumslateblue": u"7b68ee",
|
||||
u"mediumspringgreen": u"00fa9a",
|
||||
u"mediumturquoise": u"48d1cc",
|
||||
u"mediumvioletred": u"c71585",
|
||||
u"midnightblue": u"191970",
|
||||
u"mintcream": u"f5fffa",
|
||||
u"mistyrose": u"ffe4e1",
|
||||
u"moccasin": u"ffe4b5",
|
||||
u"navajowhite": u"ffdead",
|
||||
u"oldlace": u"fdf5e6",
|
||||
u"olivedrab": u"6b8e23",
|
||||
u"orangered": u"ff4500",
|
||||
u"orchid": u"da70d6",
|
||||
u"palegoldenrod": u"eee8aa",
|
||||
u"palegreen": u"98fb98",
|
||||
u"paleturquoise": u"afeeee",
|
||||
u"palevioletred": u"db7093",
|
||||
u"papayawhip": u"ffefd5",
|
||||
u"peachpuff": u"ffdab9",
|
||||
u"peru": u"cd853f",
|
||||
u"pink": u"ffc0cb",
|
||||
u"plum": u"dda0dd",
|
||||
u"powderblue": u"b0e0e6",
|
||||
u"rosybrown": u"bc8f8f",
|
||||
u"royalblue": u"4169e1",
|
||||
u"saddlebrown": u"8b4513",
|
||||
u"salmon": u"fa8072",
|
||||
u"sandybrown": u"f4a460",
|
||||
u"seagreen": u"2e8b57",
|
||||
u"seashell": u"fff5ee",
|
||||
u"sienna": u"a0522d",
|
||||
u"skyblue": u"87ceeb",
|
||||
u"slateblue": u"6a5acd",
|
||||
u"slategray": u"708090",
|
||||
u"slategrey": u"708090",
|
||||
u"snow": u"fffafa",
|
||||
u"springgreen": u"00ff7f",
|
||||
u"steelblue": u"4682b4",
|
||||
u"tan": u"d2b48c",
|
||||
u"thistle": u"d8bfd8",
|
||||
u"tomato": u"ff6347",
|
||||
u"turquoise": u"40e0d0",
|
||||
u"violet": u"ee82ee",
|
||||
u"wheat": u"f5deb3",
|
||||
u"whitesmoke": u"f5f5f5",
|
||||
u"yellowgreen": u"9acd32",
|
||||
u"rebeccapurple": u"663399",
|
||||
"black": "000000",
|
||||
"silver": "c0c0c0",
|
||||
"gray": "808080",
|
||||
"white": "ffffff",
|
||||
"maroon": "800000",
|
||||
"red": "ff0000",
|
||||
"purple": "800080",
|
||||
"fuchsia": "ff00ff",
|
||||
"green": "008000",
|
||||
"lime": "00ff00",
|
||||
"olive": "808000",
|
||||
"yellow": "ffff00",
|
||||
"navy": "000080",
|
||||
"blue": "0000ff",
|
||||
"teal": "008080",
|
||||
"aqua": "00ffff",
|
||||
"orange": "ffa500",
|
||||
"aliceblue": "f0f8ff",
|
||||
"antiquewhite": "faebd7",
|
||||
"aquamarine": "7fffd4",
|
||||
"azure": "f0ffff",
|
||||
"beige": "f5f5dc",
|
||||
"bisque": "ffe4c4",
|
||||
"blanchedalmond": "ffebcd",
|
||||
"blueviolet": "8a2be2",
|
||||
"brown": "a52a2a",
|
||||
"burlywood": "deb887",
|
||||
"cadetblue": "5f9ea0",
|
||||
"chartreuse": "7fff00",
|
||||
"chocolate": "d2691e",
|
||||
"coral": "ff7f50",
|
||||
"cornflowerblue": "6495ed",
|
||||
"cornsilk": "fff8dc",
|
||||
"crimson": "dc143c",
|
||||
"darkblue": "00008b",
|
||||
"darkcyan": "008b8b",
|
||||
"darkgoldenrod": "b8860b",
|
||||
"darkgray": "a9a9a9",
|
||||
"darkgreen": "006400",
|
||||
"darkgrey": "a9a9a9",
|
||||
"darkkhaki": "bdb76b",
|
||||
"darkmagenta": "8b008b",
|
||||
"darkolivegreen": "556b2f",
|
||||
"darkorange": "ff8c00",
|
||||
"darkorchid": "9932cc",
|
||||
"darkred": "8b0000",
|
||||
"darksalmon": "e9967a",
|
||||
"darkseagreen": "8fbc8f",
|
||||
"darkslateblue": "483d8b",
|
||||
"darkslategray": "2f4f4f",
|
||||
"darkslategrey": "2f4f4f",
|
||||
"darkturquoise": "00ced1",
|
||||
"darkviolet": "9400d3",
|
||||
"deeppink": "ff1493",
|
||||
"deepskyblue": "00bfff",
|
||||
"dimgray": "696969",
|
||||
"dimgrey": "696969",
|
||||
"dodgerblue": "1e90ff",
|
||||
"firebrick": "b22222",
|
||||
"floralwhite": "fffaf0",
|
||||
"forestgreen": "228b22",
|
||||
"gainsboro": "dcdcdc",
|
||||
"ghostwhite": "f8f8ff",
|
||||
"gold": "ffd700",
|
||||
"goldenrod": "daa520",
|
||||
"greenyellow": "adff2f",
|
||||
"grey": "808080",
|
||||
"honeydew": "f0fff0",
|
||||
"hotpink": "ff69b4",
|
||||
"indianred": "cd5c5c",
|
||||
"indigo": "4b0082",
|
||||
"ivory": "fffff0",
|
||||
"khaki": "f0e68c",
|
||||
"lavender": "e6e6fa",
|
||||
"lavenderblush": "fff0f5",
|
||||
"lawngreen": "7cfc00",
|
||||
"lemonchiffon": "fffacd",
|
||||
"lightblue": "add8e6",
|
||||
"lightcoral": "f08080",
|
||||
"lightcyan": "e0ffff",
|
||||
"lightgoldenrodyellow": "fafad2",
|
||||
"lightgray": "d3d3d3",
|
||||
"lightgreen": "90ee90",
|
||||
"lightgrey": "d3d3d3",
|
||||
"lightpink": "ffb6c1",
|
||||
"lightsalmon": "ffa07a",
|
||||
"lightseagreen": "20b2aa",
|
||||
"lightskyblue": "87cefa",
|
||||
"lightslategray": "778899",
|
||||
"lightslategrey": "778899",
|
||||
"lightsteelblue": "b0c4de",
|
||||
"lightyellow": "ffffe0",
|
||||
"limegreen": "32cd32",
|
||||
"linen": "faf0e6",
|
||||
"mediumaquamarine": "66cdaa",
|
||||
"mediumblue": "0000cd",
|
||||
"mediumorchid": "ba55d3",
|
||||
"mediumpurple": "9370db",
|
||||
"mediumseagreen": "3cb371",
|
||||
"mediumslateblue": "7b68ee",
|
||||
"mediumspringgreen": "00fa9a",
|
||||
"mediumturquoise": "48d1cc",
|
||||
"mediumvioletred": "c71585",
|
||||
"midnightblue": "191970",
|
||||
"mintcream": "f5fffa",
|
||||
"mistyrose": "ffe4e1",
|
||||
"moccasin": "ffe4b5",
|
||||
"navajowhite": "ffdead",
|
||||
"oldlace": "fdf5e6",
|
||||
"olivedrab": "6b8e23",
|
||||
"orangered": "ff4500",
|
||||
"orchid": "da70d6",
|
||||
"palegoldenrod": "eee8aa",
|
||||
"palegreen": "98fb98",
|
||||
"paleturquoise": "afeeee",
|
||||
"palevioletred": "db7093",
|
||||
"papayawhip": "ffefd5",
|
||||
"peachpuff": "ffdab9",
|
||||
"peru": "cd853f",
|
||||
"pink": "ffc0cb",
|
||||
"plum": "dda0dd",
|
||||
"powderblue": "b0e0e6",
|
||||
"rosybrown": "bc8f8f",
|
||||
"royalblue": "4169e1",
|
||||
"saddlebrown": "8b4513",
|
||||
"salmon": "fa8072",
|
||||
"sandybrown": "f4a460",
|
||||
"seagreen": "2e8b57",
|
||||
"seashell": "fff5ee",
|
||||
"sienna": "a0522d",
|
||||
"skyblue": "87ceeb",
|
||||
"slateblue": "6a5acd",
|
||||
"slategray": "708090",
|
||||
"slategrey": "708090",
|
||||
"snow": "fffafa",
|
||||
"springgreen": "00ff7f",
|
||||
"steelblue": "4682b4",
|
||||
"tan": "d2b48c",
|
||||
"thistle": "d8bfd8",
|
||||
"tomato": "ff6347",
|
||||
"turquoise": "40e0d0",
|
||||
"violet": "ee82ee",
|
||||
"wheat": "f5deb3",
|
||||
"whitesmoke": "f5f5f5",
|
||||
"yellowgreen": "9acd32",
|
||||
"rebeccapurple": "663399",
|
||||
}
|
||||
DEFAULT = u"000000"
|
||||
DEFAULT = "000000"
|
||||
|
||||
|
||||
def parse(raw_value, as_string=True):
|
||||
|
|
@ -186,52 +186,52 @@ def parse(raw_value, as_string=True):
|
|||
If value can't be parsed, a warning message is logged, and DEFAULT is returned
|
||||
"""
|
||||
raw_value = raw_value.strip().lower()
|
||||
if raw_value.startswith(u"#"):
|
||||
if raw_value.startswith("#"):
|
||||
# we have a hexadecimal value
|
||||
str_value = raw_value[1:]
|
||||
if len(raw_value) in (3, 4):
|
||||
str_value = u"".join([2 * v for v in str_value])
|
||||
elif raw_value.startswith(u"rgb"):
|
||||
left_p = raw_value.find(u"(")
|
||||
right_p = raw_value.find(u")")
|
||||
str_value = "".join([2 * v for v in str_value])
|
||||
elif raw_value.startswith("rgb"):
|
||||
left_p = raw_value.find("(")
|
||||
right_p = raw_value.find(")")
|
||||
rgb_values = [v.strip() for v in raw_value[left_p + 1 : right_p].split(",")]
|
||||
expected_len = 4 if raw_value.startswith(u"rgba") else 3
|
||||
expected_len = 4 if raw_value.startswith("rgba") else 3
|
||||
if len(rgb_values) != expected_len:
|
||||
log.warning(u"incorrect value: {}".format(raw_value))
|
||||
log.warning("incorrect value: {}".format(raw_value))
|
||||
str_value = DEFAULT
|
||||
else:
|
||||
int_values = []
|
||||
for rgb_v in rgb_values:
|
||||
p_idx = rgb_v.find(u"%")
|
||||
p_idx = rgb_v.find("%")
|
||||
if p_idx == -1:
|
||||
# base 10 value
|
||||
try:
|
||||
int_v = int(rgb_v)
|
||||
if int_v > 255:
|
||||
raise ValueError(u"value exceed 255")
|
||||
raise ValueError("value exceed 255")
|
||||
int_values.append(int_v)
|
||||
except ValueError:
|
||||
log.warning(u"invalid int: {}".format(rgb_v))
|
||||
log.warning("invalid int: {}".format(rgb_v))
|
||||
int_values.append(0)
|
||||
else:
|
||||
# percentage
|
||||
try:
|
||||
int_v = int(int(rgb_v[:p_idx]) / 100.0 * 255)
|
||||
if int_v > 255:
|
||||
raise ValueError(u"value exceed 255")
|
||||
raise ValueError("value exceed 255")
|
||||
int_values.append(int_v)
|
||||
except ValueError:
|
||||
log.warning(u"invalid percent value: {}".format(rgb_v))
|
||||
log.warning("invalid percent value: {}".format(rgb_v))
|
||||
int_values.append(0)
|
||||
str_value = u"".join([u"{:02x}".format(v) for v in int_values])
|
||||
elif raw_value.startswith(u"hsl"):
|
||||
log.warning(u"hue-saturation-lightness not handled yet") # TODO
|
||||
str_value = "".join(["{:02x}".format(v) for v in int_values])
|
||||
elif raw_value.startswith("hsl"):
|
||||
log.warning("hue-saturation-lightness not handled yet") # TODO
|
||||
str_value = DEFAULT
|
||||
else:
|
||||
try:
|
||||
str_value = CSS_COLORS[raw_value]
|
||||
except KeyError:
|
||||
log.warning(u"unrecognised format: {}".format(raw_value))
|
||||
log.warning("unrecognised format: {}".format(raw_value))
|
||||
str_value = DEFAULT
|
||||
|
||||
if as_string:
|
||||
|
|
@ -240,6 +240,6 @@ def parse(raw_value, as_string=True):
|
|||
return tuple(
|
||||
[
|
||||
int(str_value[i] + str_value[i + 1], 16)
|
||||
for i in xrange(0, len(str_value), 2)
|
||||
for i in range(0, len(str_value), 2)
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ SUITS_ORDER = [
|
|||
"carreau",
|
||||
"atout",
|
||||
] # I have switched the usual order 'trefle' and 'carreau' because card are more easy to see if suit colour change (black, red, black, red)
|
||||
VALUES_ORDER = [str(i) for i in xrange(1, 11)] + ["valet", "cavalier", "dame", "roi"]
|
||||
VALUES_ORDER = [str(i) for i in range(1, 11)] + ["valet", "cavalier", "dame", "roi"]
|
||||
|
||||
|
||||
class TarotCard(object):
|
||||
|
|
@ -82,4 +82,4 @@ class TarotCard(object):
|
|||
|
||||
|
||||
# These symbols are diplayed by Libervia next to the player's nicknames
|
||||
SYMBOLS = {"Radiocol": [u"♬"], "Tarot": [u"♠", u"♣", u"♥", u"♦"]}
|
||||
SYMBOLS = {"Radiocol": ["♬"], "Tarot": ["♠", "♣", "♥", "♦"]}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@
|
|||
|
||||
# hack to use this module with pyjamas
|
||||
try:
|
||||
unicode("") # XXX: unicode doesn't exist in pyjamas
|
||||
str("") # XXX: unicode doesn't exist in pyjamas
|
||||
|
||||
# normal version
|
||||
class BaseJID(unicode):
|
||||
class BaseJID(str):
|
||||
def __new__(cls, jid_str):
|
||||
self = unicode.__new__(cls, cls._normalize(jid_str))
|
||||
self = str.__new__(cls, cls._normalize(jid_str))
|
||||
return self
|
||||
|
||||
def __init__(self, jid_str):
|
||||
|
|
@ -114,7 +114,7 @@ class JID(BaseJID):
|
|||
def bare(self):
|
||||
if not self.node:
|
||||
return JID(self.domain)
|
||||
return JID(u"{}@{}".format(self.node, self.domain))
|
||||
return JID("{}@{}".format(self.node, self.domain))
|
||||
|
||||
def is_valid(self):
|
||||
"""
|
||||
|
|
@ -131,4 +131,4 @@ def newResource(entity, resource):
|
|||
@param resource (unicode): new resource
|
||||
@return: a new JID instance
|
||||
"""
|
||||
return JID(u"%s/%s" % (entity.bare, resource))
|
||||
return JID("%s/%s" % (entity.bare, resource))
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ def getText(node):
|
|||
for child in node.childNodes:
|
||||
if child.nodeType == child.TEXT_NODE:
|
||||
data.append(child.wholeText)
|
||||
return u"".join(data)
|
||||
return "".join(data)
|
||||
|
||||
|
||||
class Widget(object):
|
||||
|
|
@ -295,7 +295,7 @@ class XMLUIBase(object):
|
|||
top = parsed_dom.documentElement
|
||||
self.session_id = top.getAttribute("session_id") or None
|
||||
self.submit_id = top.getAttribute("submit") or None
|
||||
self.xmlui_title = title or top.getAttribute("title") or u""
|
||||
self.xmlui_title = title or top.getAttribute("title") or ""
|
||||
self.hidden = {}
|
||||
if flags is None:
|
||||
flags = []
|
||||
|
|
@ -342,8 +342,8 @@ class XMLUIBase(object):
|
|||
raise ValueError("Can't submit is self.submit_id is not set")
|
||||
if "session_id" in data:
|
||||
raise ValueError(
|
||||
u"session_id must no be used in data, it is automaticaly filled with "
|
||||
u"self.session_id if present"
|
||||
"session_id must no be used in data, it is automaticaly filled with "
|
||||
"self.session_id if present"
|
||||
)
|
||||
if self.session_id is not None:
|
||||
data["session_id"] = self.session_id
|
||||
|
|
@ -376,7 +376,7 @@ class ValueGetter(object):
|
|||
return self.__getitem__(name)
|
||||
|
||||
def keys(self):
|
||||
return self.widgets.keys()
|
||||
return list(self.widgets.keys())
|
||||
|
||||
|
||||
class XMLUIPanel(XMLUIBase):
|
||||
|
|
@ -420,7 +420,7 @@ class XMLUIPanel(XMLUIBase):
|
|||
@staticmethod
|
||||
def escape(name):
|
||||
"""Return escaped name for forms"""
|
||||
return u"%s%s" % (C.SAT_FORM_PREFIX, name)
|
||||
return "%s%s" % (C.SAT_FORM_PREFIX, name)
|
||||
|
||||
@property
|
||||
def main_cont(self):
|
||||
|
|
@ -556,7 +556,7 @@ class XMLUIPanel(XMLUIBase):
|
|||
value = getText(value_elt)
|
||||
else:
|
||||
value = (
|
||||
node.getAttribute("value") if node.hasAttribute("value") else u""
|
||||
node.getAttribute("value") if node.hasAttribute("value") else ""
|
||||
)
|
||||
if type_ == "empty":
|
||||
ctrl = self.widget_factory.createEmptyWidget(_xmlui_parent)
|
||||
|
|
@ -569,8 +569,8 @@ class XMLUIPanel(XMLUIBase):
|
|||
data[CURRENT_LABEL] = ctrl
|
||||
elif type_ == "hidden":
|
||||
if name in self.hidden:
|
||||
raise exceptions.ConflictError(u"Conflict on hidden value with "
|
||||
u"name {name}".format(name=name))
|
||||
raise exceptions.ConflictError("Conflict on hidden value with "
|
||||
"name {name}".format(name=name))
|
||||
self.hidden[name] = value
|
||||
continue
|
||||
elif type_ == "jid":
|
||||
|
|
@ -617,7 +617,7 @@ class XMLUIPanel(XMLUIBase):
|
|||
self.ctrl_list[name] = {"type": type_, "control": ctrl}
|
||||
elif type_ == "list":
|
||||
style = [] if node.getAttribute("multi") == "yes" else ["single"]
|
||||
for attr in (u"noselect", u"extensible", u"reducible", u"inline"):
|
||||
for attr in ("noselect", "extensible", "reducible", "inline"):
|
||||
if node.getAttribute(attr) == "yes":
|
||||
style.append(attr)
|
||||
_options = [
|
||||
|
|
@ -778,7 +778,7 @@ class XMLUIPanel(XMLUIBase):
|
|||
escaped = self.escape(field)
|
||||
ctrl = self.ctrl_list[field]
|
||||
if isinstance(ctrl["control"], ListWidget):
|
||||
data[escaped] = u"\t".join(ctrl["control"]._xmluiGetSelectedValues())
|
||||
data[escaped] = "\t".join(ctrl["control"]._xmluiGetSelectedValues())
|
||||
else:
|
||||
data[escaped] = ctrl["control"]._xmluiGetValue()
|
||||
self._xmluiLaunchAction(callback_id, data)
|
||||
|
|
@ -810,7 +810,7 @@ class XMLUIPanel(XMLUIBase):
|
|||
target._xmluiAddValues(values, select=True)
|
||||
else:
|
||||
if isinstance(source, ListWidget):
|
||||
value = u", ".join(source._xmluiGetSelectedValues())
|
||||
value = ", ".join(source._xmluiGetSelectedValues())
|
||||
else:
|
||||
value = source._xmluiGetValue()
|
||||
if action == "move":
|
||||
|
|
@ -877,12 +877,12 @@ class XMLUIPanel(XMLUIBase):
|
|||
ctrl = self.ctrl_list[ctrl_name]
|
||||
if isinstance(ctrl["control"], ListWidget):
|
||||
selected_values.append(
|
||||
(escaped, u"\t".join(ctrl["control"]._xmluiGetSelectedValues()))
|
||||
(escaped, "\t".join(ctrl["control"]._xmluiGetSelectedValues()))
|
||||
)
|
||||
else:
|
||||
selected_values.append((escaped, ctrl["control"]._xmluiGetValue()))
|
||||
data = dict(selected_values)
|
||||
for key, value in self.hidden.iteritems():
|
||||
for key, value in self.hidden.items():
|
||||
data[self.escape(key)] = value
|
||||
|
||||
if self.submit_id is not None:
|
||||
|
|
@ -913,7 +913,7 @@ class XMLUIPanel(XMLUIBase):
|
|||
assert self.type == "param"
|
||||
for ctrl in self.param_changed:
|
||||
if isinstance(ctrl, ListWidget):
|
||||
value = u"\t".join(ctrl._xmluiGetSelectedValues())
|
||||
value = "\t".join(ctrl._xmluiGetSelectedValues())
|
||||
else:
|
||||
value = ctrl._xmluiGetValue()
|
||||
param_name = ctrl._xmlui_name.split(C.SAT_PARAM_SEPARATOR)[1]
|
||||
|
|
@ -1012,10 +1012,10 @@ def registerClass(type_, class_):
|
|||
# TODO: remove this method, as there are seme use cases where different XMLUI
|
||||
# classes can be used in the same frontend, so a global value is not good
|
||||
assert type_ in (CLASS_PANEL, CLASS_DIALOG)
|
||||
log.warning(u"registerClass for XMLUI is deprecated, please use partial with "
|
||||
u"xmlui.create and class_map instead")
|
||||
log.warning("registerClass for XMLUI is deprecated, please use partial with "
|
||||
"xmlui.create and class_map instead")
|
||||
if type_ in _class_map:
|
||||
log.debug(_(u"XMLUI class already registered for {type_}, ignoring").format(
|
||||
log.debug(_("XMLUI class already registered for {type_}, ignoring").format(
|
||||
type_=type_))
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue