diff --git a/Scripts/Python/ki/__init__.py b/Scripts/Python/ki/__init__.py index 3d75c02e13..2f3923f9f8 100644 --- a/Scripts/Python/ki/__init__.py +++ b/Scripts/Python/ki/__init__.py @@ -2483,9 +2483,9 @@ def ChangeFontSize(self, new): size = self.GetFontSize() if new == 1: - fontRange = list(range(len(kChat.FontSizeList) - 1)) + fontRange = range(len(kChat.FontSizeList) - 1) elif new == -1: - fontRange = list(range(len(kChat.FontSizeList) - 1, 0, -1)) + fontRange = range(len(kChat.FontSizeList) - 1, 0, -1) for i in fontRange: if size <= kChat.FontSizeList[i] and new == 1: size = kChat.FontSizeList[i + 1] @@ -3178,8 +3178,8 @@ def RefreshAgeOwnerSettings(self): makepublicTB.setString(" ") status.setStringW(PtGetLocalizedString("KI.Neighborhood.AgeOwnedStatus", [str(numowners), str(osess), str(numvisitors), str(vsess)])) descript = ptGUIControlMultiLineEdit(KIAgeOwnerExpanded.dialog.getControlFromTag(kGUI.BKAgeOwnerDescription)) - encoded = buffer(myAge.getAgeDescription()) - descript.setEncodedBuffer(encoded) + encoded = myAge.getAgeDescription() + descript.setStringW(encoded) #~~~~~~~~# # miniKI # @@ -4537,8 +4537,8 @@ def BigKIDisplayJournalEntry(self): jrnTitle.setString(xCensor.xCensor(element.noteGetTitle(), self.censorLevel)) jrnTitle.show() if not self.BKInEditMode or self.BKEditField != kGUI.BKEditFieldJRNNote: - encoded = buffer(xCensor.xCensor(element.noteGetText(), self.censorLevel)) - jrnNote.setEncodedBuffer(encoded) + text = xCensor.xCensor(element.noteGetText(), self.censorLevel) + jrnNote.setStringW(text) jrnNote.show() self.BigKISetSeen(self.BKCurrentContent) # If it came from someone else, add them to the SendTo field. @@ -6252,8 +6252,8 @@ def ProcessNotifyAgeOwnerExpanded(self, control, event): myAge = self.BKConfigFolderDict[self.BKConfigListOrder[self.BKFolderSelected]] if myAge is not None: PtDebugPrint("xKI.ProcessNotifyAgeOwnerExpanded(): Age description updated for {}.".format(myAge.getDisplayName()), level=kDebugDumpLevel) - buff = descript.getEncodedBuffer() - myAge.setAgeDescription(str(buff)) + buff = descript.getString() + myAge.setAgeDescription(buff) myAge.save() else: PtDebugPrint("xKI.ProcessNotifyAgeOwnerExpanded(): Neighborhood is None while trying to update description.", level=kDebugDumpLevel) diff --git a/Scripts/Python/ki/xKIChat.py b/Scripts/Python/ki/xKIChat.py index ef67d5a896..91361748ec 100644 --- a/Scripts/Python/ki/xKIChat.py +++ b/Scripts/Python/ki/xKIChat.py @@ -908,7 +908,7 @@ def __call__(self, message): return args else: retDisp = command() - if isinstance(retDisp, str) or isinstance(retDisp, str): + if isinstance(retDisp, str): self.chatMgr.DisplayStatusMessage(retDisp) elif isinstance(retDisp, tuple): if retDisp[0]: @@ -932,8 +932,7 @@ def GetPID(self, params): if not params: return 0 try: - pID = int(int(params)) - return pID + return int(params) except ValueError: for player in self.chatMgr.BKPlayerList: if isinstance(player, ptPlayer): diff --git a/Scripts/Python/nxusBookMachine.py b/Scripts/Python/nxusBookMachine.py index 4c4b55fd03..12a6cad8eb 100644 --- a/Scripts/Python/nxusBookMachine.py +++ b/Scripts/Python/nxusBookMachine.py @@ -260,15 +260,6 @@ kChronicleVarType = 0 -def Uni(string): - "Converts a string to unicode, using latin-1 encoding if necessary" - try: - retVal = str(string) - return retVal - except UnicodeDecodeError: - retVal = str(string, "latin-1") - return retVal - class AgeInstance(): def __init__(self, ageData): self.ageInfo = ageData[0] @@ -284,7 +275,7 @@ def __init__(self, ageFilename, defaultMaxPop, linkVisible): class LinkListEntry(): def __init__(self, displayName, displayInfo, description = "", canDelete = False, isEnabled = True): - self.untranslatedName = Uni(displayName) + self.untranslatedName = displayName self.displayName = xLocTools.LocalizeAgeName(displayName) self.displayInfo = displayInfo self.description = description @@ -1472,7 +1463,7 @@ def IUpdateHoodLink(self): displayName = info.getDisplayName() - description = Uni(info.getAgeDescription()) + description = info.getAgeDescription() infoTxt = self.IFormatGZCreateCoords(hoodLink) self.IShowEnableButton(kIDBtnNeighborhoodPublic) self.IShowEnableButton(kIDBtnNeighborhoodSelect) diff --git a/Scripts/Python/plasma/PlasmaTypes.py b/Scripts/Python/plasma/PlasmaTypes.py index 5098b37ff9..d44f8caa45 100644 --- a/Scripts/Python/plasma/PlasmaTypes.py +++ b/Scripts/Python/plasma/PlasmaTypes.py @@ -675,7 +675,7 @@ def __init__(self): def getParentKeys(self): # if we haven't got the parent keys yet, then add them to the dict if not self.gotParentKeys: - for anim in dict.values(self): + for anim in list(dict.values(self)): # get the animation target key aKey = anim.getFirstKey() if aKey: diff --git a/Scripts/Python/xPsnlVaultSDL.py b/Scripts/Python/xPsnlVaultSDL.py index bebed8b8a3..2dabcc1e26 100644 --- a/Scripts/Python/xPsnlVaultSDL.py +++ b/Scripts/Python/xPsnlVaultSDL.py @@ -128,17 +128,17 @@ def ISetVar(self, var, val): #PtDebugPrint("Attempting to set item %s to %s" % (sub, str(val))) if vartype == PtSDLVarType.kInt: - if isintance(val, (int, int)): + if isintance(val, int): #PtDebugPrint("Set int") var.setInt(val) elif vartype == PtSDLVarType.kFloat: - if isinstance(val, (int, int, float)): + if isinstance(val, (int, float)): #PtDebugPrint("Set float") var.setFloat(val) elif vartype == PtSDLVarType.kDouble: - if isinstance(val, (int, int, float)): + if isinstance(val, (int, float)): #PtDebugPrint("Set double") var.setDouble(val) @@ -157,7 +157,7 @@ def ISetVar(self, var, val): var.setString(str(val)) else: - if isinstance(val, (int, int)): + if isinstance(val, int): #PtDebugPrint("Set int") var.setInt(val)