diff --git a/albow/fields.py b/albow/fields.py index 701adeea0..92feb3953 100644 --- a/albow/fields.py +++ b/albow/fields.py @@ -84,6 +84,8 @@ def key_down(self, event): try: t = pygame.scrap.get(SCRAP_TEXT).replace('\0', '') DEF_ENC = locale.getdefaultlocale()[1] + if DEF_ENC is None: + DEF_ENC = "UTF-8" if type(t) == unicode and DEF_ENC != "UTF-8": t = t.encode(DEF_ENC) self.text = t diff --git a/albow/translate.py b/albow/translate.py index 4bcb05bad..e565e9a72 100644 --- a/albow/translate.py +++ b/albow/translate.py @@ -94,6 +94,8 @@ def getPlatInfo(**kwargs): enc = locale.getdefaultlocale()[1] +if enc is None: + enc = "UTF-8" string_cache = {} font_lang_cache = {} diff --git a/editortools/brush.py b/editortools/brush.py index 49474eeca..ff257f724 100644 --- a/editortools/brush.py +++ b/editortools/brush.py @@ -53,7 +53,8 @@ from __builtin__ import __import__ from locale import getdefaultlocale DEF_ENC = getdefaultlocale()[1] - +if DEF_ENC is None: + DEF_ENC = "UTF-8" log = logging.getLogger(__name__) @@ -568,7 +569,7 @@ def loadBrushPreset(self, name): if key.endswith('blockID'): key = key[:-7] self.options[key] = self.editor.level.materials.blockWithID(loadedBrushOptions[key + 'blockID'], loadedBrushOptions[key+ 'blockData']) - if key + 'recentBlocks' in loadedBrushOptions: + if key + 'recentBlocks' in loadedBrushOptions: list = [] blockList = loadedBrushOptions[key + 'recentBlocks'] for b in blockList: diff --git a/editortools/player.py b/editortools/player.py index e66acbac1..ee5b2d145 100644 --- a/editortools/player.py +++ b/editortools/player.py @@ -92,7 +92,7 @@ def undo(self): self.tool.panel.players.append(version_utils.getPlayerNameFromUUID(self.player)) else: self.tool.panel.players.append("Player") - + if "[No players]" in self.tool.panel.players: self.tool.panel.players.remove("[No players]") self.tool.hidePanel() @@ -149,7 +149,7 @@ def perform(self, recordUndo=True): self.level.playerTagCache[self.level.getPlayerPath(self.player)] = self.playerTag self.level.players.append(self.player) - if self.tool.panel: + if self.tool.panel: self.tool.panel.player_UUID[self.player] = self.player else: @@ -196,7 +196,7 @@ def newPlayer(self): if b != 0 and not done: i = index done = True - spawnY = self.level.Height - i + spawnY = self.level.Height - i playerTag['Pos'] = nbt.TAG_List([nbt.TAG_Double([spawnX, spawnY, spawnZ][i]) for i in range(3)]) playerTag['Rotation'] = nbt.TAG_List([nbt.TAG_Float(0), nbt.TAG_Float(0)]) @@ -471,7 +471,7 @@ def movePlayerToCamera(self): self.editor.addOperation(op) if op.canUndo: self.editor.addUnsavedEdit() - + def delete_skin(self, uuid): del self.playerTexture[uuid] self.playerTexture[uuid] = loadPNGTexture('char.png') diff --git a/mcedit.py b/mcedit.py index 6bf8e2d1f..7c5d0a153 100644 --- a/mcedit.py +++ b/mcedit.py @@ -72,6 +72,8 @@ def format(self, record): import albow import locale DEF_ENC = locale.getdefaultlocale()[1] +if DEF_ENC is None: + DEF_ENC = "UTF-8" from albow.translate import _, getPlatInfo from albow.dialogs import Dialog diff --git a/resource_packs.py b/resource_packs.py index 0d20678ab..2816240ee 100644 --- a/resource_packs.py +++ b/resource_packs.py @@ -8,6 +8,8 @@ import locale DEF_ENC = locale.getdefaultlocale()[1] +if DEF_ENC is None: + DEF_ENC = "UTF-8" try: import resource # @UnresolvedImport @@ -732,7 +734,7 @@ def setup_resource_packs(): except OSError: pass terrains["Default"] = DefaultResourcePack() - + if os.path.exists(os.path.join(directories.getMinecraftProfileDirectory(directories.getSelectedProfile()), "resourcepacks")): zipResourcePacks = directories.getAllOfAFile(unicode(os.path.join(directories.getMinecraftProfileDirectory(directories.getSelectedProfile()), "resourcepacks")), ".zip") folderResourcePacks = os.listdir(unicode(os.path.join(directories.getMinecraftProfileDirectory(directories.getSelectedProfile()), "resourcepacks")))