예제 #1
0
파일: twodx.py 프로젝트: rmilne/pynwn
 def to_ContentObject(self):
     """Returns 2dx as a ContentObject.  It's .io contents
     are cStringIO buffer.
     """
     sio = self.to_StringIO()
     resref = self.co.resref
     res_type = 2017
     sio.seek(0, os.SEEK_END)
     size = sio.tell()
     return ContentObject(resref, res_type, sio, 0, size)
예제 #2
0
파일: twodx.py 프로젝트: rmilne/pynwn
    def __init__(self, source):
        if isinstance(source, str):
            source = ContentObject.from_file(source)
        elif not isinstance(source, ContentObject):
            raise ValueError("Unsupported source type %s!" % type(source))

        self.columns = []
        self.rows = []
        self.max = None
        self.newline = "\n"
        self.tlk_columns = None
        self.tlk_offset = None
        self.co = source
        self.description = None
        self.parse(source.get('r'))
예제 #3
0
    def __init__(self, source):
        if isinstance(source, str):
            source = ContentObject.from_file(source)
        elif not isinstance(source, ContentObject):
            raise ValueError("Unsupported source type %s!" % type(source))

        self.columns = []
        self.rows = []
        self.max = None
        self.newline = "\n"
        self.default = None
        self.co = source
        data = source.get()
        if not isinstance(data, str):
            data = data.decode(get_encoding())
        self.parse(data)
예제 #4
0
    def __init__(self, source):
        if isinstance(source, str):
            source = ContentObject.from_file(source)
        elif not isinstance(source, ContentObject):
            raise ValueError("Unsupported source type %s!" % type(source))

        self.columns = []
        self.rows = []
        self.max = None
        self.newline = "\n"
        self.default = None
        self.co = source
        data = source.get()
        if not isinstance(data, str):
            data = data.decode(get_encoding())
        self.parse(data)