Continue conversion
This commit is contained in:
parent
be18004bec
commit
d7ab7280f4
15
resources.py
15
resources.py
@ -1,12 +1,13 @@
|
|||||||
from os import listdir
|
from os import listdir
|
||||||
|
|
||||||
class ResourceFile(object):
|
from .buffer import Buffer
|
||||||
|
|
||||||
def __init__(fileName, buf=None):
|
class ResourceFile(object):
|
||||||
|
def __init__(self, fileName, buf=None):
|
||||||
# Ooooh, what does this button do?
|
# Ooooh, what does this button do?
|
||||||
# name(fileName)
|
# name(fileName)
|
||||||
|
|
||||||
if buf:
|
if buf is not None:
|
||||||
buffer = buf
|
buffer = buf
|
||||||
ownBuffer = False
|
ownBuffer = False
|
||||||
else:
|
else:
|
||||||
@ -31,10 +32,6 @@ class ResourceFile(object):
|
|||||||
raise Exception("Incompatible version of resource file '" + name + "'")
|
raise Exception("Incompatible version of resource file '" + name + "'")
|
||||||
except IOError:
|
except IOError:
|
||||||
raise Exception("Invalid resource file '" + name + "'")
|
raise Exception("Invalid resource file '" + name + "'")
|
||||||
|
|
||||||
# How to reproduce this?
|
|
||||||
# int readed = stream.gcount();
|
|
||||||
|
|
||||||
except IOError:
|
except IOError:
|
||||||
raise Exception("Error loading resource file '" + name + "'")
|
raise Exception("Error loading resource file '" + name + "'")
|
||||||
|
|
||||||
@ -50,6 +47,8 @@ class ResourcesCollection:
|
|||||||
try:
|
try:
|
||||||
for name in listdir(directory):
|
for name in listdir(directory):
|
||||||
if not name.startswith('.') and name.endswith('.res'):
|
if not name.startswith('.') and name.endswith('.res'):
|
||||||
self.__files.append(ResourceFile(directory + '/' + name, self.__buffer));
|
self.__files.append(
|
||||||
|
ResourceFile(directory + '/' + name,
|
||||||
|
buf=self.__buffer))
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user