Handle unicode, utf8, and windows-1252

This commit is contained in:
Ebag333
2016-11-26 22:57:53 -08:00
parent 459d55c31a
commit 0d4f24ade9
6 changed files with 333 additions and 243 deletions

View File

@@ -1,4 +1,4 @@
#===============================================================================
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
@@ -15,23 +15,25 @@
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# ===============================================================================
import os.path
import config
import wx
import zipfile
import cStringIO
import os.path
import zipfile
import wx
import config
try:
from collections import OrderedDict
except ImportError:
from utils.compat import OrderedDict
class BitmapLoader():
class BitmapLoader():
try:
archive = zipfile.ZipFile(os.path.join(config.pyfaPath, 'imgs.zip'), 'r')
archive = zipfile.ZipFile(config.getPyfaPath('imgs.zip'), 'r')
except IOError:
archive = None
@@ -42,7 +44,7 @@ class BitmapLoader():
@classmethod
def getStaticBitmap(cls, name, parent, location):
static = wx.StaticBitmap(parent)
static.SetBitmap(cls.getBitmap(name,location))
static.SetBitmap(cls.getBitmap(name, location))
return static
@classmethod
@@ -85,7 +87,7 @@ class BitmapLoader():
except KeyError:
print "Missing icon file from zip: {0}".format(path)
else:
path = os.path.join(config.pyfaPath, 'imgs', location, filename)
path = config.getPyfaPath('imgs\\' + location + "\\" + filename)
if os.path.exists(path):
return wx.Image(path)